5d1ed868574599ad657e16545f5fb3ee0b2305e1
[blender.git] / intern / cycles / cmake / external_libs.cmake
1 ###########################################################################
2 # Boost setup
3
4 SET(BOOST_ROOT ${CYCLES_BOOST})
5
6 SET(Boost_ADDITIONAL_VERSIONS "1.45" "1.44" 
7                                "1.43" "1.43.0" "1.42" "1.42.0" 
8                                "1.41" "1.41.0" "1.40" "1.40.0"
9                                "1.39" "1.39.0" "1.38" "1.38.0"
10                                "1.37" "1.37.0" "1.34.1" "1_34_1")
11 IF(LINKSTATIC)
12         SET(Boost_USE_STATIC_LIBS ON)
13 ENDIF()
14
15 SET(Boost_USE_MULTITHREADED ON)
16
17 FIND_PACKAGE(Boost 1.34 REQUIRED COMPONENTS filesystem regex system serialization thread)
18
19 MESSAGE(STATUS "Boost found ${Boost_FOUND}")
20 MESSAGE(STATUS "Boost version ${Boost_VERSION}")
21 MESSAGE(STATUS "Boost include dirs ${Boost_INCLUDE_DIRS}")
22 MESSAGE(STATUS "Boost library dirs ${Boost_LIBRARY_DIRS}")
23 MESSAGE(STATUS "Boost libraries ${Boost_LIBRARIES}")
24
25 INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}")
26 LINK_DIRECTORIES("${Boost_LIBRARY_DIRS}")
27
28 IF(WITH_CYCLES_NETWORK)
29         ADD_DEFINITIONS(-DWITH_NETWORK)
30 ENDIF()
31
32 IF(WITH_CYCLES_MULTI)
33         ADD_DEFINITIONS(-DWITH_MULTI)
34 ENDIF()
35
36 ###########################################################################
37 # OpenImageIO
38
39 FIND_LIBRARY(OPENIMAGEIO_LIBRARY NAMES OpenImageIO PATHS ${CYCLES_OIIO}/lib)
40 FIND_PATH(OPENIMAGEIO_INCLUDES OpenImageIO/imageio.h ${CYCLES_OIIO}/include)
41 FIND_PROGRAM(OPENIMAGEIO_IDIFF NAMES idiff PATHS ${CYCLES_OIIO}/bin)
42
43 IF(OPENIMAGEIO_INCLUDES AND OPENIMAGEIO_LIBRARY)
44         SET(OPENIMAGEIO_FOUND TRUE)
45         MESSAGE(STATUS "OpenImageIO includes = ${OPENIMAGEIO_INCLUDES}")
46         MESSAGE(STATUS "OpenImageIO library = ${OPENIMAGEIO_LIBRARY}")
47 ELSE()
48         MESSAGE(STATUS "OpenImageIO not found")
49 ENDIF()
50
51 ADD_DEFINITIONS(-DWITH_OIIO)
52 INCLUDE_DIRECTORIES(${OPENIMAGEIO_INCLUDES} ${OPENIMAGEIO_INCLUDES}/OpenImageIO)
53
54 ###########################################################################
55 # GLUT
56
57 IF(WITH_CYCLES_TEST)
58         SET(GLUT_ROOT_PATH ${CYCLES_GLUT})
59
60         FIND_PACKAGE(GLUT)
61         MESSAGE(STATUS "GLUT_FOUND=${GLUT_FOUND}")
62
63         INCLUDE_DIRECTORIES(${GLUT_INCLUDE_DIR})
64 ENDIF()
65
66 ###########################################################################
67 # OpenShadingLanguage
68
69 IF(WITH_CYCLES_OSL)
70
71         MESSAGE(STATUS "CYCLES_OSL = ${CYCLES_OSL}")
72
73         FIND_LIBRARY(OSL_LIBRARIES NAMES oslexec oslcomp oslquery PATHS ${CYCLES_OSL}/lib)
74         FIND_PATH(OSL_INCLUDES OSL/oslclosure.h ${CYCLES_OSL}/include)
75         FIND_PROGRAM(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
76
77         IF(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
78                 SET(OSL_FOUND TRUE)
79                 MESSAGE(STATUS "OSL includes = ${OSL_INCLUDES}")
80                 MESSAGE(STATUS "OSL library = ${OSL_LIBRARIES}")
81                 MESSAGE(STATUS "OSL compiler = ${OSL_COMPILER}")
82         ELSE()
83                 MESSAGE(STATUS "OSL not found")
84         ENDIF()
85
86         ADD_DEFINITIONS(-DWITH_OSL)
87         INCLUDE_DIRECTORIES(${OSL_INCLUDES} ${OSL_INCLUDES}/OSL ${OSL_INCLUDES}/../../../src/liboslexec)
88
89 ENDIF()
90
91 ###########################################################################
92 # Partio
93
94 IF(WITH_CYCLES_PARTIO)
95
96         MESSAGE(STATUS "CYCLES_PARTIO = ${CYCLES_PARTIO}")
97
98         FIND_LIBRARY(PARTIO_LIBRARIES NAMES partio PATHS ${CYCLES_PARTIO}/lib)
99         FIND_PATH(PARTIO_INCLUDES Partio.h ${CYCLES_PARTIO}/include)
100
101         FIND_PACKAGE(ZLIB)
102
103         IF(PARTIO_INCLUDES AND PARTIO_LIBRARIES AND ZLIB_LIBRARIES)
104                 LIST(APPEND PARTIO_LIBRARIES ${ZLIB_LIBRARIES})
105                 SET(PARTIO_FOUND TRUE)
106                 MESSAGE(STATUS "PARTIO includes = ${PARTIO_INCLUDES}")
107                 MESSAGE(STATUS "PARTIO library = ${PARTIO_LIBRARIES}")
108         ELSE()
109                 MESSAGE(STATUS "PARTIO not found")
110         ENDIF()
111
112         ADD_DEFINITIONS(-DWITH_PARTIO)
113         INCLUDE_DIRECTORIES(${PARTIO_INCLUDES})
114
115 ENDIF()
116
117 ###########################################################################
118 # Blender
119
120 IF(WITH_CYCLES_BLENDER)
121         # FIND_PATH(BLENDER_INCLUDE_DIRS RNA_blender.h PATHS ${CMAKE_BINARY_DIR}/include)
122         SET(BLENDER_INCLUDE_DIRS
123                 ${CMAKE_SOURCE_DIR}/intern/guardedalloc
124                 ${CMAKE_SOURCE_DIR}/source/blender/makesdna
125                 ${CMAKE_SOURCE_DIR}/source/blender/makesrna
126                 ${CMAKE_SOURCE_DIR}/source/blender/blenloader
127                 ${CMAKE_BINARY_DIR}/source/blender/makesrna/intern)
128         IF(WIN32)
129                 SET(BLENDER_LIBRARIES ${CMAKE_BINARY_DIR}/bin/Release/blender.lib)
130         ENDIF()
131 ENDIF()
132
133 ###########################################################################
134 # CUDA
135
136 IF(WITH_CYCLES_CUDA)
137
138         FIND_LIBRARY(CUDA_LIBRARIES NAMES cuda PATHS ${CYCLES_CUDA}/lib ${CYCLES_CUDA}/lib/Win32 NO_DEFAULT_PATH)
139         FIND_PATH(CUDA_INCLUDES cuda.h ${CYCLES_CUDA}/include NO_DEFAULT_PATH)
140         FIND_PROGRAM(CUDA_NVCC NAMES nvcc PATHS ${CYCLES_CUDA}/bin NO_DEFAULT_PATH)
141
142         IF(CUDA_INCLUDES AND CUDA_LIBRARIES AND CUDA_NVCC)
143                 MESSAGE(STATUS "CUDA includes = ${CUDA_INCLUDES}")
144                 MESSAGE(STATUS "CUDA library = ${CUDA_LIBRARIES}")
145                 MESSAGE(STATUS "CUDA nvcc = ${CUDA_NVCC}")
146         ELSE()
147                 MESSAGE(STATUS "CUDA not found")
148         ENDIF()
149
150         ADD_DEFINITIONS(-DWITH_CUDA)
151         INCLUDE_DIRECTORIES(${CUDA_INCLUDES})
152
153 ENDIF()
154
155 ###########################################################################
156 # OpenCL
157
158 IF(WITH_CYCLES_OPENCL)
159
160         IF(APPLE)
161                 SET(OPENCL_INCLUDES "/System/Library/Frameworks/OpenCL.framework/Headers")
162                 SET(OPENCL_LIBRARIES "-framework OpenCL")
163         ENDIF()
164
165         IF(WIN32)
166                 SET(OPENCL_INCLUDES "")
167                 SET(OPENCL_LIRBARIES "OpenCL")
168         ENDIF()
169
170         IF(UNIX AND NOT APPLE)
171                 SET(OPENCL_INCLUDES ${CYCLES_OPENCL})
172                 SET(OPENCL_LIRBARIES "OpenCL")
173         ENDIF()
174
175         ADD_DEFINITIONS(-DWITH_OPENCL)
176         INCLUDE_DIRECTORIES(${OPENCL_INCLUDES})
177
178 ENDIF()
179