CMake: Fix typo in CUDA dynload commit
[blender.git] / intern / cycles / cmake / external_libs.cmake
1 ###########################################################################
2 # Precompiled libraries tips and hints, for find_package().
3
4 if(CYCLES_STANDALONE_REPOSITORY)
5         if(APPLE OR WIN32)
6                 include(precompiled_libs)
7         endif()
8 endif()
9
10 ###########################################################################
11 # GLUT
12
13 if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
14         set(GLUT_ROOT_PATH ${CYCLES_GLUT})
15
16         find_package(GLUT)
17         message(STATUS "GLUT_FOUND=${GLUT_FOUND}")
18
19         include_directories(
20                 SYSTEM
21                 ${GLUT_INCLUDE_DIR}
22         )
23 endif()
24
25 ###########################################################################
26 # GLEW
27
28 # Workaround for unconventional variable name use in Blender.
29 if(NOT CYCLES_STANDALONE_REPOSITORY)
30         set(GLEW_INCLUDE_DIR "${GLEW_INCLUDE_PATH}")
31 endif()
32
33 if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
34         set(CYCLES_APP_GLEW_LIBRARY ${BLENDER_GLEW_LIBRARIES})
35 endif()
36
37 ###########################################################################
38 # CUDA
39
40 if(WITH_CYCLES_CUDA_BINARIES OR NOT WITH_CUDA_DYNLOAD)
41         find_package(CUDA) # Try to auto locate CUDA toolkit
42         if(CUDA_FOUND)
43                 message(STATUS "CUDA nvcc = ${CUDA_NVCC_EXECUTABLE}")
44         else()
45                 message(STATUS "CUDA compiler not found, disabling WITH_CYCLES_CUDA_BINARIES")
46                 set(WITH_CYCLES_CUDA_BINARIES OFF)
47         endif()
48 endif()
49
50 # Packages which are being found by Blender when building from inside Blender
51 # source code. but which we need to take care of when building Cycles from a
52 # standalone repository
53 if(CYCLES_STANDALONE_REPOSITORY)
54         # PThreads
55         # TODO(sergey): Bloody exception, handled in precompiled_libs.cmake.
56         if(NOT WIN32)
57                 set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
58                 find_package(Threads REQUIRED)
59                 set(PTHREADS_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
60         endif()
61
62         ####
63         # OpenGL
64
65         # TODO(sergey): We currently re-use the same variable name as we use
66         # in Blender. Ideally we need to make it CYCLES_GL_LIBRARIES.
67         find_package(OpenGL REQUIRED)
68         find_package(GLEW REQUIRED)
69         list(APPEND BLENDER_GL_LIBRARIES
70                 "${OPENGL_gl_LIBRARY}"
71                 "${OPENGL_glu_LIBRARY}"
72                 "${GLEW_LIBRARY}"
73         )
74
75         ####
76         # OpenImageIO
77         find_package(OpenImageIO REQUIRED)
78         if(OPENIMAGEIO_PUGIXML_FOUND)
79                 set(PUGIXML_INCLUDE_DIR "${OPENIMAGEIO_INCLUDE_DIR/OpenImageIO}")
80                 set(PUGIXML_LIBRARIES "")
81         else()
82                 find_package(PugiXML REQUIRED)
83         endif()
84
85         # OIIO usually depends on OpenEXR, so find this library
86         # but don't make it required.
87         find_package(OpenEXR)
88
89         ####
90         # OpenShadingLanguage
91         if(WITH_CYCLES_OSL)
92                 find_package(OpenShadingLanguage REQUIRED)
93                 find_package(LLVM REQUIRED)
94         endif()
95
96         ####
97         # Boost
98         set(__boost_packages filesystem regex system thread date_time)
99         if(WITH_CYCLES_NETWORK)
100                 list(APPEND __boost_packages serialization)
101         endif()
102         if(WITH_CYCLES_OSL)
103                 # TODO(sergey): This is because of the way how our precompiled
104                 # libraries works, could be different for someone's else libs..
105                 if(APPLE OR MSVC)
106                         list(APPEND __boost_packages wave)
107                 elseif(NOT (${OSL_LIBRARY_VERSION_MAJOR} EQUAL "1" AND ${OSL_LIBRARY_VERSION_MINOR} LESS "6"))
108                         list(APPEND __boost_packages wave)
109                 endif()
110         endif()
111         find_package(Boost 1.48 COMPONENTS ${__boost_packages} REQUIRED)
112         if(NOT Boost_FOUND)
113                 # Try to find non-multithreaded if -mt not found, this flag
114                 # doesn't matter for us, it has nothing to do with thread
115                 # safety, but keep it to not disturb build setups.
116                 set(Boost_USE_MULTITHREADED OFF)
117                 find_package(Boost 1.48 COMPONENTS ${__boost_packages})
118         endif()
119         unset(__boost_packages)
120         set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
121         set(BOOST_LIBRARIES ${Boost_LIBRARIES})
122         set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS})
123         set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
124
125         ####
126         # Logging
127         if(WITH_CYCLES_LOGGING)
128                 find_package(Glog REQUIRED)
129                 find_package(Gflags REQUIRED)
130         endif()
131
132         unset(_lib_DIR)
133 else()
134         if(WIN32)
135                 set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/glog/src/windows)
136                 set(GFLAGS_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/gflags/src)
137         else()
138                 set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/glog/src)
139                 set(GFLAGS_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/gflags/src)
140         endif()
141         set(GFLAGS_NAMESPACE "gflags")
142         set(LLVM_LIBRARIES ${LLVM_LIBRARY})
143 endif()