rigidbody: Don't use icons for constraint type
[blender.git] / CMakeLists.txt
1 # ***** BEGIN GPL LICENSE BLOCK *****
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # The Original Code is Copyright (C) 2006, Blender Foundation
18 # All rights reserved.
19 #
20 # The Original Code is: all of this file.
21 #
22 # Contributor(s): Jacques Beaurain.
23 #
24 # ***** END GPL LICENSE BLOCK *****
25
26 #-----------------------------------------------------------------------------
27 # We don't allow in-source builds. This causes no end of troubles because
28 # all out-of-source builds will use the CMakeCache.txt file there and even
29 # build the libs and objects in it.
30
31 if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
32         if(NOT DEFINED WITH_IN_SOURCE_BUILD)
33                 message(FATAL_ERROR
34                         "CMake generation for blender is not allowed within the source directory!"
35                         "\n Remove the CMakeCache.txt file and try again from another folder, e.g.:"
36                         "\n "
37                         "\n rm CMakeCache.txt"
38                         "\n cd .."
39                         "\n mkdir cmake-make"
40                         "\n cd cmake-make"
41                         "\n cmake ../blender"
42                         "\n "
43                         "\n Alternately define WITH_IN_SOURCE_BUILD to force this option (not recommended!)"
44                 )
45         endif()
46 endif()
47
48 cmake_minimum_required(VERSION 2.8)
49
50 if(NOT EXECUTABLE_OUTPUT_PATH)
51         set(FIRST_RUN "TRUE")
52 endif()
53
54 # this starts out unset
55 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build_files/cmake/Modules")
56
57 # avoid having empty buildtype
58 set(CMAKE_BUILD_TYPE_INIT "Release")
59
60 # quiet output for Makefiles, 'make -s' helps too
61 # set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
62
63 # global compile definitions since add_definitions() adds for all.
64 set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG           DEBUG _DEBUG)
65 set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE         NDEBUG)
66 set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL      NDEBUG)
67 set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO  NDEBUG)
68
69
70 #-----------------------------------------------------------------------------
71 # Set policy
72
73 # see "cmake --help-policy CMP0003"
74 # So library linking is more sane
75 cmake_policy(SET CMP0003 NEW)
76
77 # So BUILDINFO and BLENDERPATH strings are automatically quoted
78 cmake_policy(SET CMP0005 NEW)
79
80 # So syntax problems are errors
81 cmake_policy(SET CMP0010 NEW)
82
83 # Input directories must have CMakeLists.txt
84 cmake_policy(SET CMP0014 NEW)
85
86 #-----------------------------------------------------------------------------
87 # Load some macros.
88 include(build_files/cmake/macros.cmake)
89
90
91 #-----------------------------------------------------------------------------
92 # Initialize project.
93
94 blender_project_hack_pre()
95
96 project(Blender)
97
98 blender_project_hack_post()
99
100 enable_testing()
101
102 #-----------------------------------------------------------------------------
103 # Redirect output files
104
105 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "" FORCE)
106 set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "" FORCE)
107
108 #-----------------------------------------------------------------------------
109 # Set default config options
110
111 get_blender_version()
112
113
114 # Blender internal features
115 option(WITH_BLENDER "Build blender (disable to build only the blender player)" ON)
116 mark_as_advanced(WITH_BLENDER)
117
118 option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
119
120 option(WITH_PYTHON        "Enable Embedded Python API  (only disable for development)" ON)
121 option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default (recommend to leave off)" OFF)
122 mark_as_advanced(WITH_PYTHON)  # dont want people disabling this unless they really know what they are doing.
123 mark_as_advanced(WITH_PYTHON_SECURITY)  # some distributions see this as a security issue, rather than have them patch it, make a build option.
124
125 option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF)
126 option(WITH_PYTHON_MODULE "Enable building as a python module which runs without a user interface, like running regular blender in background mode (experimental, only enable for development)" OFF)
127 option(WITH_BUILDINFO     "Include extra build details (only disable for development & faster builds)" ON)
128 option(WITH_IK_ITASC      "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON)
129 option(WITH_IK_SOLVER     "Enable Legacy IK solver (only disable for development)" ON)
130 option(WITH_FFTW3         "Enable FFTW3 support (Used for smoke and audio effects)" ON)
131 option(WITH_BULLET        "Enable Bullet (Physics Engine)" ON)
132 option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported due to missing features in upstream!)" )
133 mark_as_advanced(WITH_SYSTEM_BULLET)
134 option(WITH_GAMEENGINE    "Enable Game Engine" ON)
135 option(WITH_PLAYER        "Build Player" OFF)
136 option(WITH_OPENCOLORIO   "Enable OpenColorIO color management" ON)
137 option(WITH_COMPOSITOR    "Enable the tile based nodal compositor" ON)
138
139 # GHOST Windowing Library Options
140 option(WITH_GHOST_DEBUG   "Enable debugging output for the GHOST library" OFF)
141 mark_as_advanced(WITH_GHOST_DEBUG)
142
143 option(WITH_GHOST_SDL    "Enable building blender against SDL for windowing rather then the native APIs" OFF)
144 mark_as_advanced(WITH_GHOST_SDL)
145
146 # Misc...
147 option(WITH_HEADLESS      "Build without graphical support (renderfarm, server mode only)" OFF)
148 mark_as_advanced(WITH_HEADLESS)
149
150 option(WITH_AUDASPACE    "Build with blenders audio library (only disable if you know what you're doing!)" ON)
151 mark_as_advanced(WITH_AUDASPACE)
152
153 option(WITH_BOOL_COMPAT "Continue defining \"TRUE\" and \"FALSE\" until these can be replaced with \"true\" and \"false\" from stdbool.h" ON)
154 mark_as_advanced(WITH_BOOL_COMPAT)
155
156
157 # (unix defaults to OpenMP On)
158 if((UNIX AND NOT APPLE) OR (MINGW))
159         set(PLATFORM_DEFAULT ON)
160 else()
161         set(PLATFORM_DEFAULT OFF)
162 endif()
163 option(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" ${PLATFORM_DEFAULT})
164 unset(PLATFORM_DEFAULT)
165
166
167 if(UNIX AND NOT APPLE)
168         option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)"   ON)
169         option(WITH_X11_XF86VMODE "Enable X11 video mode switching"     ON)
170         option(WITH_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by the operating system" ON)
171
172         # freebsd doesn't seems to support XDND
173         if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
174                 option(WITH_GHOST_XDND   "Enable drag'n'drop support on Linux using XDND protocol" ON)
175         endif()
176 else()
177         # not an option for other OS's
178         set(WITH_SYSTEM_GLEW OFF)
179 endif()
180
181
182 # (unix defaults to System OpenJPEG On)
183 if(UNIX AND NOT APPLE)
184         set(PLATFORM_DEFAULT ON)
185 else()
186         set(PLATFORM_DEFAULT OFF)
187 endif()
188 option(WITH_SYSTEM_OPENJPEG "Use the operating systems OpenJPEG library" ${PLATFORM_DEFAULT})
189 unset(PLATFORM_DEFAULT)
190
191
192 # Modifiers
193 option(WITH_MOD_FLUID           "Enable Elbeem Modifier (Fluid Simulation)" ON)
194 option(WITH_MOD_SMOKE           "Enable Smoke Modifier (Smoke Simulation)" ON)
195 option(WITH_MOD_BOOLEAN         "Enable Boolean Modifier" ON)
196 option(WITH_MOD_REMESH          "Enable Remesh Modifier" ON)
197 # option(WITH_MOD_CLOTH_ELTOPO    "Enable Experimental cloth solver" OFF)  # this is now only available in a branch
198 # mark_as_advanced(WITH_MOD_CLOTH_ELTOPO)
199 option(WITH_MOD_OCEANSIM        "Enable Ocean Modifier" OFF)
200
201 # Image format support
202 option(WITH_IMAGE_OPENEXR       "Enable OpenEXR Support (http://www.openexr.com)" ON)
203 option(WITH_IMAGE_OPENJPEG      "Enable OpenJpeg Support (http://www.openjpeg.org)" ON)
204 option(WITH_IMAGE_TIFF          "Enable LibTIFF Support" ON)
205 option(WITH_IMAGE_DDS           "Enable DDS Image Support" ON)
206 option(WITH_IMAGE_CINEON        "Enable CINEON and DPX Image Support" ON)
207 option(WITH_IMAGE_HDR           "Enable HDR Image Support" ON)
208 option(WITH_IMAGE_REDCODE       "Enable RedCode Image Support" OFF)
209 option(WITH_IMAGE_FRAMESERVER   "Enable image FrameServer Support for rendering" ON)
210
211 # Audio/Video format support
212 option(WITH_CODEC_AVI           "Enable Blenders own AVI file support (raw/jpeg)" ON)
213 option(WITH_CODEC_FFMPEG        "Enable FFMPeg Support (http://ffmpeg.org)" OFF)
214
215 option(WITH_CODEC_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
216 if(APPLE OR (WIN32 AND NOT UNIX))
217         option(WITH_CODEC_QUICKTIME     "Enable Quicktime Support" OFF)
218 endif()
219
220 # 3D format support
221 # disable opencollada on non-apple unix because opencollada has no package for debian
222 option(WITH_OPENCOLLADA         "Enable OpenCollada Support (http://www.opencollada.org)"       OFF)
223
224 # Sound output
225 option(WITH_SDL           "Enable SDL for sound and joystick support" ON)
226 option(WITH_OPENAL        "Enable OpenAL Support (http://www.openal.org)" ON)
227 option(WITH_JACK          "Enable Jack Support (http://www.jackaudio.org)" OFF)
228
229 # Compression
230 option(WITH_LZO           "Enable fast LZO compression (used for pointcache)" ON)
231 option(WITH_LZMA          "Enable best LZMA compression, (used for pointcache)" ON)
232
233 # Camera/motion tracking
234 option(WITH_LIBMV         "Enable libmv structure from motion library" ON)
235
236 # Misc
237 option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ON)
238 option(WITH_RAYOPTIMIZATION     "Enable use of SIMD (SSE) optimizations for the raytracer" ON)
239 if(UNIX AND NOT APPLE)
240         option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON)
241         option(WITH_STATIC_LIBS "Try to link with static libraries, as much as possible, to make blender more portable across distributions" OFF)
242 endif()
243 option(WITH_PYTHON_INSTALL       "Copy system python into the blender install folder" ON)
244 option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install folder"  ON)
245 set(PYTHON_NUMPY_PATH            "" CACHE PATH "Python to python site-packages or dist-packages containing 'numpy' module")
246 mark_as_advanced(PYTHON_NUMPY_PATH)
247
248 # Cycles
249 option(WITH_CYCLES                                      "Enable cycles Render Engine" ON)
250 option(WITH_CYCLES_TEST                         "Build cycles test application" OFF)
251 option(WITH_CYCLES_OSL                          "Build Cycles with OSL support" OFF)
252 option(WITH_CYCLES_CUDA_BINARIES        "Build cycles CUDA binaries" OFF)
253 set(CYCLES_CUDA_BINARIES_ARCH sm_13 sm_20 sm_21 sm_30 CACHE STRING "CUDA architectures to build binaries for")
254 mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
255 unset(PLATFORM_DEFAULT)
256
257 # LLVM
258 option(WITH_LLVM                                        "Use LLVM" OFF)
259
260 # disable for now, but plan to support on all platforms eventually
261 option(WITH_MEM_JEMALLOC   "Enable malloc replacement (http://www.canonware.com/jemalloc)" OFF)
262 mark_as_advanced(WITH_MEM_JEMALLOC)
263
264 # Debug
265 option(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF)
266 mark_as_advanced(WITH_CXX_GUARDEDALLOC)
267
268 option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" OFF)
269 mark_as_advanced(WITH_ASSERT_ABORT)
270
271 option(WITH_BOOST                                       "Enable features depending no boost" ON)
272
273
274 if(APPLE)
275         cmake_minimum_required(VERSION 2.8.8)
276         cmake_policy(VERSION 2.8.8)
277
278         if(NOT CMAKE_OSX_ARCHITECTURES)
279                 set(CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING
280                 "Choose the architecture you want to build Blender for: i386, x86_64 or ppc"
281                 FORCE)
282         endif()
283         
284         execute_process(COMMAND uname -r OUTPUT_VARIABLE MAC_SYS) # check for actual system-version
285         if (${MAC_SYS} MATCHES 12)
286                 set(OSX_SYSTEM 10.8)
287         elseif (${MAC_SYS} MATCHES 11)
288                 set(OSX_SYSTEM 10.7)
289         elseif(${MAC_SYS} MATCHES 10)
290                 set(OSX_SYSTEM 10.6)
291         elseif(${MAC_SYS} MATCHES 9)
292                 set(OSX_SYSTEM 10.5)
293         else()
294                 set(OSX_SYSTEM unsupported)
295         endif()
296         message(STATUS "Detected system-version: " ${OSX_SYSTEM})
297
298         if(${CMAKE_GENERATOR} MATCHES "Xcode")
299         
300                 ##### cmake incompatibility with xcode  4.3 and higher #####
301                 if(${XCODE_VERSION} MATCHES '') # cmake fails due looking for xcode in the wrong path, thus will be empty var
302                         message(FATAL_ERROR "Xcode 4.3 and higher must be used with cmake 2.8-8 or higher")
303                 endif()
304                 ### end cmake incompatibility with xcode 4.3 and higher ###
305                 
306                 if(${XCODE_VERSION} VERSION_EQUAL 4 OR ${XCODE_VERSION} VERSION_GREATER 4 AND ${XCODE_VERSION} VERSION_LESS 4.3)
307                         # Xcode 4 defaults to the Apple LLVM Compiler.
308                         # Override the default compiler selection because Blender only compiles with gcc up to xcode 4.2
309                         set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42")
310                         message(STATUS "Setting compiler to: " ${CMAKE_XCODE_ATTRIBUTE_GCC_VERSION})
311                 endif()
312         else() # unix makefile generator does not fill XCODE_VERSION var, so we get it with a command
313                 execute_process(COMMAND xcodebuild -version OUTPUT_VARIABLE XCODE_VERS_BUILD_NR)
314                 string(SUBSTRING "${XCODE_VERS_BUILD_NR}" 6 3 XCODE_VERSION) # truncate away build-nr
315                 unset(XCODE_VERS_BUILD_NR)
316         endif()
317         
318         message(STATUS "Detected Xcode-version: " ${XCODE_VERSION})
319
320         if(${XCODE_VERSION} VERSION_LESS 4.3)
321                 set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE)  # use guaranteed existing sdk
322         else()
323                 # note: i don't use xcode-select path on purpose, cause also /Applications/Xcode.app would be allowed
324                 # absolute pathes are more foolproof here !
325                 set(OSX_SYSROOT_PREFIX /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform)
326                 set(OSX_DEVELOPER_PREFIX /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk) # use guaranteed existing sdk
327                 set(CMAKE_OSX_SYSROOT ${OSX_SYSROOT_PREFIX}/${OSX_DEVELOPER_PREFIX} CACHE PATH "" FORCE)
328         endif()
329         
330         if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
331                         set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5" CACHE STRING "" FORCE) # 10.5 is our min. target, if you use higher sdk, weak linking happens
332         endif()
333         
334         if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
335                 # force CMAKE_OSX_DEPLOYMENT_TARGET for makefiles, will not work else ( cmake bug ? )
336                 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
337                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
338                 add_definitions ("-DMACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
339         endif()
340
341         option(WITH_COCOA         "Use Cocoa framework instead of deprecated Carbon" ON)
342         option(USE_QTKIT          "Use QtKit instead of Carbon quicktime (needed for having partial quicktime for 64bit)" OFF)
343         option(WITH_LIBS10.5  "Use 10.5 libs (needed for 64bit builds)" OFF)
344         if(CMAKE_OSX_ARCHITECTURES MATCHES x86_64)
345                 set(USE_QTKIT ON CACHE BOOL "ON" FORCE) # no Quicktime in 64bit
346         endif()
347 endif()
348
349
350 #-----------------------------------------------------------------------------
351 # Check for conflicting/unsupported configurations
352
353 if(NOT WITH_BLENDER AND NOT WITH_PLAYER AND NOT WITH_CYCLES_TEST)
354         message(FATAL_ERROR "At least one of WITH_BLENDER or WITH_PLAYER must be enabled, nothing to do!")
355 endif()
356
357 if(NOT WITH_GAMEENGINE AND WITH_PLAYER)
358         message(FATAL_ERROR "WITH_PLAYER requires WITH_GAMEENGINE")
359 endif()
360
361 if(NOT WITH_AUDASPACE)
362         if(WITH_OPENAL)
363                 message(FATAL_ERROR "WITH_OPENAL requires WITH_AUDASPACE")
364         endif()
365         if(WITH_JACK)
366                 message(FATAL_ERROR "WITH_JACK requires WITH_AUDASPACE")
367         endif()
368         if(WITH_GAMEENGINE)
369                 message(FATAL_ERROR "WITH_GAMEENGINE requires WITH_AUDASPACE")
370         endif()
371 endif()
372
373 if(NOT WITH_SDL AND WITH_GHOST_SDL)
374         message(FATAL_ERROR "WITH_GHOST_SDL requires WITH_SDL")
375 endif()
376
377 if(WITH_IMAGE_REDCODE AND ((NOT WITH_IMAGE_OPENJPEG) OR (NOT WITH_CODEC_FFMPEG)))
378         message(FATAL_ERROR "WITH_IMAGE_REDCODE requires WITH_IMAGE_OPENJPEG and WITH_CODEC_FFMPEG")
379 endif()
380
381 # python module, needs some different options
382 if(WITH_PYTHON_MODULE AND WITH_PLAYER)
383         message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PLAYER to be OFF")
384 endif()
385
386 if(WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL)
387         message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PYTHON_INSTALL to be OFF")
388 endif()
389
390
391 # may as well build python module without a UI
392 if(WITH_PYTHON_MODULE)
393         set(WITH_HEADLESS ON)
394 endif()
395
396 # auto enable openimageio for cycles
397 if(WITH_CYCLES)
398         set(WITH_OPENIMAGEIO ON)
399 endif()
400
401 # enable boost for cycles, booleans, audaspace or i18n
402 # otherwise if the user disabled
403 if(NOT WITH_BOOST)
404         # Explicitly disabled. so disable all deps.
405         set(WITH_CYCLES         OFF)
406         set(WITH_MOD_BOOLEAN    OFF)
407         set(WITH_AUDASPACE      OFF)
408         set(WITH_INTERNATIONAL  OFF)
409
410         set(WITH_OPENAL         OFF)  # depends on AUDASPACE
411         set(WITH_GAMEENGINE     OFF)  # depends on AUDASPACE
412 elseif(WITH_CYCLES OR WITH_MOD_BOOLEAN OR WITH_AUDASPACE OR WITH_INTERNATIONAL)
413         # Keep enabled
414 else()
415         # Enabled but we don't need it
416         set(WITH_BOOST OFF)
417 endif()
418
419 # auto enable llvm for cycles_osl
420 if(WITH_CYCLES_OSL)
421         set(WITH_LLVM ON CACHE BOOL "ON" FORCE)
422 endif()
423
424 # don't store paths to libs for portable distribution
425 if(WITH_INSTALL_PORTABLE)
426         set(CMAKE_SKIP_BUILD_RPATH TRUE)
427 endif()
428
429 if(WITH_GHOST_SDL OR WITH_HEADLESS)
430         set(WITH_GHOST_XDND OFF)
431         set(WITH_X11_XF86VMODE OFF)
432         set(WITH_X11_XINPUT OFF)
433 endif()
434
435 if(MINGW)
436         if(WITH_CODEC_QUICKTIME)
437                 message(FATAL_ERROR "MINGW requires WITH_CODEC_QUICKTIME to be OFF "
438                                     "because it is currently unsupported, remove this "
439                                     "line if youre a developer who wants to add support.")
440         endif()
441 endif()
442
443 TEST_SSE_SUPPORT(COMPILER_SSE_FLAG COMPILER_SSE2_FLAG)
444
445 TEST_STDBOOL_SUPPORT()
446 if(HAVE_STDBOOL_H)
447         add_definitions(-DHAVE_STDBOOL_H)
448 endif()
449 if(WITH_BOOL_COMPAT)
450         add_definitions(-DWITH_BOOL_COMPAT)
451 endif()
452
453 #-----------------------------------------------------------------------------
454 # Check for valid directories
455 # ... svn extern paths can be missing because of svn-git.
456
457 if(WITH_INTERNATIONAL)
458         if(NOT EXISTS "${CMAKE_SOURCE_DIR}/release/datafiles/locale")
459                 message(WARNING "Translation path '${CMAKE_SOURCE_DIR}/release/datafiles/locale' is missing, "
460                                                 "This is an 'svn external', which are known not to work with bridges to other version "
461                                                 "control systems, disabling 'WITH_INTERNATIONAL'.")
462                 set(WITH_INTERNATIONAL OFF)
463         endif()
464 endif()
465
466 if(WITH_PYTHON)
467         if(NOT EXISTS "${CMAKE_SOURCE_DIR}/release/scripts/addons")
468                 message(WARNING "Addons path '${CMAKE_SOURCE_DIR}/release/scripts/addons' is missing, "
469                                                 "This is an 'svn external', which are known not to work with bridges to other version "
470                                                 "control systems: * CONTINUING WITHOUT ADDONS *")
471         endif()
472 endif()
473
474 #-----------------------------------------------------------------------------
475 # Initialize un-cached vars, avoid unused warning
476
477 # linux only, not cached
478 set(WITH_BINRELOC OFF)
479
480 # MAXOSX only, set to avoid uninitialized
481 set(EXETYPE "")
482
483 # C/C++ flags
484 set(PLATFORM_CFLAGS)
485
486 # these are added to later on.
487 set(C_WARNINGS)
488 set(CXX_WARNINGS)
489
490 # for gcc -Wno-blah-blah
491 set(CC_REMOVE_STRICT_FLAGS)
492
493 # libraries to link the binary with passed to target_link_libraries()
494 # known as LLIBS to scons
495 set(PLATFORM_LINKLIBS "")
496
497 # Added to linker flags in setup_liblinks
498 # - CMAKE_EXE_LINKER_FLAGS
499 # - CMAKE_EXE_LINKER_FLAGS_DEBUG
500 set(PLATFORM_LINKFLAGS "")
501 set(PLATFORM_LINKFLAGS_DEBUG "")
502
503
504 # disabled for now, not supported
505 # option(WITH_WEBPLUGIN     "Enable Web Plugin (Unix only)" OFF)
506
507 # For alternate Python locations the commandline can be used to override detected/default cache settings, e.g:
508 # On Unix:
509 #   cmake ../blender \
510 #         -D PYTHON_VERSION=3.3 \
511 #         -D PYTHON_INCLUDE_DIR=/opt/py33/include/python3.3d \
512 #         -D PYTHON_LIBRARY=/opt/py33/lib/libpython3.3d.so
513 #
514 # On Macs:
515 #   cmake ../blender \
516 #         -D PYTHON_INCLUDE_DIR=/System/Library/Frameworks/Python.framework/Versions/3.3/include/python3.3 \
517 #         -D PYTHON_LIBPATH=/System/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/config \
518 #         -G Xcode
519 #
520 # When changing any of this remember to update the notes in doc/build_systems/cmake.txt
521
522 #-----------------------------------------------------------------------------
523 #Platform specifics
524
525 if(UNIX AND NOT APPLE)
526         macro(find_package_wrapper)
527                 STRING(TOUPPER ${ARGV0} _NAME_UPPER)
528                 if(${WITH_STATIC_LIBS})
529                         set(_cmake_find_library_suffixes_back ${CMAKE_FIND_LIBRARY_SUFFIXES})
530                         set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
531                 endif()
532                 find_package(${ARGV})
533                 if(${WITH_STATIC_LIBS})
534                         set(CMAKE_FIND_LIBRARY_SUFFIXES ${_cmake_find_library_suffixes_back})
535                         unset(_cmake_find_library_suffixes_back)
536                 endif()
537         endmacro()
538
539         find_package_wrapper(JPEG REQUIRED)
540         find_package_wrapper(PNG REQUIRED)
541         find_package_wrapper(ZLIB REQUIRED)
542         find_package_wrapper(Freetype REQUIRED)
543
544         if(WITH_PYTHON)
545                 # No way to set py33. remove for now.
546                 # find_package(PythonLibs)
547
548                 # Use our own instead, since wothout py is such a rare case,
549                 # require this package
550                 # XXX Linking errors with debian static python :/
551 #               find_package_wrapper(PythonLibsUnix REQUIRED)
552                 find_package(PythonLibsUnix REQUIRED)
553         endif()
554
555         if(WITH_IMAGE_OPENEXR)
556                 find_package_wrapper(OpenEXR)  # our own module
557                 if(NOT OPENEXR_FOUND)
558                         set(WITH_IMAGE_OPENEXR OFF)
559                 endif()
560         endif()
561
562         if(WITH_IMAGE_OPENJPEG)
563                 find_package_wrapper(OpenJPEG)
564                 if(NOT OPENJPEG_FOUND)
565                         set(WITH_IMAGE_OPENJPEG OFF)
566                 endif()
567         endif()
568
569         if(WITH_IMAGE_TIFF)
570                 # XXX Linking errors with debian static tiff :/
571 #               find_package_wrapper(TIFF)
572                 find_package(TIFF)
573                 if(NOT TIFF_FOUND)
574                         set(WITH_IMAGE_TIFF OFF)
575                 endif()
576         endif()
577
578         # Audio IO
579         if(WITH_OPENAL)
580                 find_package_wrapper(OpenAL)
581                 if(NOT OPENAL_FOUND)
582                         set(WITH_OPENAL OFF)
583                 endif()
584         endif()
585
586         if(WITH_SDL)
587                 find_package_wrapper(SDL)
588                 mark_as_advanced(
589                         SDLMAIN_LIBRARY
590                         SDL_INCLUDE_DIR
591                         SDL_LIBRARY
592                         SDL_LIBRARY_TEMP
593                 )
594                 # unset(SDLMAIN_LIBRARY CACHE)
595                 if(NOT SDL_FOUND)
596                         set(WITH_SDL OFF)
597                 endif()
598         endif()
599
600         if(WITH_JACK)
601                 find_package_wrapper(Jack)
602                 if(NOT JACK_FOUND)
603                         set(WITH_JACK OFF)
604                 endif()
605         endif()
606
607         # Codecs
608         if(WITH_CODEC_SNDFILE)
609                 find_package_wrapper(SndFile)
610                 if(NOT SNDFILE_FOUND)
611                         set(WITH_CODEC_SNDFILE OFF)
612                 endif()
613         endif()
614
615         if(WITH_CODEC_FFMPEG)
616                 set(FFMPEG /usr CACHE PATH "FFMPEG Directory")
617                 set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
618
619                 mark_as_advanced(FFMPEG)
620
621                 # lame, but until we have proper find module for ffmpeg
622                 set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
623                 if(EXISTS "${FFMPEG}/include/ffmpeg/")
624                         list(APPEND FFMPEG_INCLUDE_DIRS "${FFMPEG}/include/ffmpeg")
625                 endif()
626                 # end lameness
627
628                 mark_as_advanced(FFMPEG_LIBRARIES)
629                 set(FFMPEG_LIBPATH ${FFMPEG}/lib)
630                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
631         endif()
632
633         if(WITH_FFTW3)
634                 find_package_wrapper(Fftw3)
635                 if(NOT FFTW3_FOUND)
636                         set(WITH_FFTW3 OFF)
637                 endif()
638         endif()
639
640         if(WITH_OPENCOLLADA)
641                 find_package_wrapper(OpenCOLLADA)
642                 if(OPENCOLLADA_FOUND)
643                         find_package_wrapper(XML2)
644                         find_package_wrapper(PCRE)
645                 else()
646                         set(WITH_OPENCOLLADA OFF)
647                 endif()
648         endif()
649
650         if(WITH_MEM_JEMALLOC)
651                 find_package_wrapper(JeMalloc)
652                 if(NOT JEMALLOC_FOUND)
653                         set(WITH_MEM_JEMALLOC OFF)
654                 endif()
655         endif()
656
657         if (WITH_INPUT_NDOF)
658                 find_package_wrapper(Spacenav)
659                 if(NOT SPACENAV_FOUND)
660                         set(WITH_INPUT_NDOF OFF)
661                 endif()
662
663                 # use generic names within blenders buildsystem.
664                 if(SPACENAV_FOUND)
665                         set(NDOF_INCLUDE_DIRS ${SPACENAV_INCLUDE_DIRS})
666                         set(NDOF_LIBRARIES ${SPACENAV_LIBRARIES})
667                 endif()
668         endif()
669
670         if(WITH_BOOST)
671                 # uses in build instructions to override include and library variables
672                 if(NOT BOOST_CUSTOM)
673                         if(${WITH_STATIC_LIBS})
674                                 set(Boost_USE_STATIC_LIBS ON)
675                         endif()
676                         set(Boost_USE_MULTITHREADED ON)
677                         set(__boost_packages filesystem regex system thread date_time)
678                         if (WITH_INTERNATIONAL)
679                                 list(APPEND __boost_packages locale)
680                         endif()
681                         find_package(Boost 1.48 COMPONENTS ${__boost_packages})
682                         if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
683                                 find_package(IcuLinux)
684                         endif()
685                         mark_as_advanced(Boost_DIR)  # why doesnt boost do this?
686                 endif()
687
688                 set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
689                 set(BOOST_LIBRARIES ${Boost_LIBRARIES})
690                 set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS})
691                 set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
692         endif()
693
694         if(WITH_OPENIMAGEIO)
695                 find_package_wrapper(OpenImageIO)
696
697                 set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${ZLIB_LIBRARIES} ${BOOST_LIBRARIES})
698                 set(OPENIMAGEIO_LIBPATH)  # TODO, remove and reference the absolute path everywhere
699                 set(OPENIMAGEIO_DEFINITIONS)
700
701                 if(WITH_IMAGE_TIFF)
702                         list(APPEND OPENIMAGEIO_LIBRARIES "${TIFF_LIBRARY}")
703                 endif()
704                 if(WITH_IMAGE_OPENEXR)
705                         list(APPEND OPENIMAGEIO_LIBRARIES "${OPENEXR_LIBRARIES}")
706                 endif()
707
708                 if(NOT OPENIMAGEIO_FOUND)
709                         set(WITH_OPENIMAGEIO OFF)
710                         message(STATUS "OpenImageIO not found, disabling WITH_CYCLES")
711                 endif()
712         endif()
713
714         if(WITH_OPENCOLORIO)
715                 find_package_wrapper(OpenColorIO)
716
717                 set(OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARIES})
718                 set(OPENCOLORIO_LIBPATH)  # TODO, remove and reference the absolute path everywhere
719                 set(OPENCOLORIO_DEFINITIONS)
720
721                 if(NOT OPENCOLORIO_FOUND)
722                         set(WITH_OPENCOLORIO OFF)
723                         message(STATUS "OpenColorIO not found")
724                 endif()
725         endif()
726
727         # XXX Maybe most of this section should go into an llvm module?
728         if(WITH_LLVM)
729                 # Set llvm version if not specified
730                 if(NOT LLVM_VERSION)
731                         set(LLVM_VERSION "3.0")
732                 endif()
733                 set(LLVM_STATIC YES)
734                 if(LLVM_DIRECTORY)
735                         FIND_PROGRAM(LLVM_CONFIG llvm-config-${LLVM_VERSION} HINTS ${LLVM_DIRECTORY}/bin NO_CMAKE_PATH)
736                         if(NOT LLVM_CONFIG)
737                                 FIND_PROGRAM(LLVM_CONFIG llvm-config HINTS ${LLVM_DIRECTORY}/bin NO_CMAKE_PATH)
738                         endif()
739                 else()
740                         FIND_PROGRAM(LLVM_CONFIG llvm-config-${LLVM_VERSION})
741                         if(NOT LLVM_CONFIG)
742                                 FIND_PROGRAM(LLVM_CONFIG llvm-config)
743                         endif()
744                 endif()
745                 execute_process(COMMAND ${LLVM_CONFIG} --version
746                                 OUTPUT_VARIABLE LLVM_VERSION
747                                 OUTPUT_STRIP_TRAILING_WHITESPACE)
748                 execute_process(COMMAND ${LLVM_CONFIG} --prefix
749                                 OUTPUT_VARIABLE LLVM_DIRECTORY
750                                 OUTPUT_STRIP_TRAILING_WHITESPACE)
751                 execute_process(COMMAND ${LLVM_CONFIG} --libdir
752                                 OUTPUT_VARIABLE LLVM_LIB_DIR
753                                 OUTPUT_STRIP_TRAILING_WHITESPACE)
754                 find_library(LLVM_LIBRARY
755                              NAMES LLVMAnalysis # first of a whole bunch of libs to get
756                              PATHS ${LLVM_LIB_DIR})
757                 message(STATUS "LLVM version  = ${LLVM_VERSION}")
758                 message(STATUS "LLVM dir      = ${LLVM_DIRECTORY}")
759                 message(STATUS "LLVM lib dir  = ${LLVM_LIB_DIR}")
760                 set(LLVM_VERSION ${LLVM_VERSION} CACHE STRING "Version of LLVM to use")
761                 set(LLVM_DIRECTORY ${LLVM_DIRECTORY} CACHE PATH "Path to the LLVM installation")
762
763                 if(LLVM_LIBRARY AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
764                         if(LLVM_STATIC)
765                                 # if static LLVM libraries were requested, use llvm-config to generate
766                                 # the list of what libraries we need, and substitute that in the right
767                                 # way for LLVM_LIBRARY.
768                                 execute_process(COMMAND ${LLVM_CONFIG} --libfiles
769                                                 OUTPUT_VARIABLE LLVM_LIBRARY
770                                                 OUTPUT_STRIP_TRAILING_WHITESPACE)
771                                 string(REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
772                         endif()
773                 else()
774                         message(FATAL_ERROR "LLVM not found.")
775                 endif()
776
777                 # Fix for conflict with Mesa llvmpipe
778                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/source/creator/blender.map")
779         endif()
780
781         if(WITH_CYCLES_OSL)
782                 set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
783         
784                 message(STATUS "CYCLES_OSL = ${CYCLES_OSL}")
785         
786                 find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
787                 find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
788                 find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
789                 # Note: --whole-archive is needed to force loading of all symbols in liboslexec,
790                 # otherwise LLVM is missing the osl_allocate_closure_component function
791                 list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -Wl,--whole-archive ${OSL_LIB_EXEC} -Wl,--no-whole-archive ${OSL_LIB_QUERY})
792                 find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
793                 find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
794         
795                 if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
796                         set(OSL_FOUND TRUE)
797                         message(STATUS "OSL includes = ${OSL_INCLUDES}")
798                         message(STATUS "OSL library = ${OSL_LIBRARIES}")
799                         message(STATUS "OSL compiler = ${OSL_COMPILER}")
800                 else()
801                         message(STATUS "OSL not found")
802                 endif()
803         endif()
804
805         # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
806         set(PLATFORM_LINKLIBS "-lutil -lc -lm -lpthread -lstdc++")
807
808         if((NOT WITH_HEADLESS) AND (NOT WITH_GHOST_SDL))
809                 find_package(X11 REQUIRED)
810                 find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH})
811                 mark_as_advanced(X11_XF86keysym_INCLUDE_PATH)
812
813                 set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} ${X11_X11_LIB}")
814
815                 if(WITH_X11_XINPUT)
816                         if(X11_Xinput_LIB)
817                                 set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} ${X11_Xinput_LIB}")
818                         else()
819                                 set(WITH_X11_XINPUT OFF)
820                         endif()
821                 endif()
822
823                 if(WITH_X11_XF86VMODE)
824                         # XXX, why dont cmake make this available?
825                         FIND_LIBRARY(X11_Xxf86vmode_LIB Xxf86vm   ${X11_LIB_SEARCH_PATH})
826                         mark_as_advanced(X11_Xxf86vmode_LIB)
827                         if(X11_Xxf86vmode_LIB)
828                                 set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} ${X11_Xxf86vmode_LIB}")
829                         else()
830                                 set(WITH_X11_XF86VMODE OFF)
831                         endif()
832                 endif()
833         endif()
834
835         if(CMAKE_SYSTEM_NAME MATCHES "Linux")
836                 if(NOT WITH_PYTHON_MODULE)
837                         # BSD's dont use libdl.so
838                 set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -ldl")
839                         # binreloc is linux only
840                         set(BINRELOC_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/binreloc/include)
841                         set(WITH_BINRELOC ON)
842                 endif()
843         endif()
844
845         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -pthread")
846
847         # lfs on glibc, all compilers should use
848         add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
849
850         # GNU Compiler
851         if(CMAKE_COMPILER_IS_GNUCC)
852                 set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
853         # CLang is the same as GCC for now.
854         elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
855                 set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
856         # Solaris CC
857         elseif(CMAKE_CXX_COMPILER_ID MATCHES "SunPro")
858                 set(PLATFORM_CFLAGS "-pipe -features=extensions -fPIC -D__FUNCTION__=__func__")
859                 
860         # Intel C++ Compiler
861         elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
862                 # think these next two are broken
863                 find_program(XIAR xiar)
864                 if(XIAR)
865                         set(CMAKE_AR "${XIAR}")
866                 endif()
867                 mark_as_advanced(XIAR)
868
869                 find_program(XILD xild)
870                 if(XILD)
871                         set(CMAKE_LINKER "${XILD}")
872                 endif()
873                 mark_as_advanced(XILD)
874
875                 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fp-model precise -prec_div -parallel")
876                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fp-model precise -prec_div -parallel")
877
878                 # set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -diag-enable sc3")
879                 set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
880                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-intel")
881         endif()
882
883 elseif(WIN32)
884
885         # this file is included anyway when building under Windows with cl.exe
886         #  include(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
887
888         if(CMAKE_COMPILER_IS_GNUCC)
889                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32)
890                 INCLUDE (CheckCSourceCompiles) 
891                 # Setup 64bit and 64bit windows systems
892                 CHECK_C_SOURCE_COMPILES("
893                         #ifndef __MINGW64__
894                         #error
895                         #endif
896                         main(){}
897                         " 
898                         WITH_MINGW64)
899                 
900                 if(WITH_MINGW64)
901                         message("Compiling for 64 bit with MinGW-w64.")
902                         set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64)
903                 endif()
904         else()
905                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
906
907                 # Setup 64bit and 64bit windows systems
908                 if(CMAKE_CL_64)
909                         message("64 bit compiler detected.")
910                         set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64)
911                 endif()
912         endif()
913                 
914         add_definitions(-DWIN32)
915
916         set(JPEG "${LIBDIR}/jpeg")
917         set(JPEG_INCLUDE_DIR "${JPEG}/include")
918         set(JPEG_LIBPATH ${JPEG}/lib) # not cmake defined
919
920         set(WINTAB_INC ${LIBDIR}/wintab/include)
921
922         if(WITH_OPENAL)
923                 set(OPENAL ${LIBDIR}/openal)
924                 set(OPENAL_INCLUDE_DIR ${OPENAL}/include)
925                 set(OPENAL_LIBRARY wrap_oal)
926                 set(OPENAL_LIBPATH ${OPENAL}/lib)
927         endif()
928
929         if(WITH_CODEC_SNDFILE)
930                 set(SNDFILE ${LIBDIR}/sndfile)
931                 set(SNDFILE_INCLUDE_DIRS ${SNDFILE}/include)
932                 set(SNDFILE_LIBRARIES libsndfile-1)
933                 set(SNDFILE_LIBPATH ${SNDFILE}/lib) # TODO, deprecate
934         endif()
935
936         if(WITH_SDL)
937                 set(SDL ${LIBDIR}/sdl)
938                 set(SDL_INCLUDE_DIR ${SDL}/include)
939                 set(SDL_LIBRARY SDL)
940                 set(SDL_LIBPATH ${SDL}/lib)
941         endif()
942
943         if(WITH_CODEC_QUICKTIME)
944                 set(QUICKTIME ${LIBDIR}/QTDevWin)
945                 set(QUICKTIME_INCLUDE_DIRS ${QUICKTIME}/CIncludes)
946                 set(QUICKTIME_LIBRARIES qtmlClient)
947                 set(QUICKTIME_LIBPATH ${QUICKTIME}/Libraries)
948         endif()
949
950         if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
951                 add_definitions(-D__SSE__ -D__MMX__)
952         endif()
953
954         if(WITH_CYCLES_OSL)
955                 set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
956         
957                 find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
958                 find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
959                 find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
960                 list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} ${OSL_LIB_EXEC} ${OSL_LIB_QUERY})
961                 find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
962                 find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
963         
964                 if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
965                         set(OSL_FOUND TRUE)
966                 else()
967                         message(STATUS "OSL not found")
968                 endif()
969         endif()
970
971         if(MSVC)
972                 set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid psapi)
973
974                 add_definitions(/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_CONSOLE /D_LIB)
975
976                 set(CMAKE_CXX_FLAGS "/nologo /J /Gd /EHsc" CACHE STRING "MSVC MT C++ flags " FORCE)
977                 set(CMAKE_C_FLAGS   "/nologo /J /Gd"       CACHE STRING "MSVC MT C++ flags " FORCE)
978
979                 if(CMAKE_CL_64)
980                         set(CMAKE_CXX_FLAGS_DEBUG "/Od /Gm /RTC1 /MTd /Zi" CACHE STRING "MSVC MT flags " FORCE)
981                 else()
982                         set(CMAKE_CXX_FLAGS_DEBUG "/Od /Gm /RTC1 /MTd /ZI" CACHE STRING "MSVC MT flags " FORCE)
983                 endif()
984                 set(CMAKE_CXX_FLAGS_RELEASE "/O2 /Ob2 /MT" CACHE STRING "MSVC MT flags " FORCE)
985                 set(CMAKE_CXX_FLAGS_MINSIZEREL "/O1 /Ob1 /MT" CACHE STRING "MSVC MT flags " FORCE)
986                 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /MT /Zi" CACHE STRING "MSVC MT flags " FORCE)
987                 if(CMAKE_CL_64)
988                         set(CMAKE_C_FLAGS_DEBUG "/Od /Gm /RTC1 /MTd /Zi" CACHE STRING "MSVC MT flags " FORCE)
989                 else()
990                         set(CMAKE_C_FLAGS_DEBUG "/Od /Gm /RTC1 /MTd /ZI" CACHE STRING "MSVC MT flags " FORCE)
991                 endif()
992                 set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /MT" CACHE STRING "MSVC MT flags " FORCE)
993                 set(CMAKE_C_FLAGS_MINSIZEREL "/O1 /Ob1 /MT" CACHE STRING "MSVC MT flags " FORCE)
994                 set(CMAKE_C_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /MT /Zi" CACHE STRING "MSVC MT flags " FORCE)
995
996                 # most msvc warnings are C & C++
997                 set(_WARNINGS "/W3 /wd4018 /wd4244 /wd4305 /wd4800 /wd4181 /wd4065 /wd4267 /we4013 /wd4200")
998                 set(C_WARNINGS "${_WARNINGS}")
999                 set(CXX_WARNINGS "${_WARNINGS}")
1000                 unset(_WARNINGS)
1001
1002                 if(WITH_MOD_CLOTH_ELTOPO)
1003                         set(LAPACK ${LIBDIR}/lapack)
1004                         # set(LAPACK_INCLUDE_DIR ${LAPACK}/include)
1005                         set(LAPACK_LIBPATH ${LAPACK}/lib)
1006                         set(LAPACK_LIBRARIES
1007                                 ${LIBDIR}/lapack/lib/libf2c.lib
1008                                 ${LIBDIR}/lapack/lib/clapack_nowrap.lib
1009                                 ${LIBDIR}/lapack/lib/BLAS_nowrap.lib
1010                         )
1011                 endif()
1012
1013                 set(PNG_LIBRARIES libpng)
1014                 set(JPEG_LIBRARIES libjpeg)
1015                 
1016                 set(PNG "${LIBDIR}/png")
1017                 set(PNG_INCLUDE_DIR "${PNG}/include")
1018                 set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
1019
1020                 set(ZLIB_INCLUDE_DIRS ${LIBDIR}/zlib/include)
1021                 if(CMAKE_CL_64)
1022                         set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/libz.lib)
1023                 else()
1024                         set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/zlib.lib)
1025                 endif()
1026
1027                 set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include)
1028                 set(PTHREADS_LIBRARIES ${LIBDIR}/pthreads/lib/pthreadVC2.lib)
1029
1030                 set(FREETYPE ${LIBDIR}/freetype)
1031                 set(FREETYPE_INCLUDE_DIRS
1032                         ${LIBDIR}/freetype/include
1033                         ${LIBDIR}/freetype/include/freetype2
1034                 )
1035                 set(FREETYPE_LIBRARY ${LIBDIR}/freetype/lib/freetype2ST.lib)
1036
1037                 if(WITH_FFTW3)
1038                         set(FFTW3 ${LIBDIR}/fftw3)
1039                         set(FFTW3_LIBRARIES libfftw)
1040                         set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
1041                         set(FFTW3_LIBPATH ${FFTW3}/lib)
1042                 endif()
1043
1044                 if(WITH_OPENCOLLADA)
1045                         set(OPENCOLLADA ${LIBDIR}/opencollada)
1046
1047                         set(OPENCOLLADA_INCLUDE_DIRS
1048                                 ${LIBDIR}/opencollada/include/COLLADAStreamWriter/include
1049                                 ${LIBDIR}/opencollada/include/COLLADABaseUtils/include
1050                                 ${LIBDIR}/opencollada/include/COLLADAFramework/include
1051                                 ${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader/include
1052                                 ${LIBDIR}/opencollada/include/GeneratedSaxParser/include
1053                         )
1054                         set_lib_path(OPENCOLLADA_LIBPATH "opencollada")
1055
1056                         set(OPENCOLLADA_LIBRARIES
1057                                 ${OPENCOLLADA_LIBPATH}/lib/OpenCOLLADASaxFrameworkLoader.lib
1058                                 ${OPENCOLLADA_LIBPATH}/lib/OpenCOLLADAFramework.lib
1059                                 ${OPENCOLLADA_LIBPATH}/lib/OpenCOLLADABaseUtils.lib
1060                                 ${OPENCOLLADA_LIBPATH}/lib/OpenCOLLADAStreamWriter.lib
1061                                 ${OPENCOLLADA_LIBPATH}/lib/MathMLSolver.lib
1062                                 ${OPENCOLLADA_LIBPATH}/lib/GeneratedSaxParser.lib
1063                                 ${OPENCOLLADA_LIBPATH}/lib/xml2.lib
1064                                 ${OPENCOLLADA_LIBPATH}/lib/buffer.lib
1065                                 ${OPENCOLLADA_LIBPATH}/lib/ftoa.lib
1066                                 ${OPENCOLLADA_LIBPATH}/lib/UTF.lib
1067                         )
1068                         set(PCRE_LIBRARIES
1069                                 ${OPENCOLLADA_LIBPATH}/lib/pcre.lib
1070                         )
1071                         
1072                         unset(OPENCOLLADA_LIBPATH)
1073                         
1074                 endif()
1075
1076                 if(WITH_CODEC_FFMPEG)
1077                         set(FFMPEG_INCLUDE_DIRS
1078                                 ${LIBDIR}/ffmpeg/include
1079                                 ${LIBDIR}/ffmpeg/include/msvc
1080                         )
1081                         set(FFMPEG_LIBRARIES
1082                                 ${LIBDIR}/ffmpeg/lib/avcodec-53.lib
1083                                 ${LIBDIR}/ffmpeg/lib/avformat-53.lib
1084                                 ${LIBDIR}/ffmpeg/lib/avdevice-53.lib
1085                                 ${LIBDIR}/ffmpeg/lib/avutil-51.lib
1086                                 ${LIBDIR}/ffmpeg/lib/swscale-2.lib
1087                         )
1088                 endif()
1089
1090                 if(WITH_IMAGE_OPENEXR)
1091                         set_lib_path(OPENEXR "openexr")
1092                         set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
1093                         set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
1094                         set(OPENEXR_LIBPATH ${OPENEXR}/lib)
1095                         set(OPENEXR_LIBRARIES
1096                                 ${OPENEXR_LIBPATH}/Iex.lib
1097                                 ${OPENEXR_LIBPATH}/Half.lib
1098                                 ${OPENEXR_LIBPATH}/IlmImf.lib
1099                                 ${OPENEXR_LIBPATH}/Imath.lib
1100                                 ${OPENEXR_LIBPATH}/IlmThread.lib
1101                         )
1102                 endif()
1103
1104                 if(WITH_IMAGE_TIFF)
1105                         set(TIFF_LIBRARY ${LIBDIR}/tiff/lib/libtiff.lib)
1106                         set(TIFF_INCLUDE_DIR ${LIBDIR}/tiff/include)
1107                 endif()
1108
1109                 if(WITH_JACK)
1110                         set(JACK_INCLUDE_DIRS
1111                                 ${LIBDIR}/jack/include/jack
1112                                 ${LIBDIR}/jack/include
1113                         )
1114                         set(JACK_LIBRARIES ${LIBDIR}/jack/lib/libjack.lib)
1115                 endif()
1116
1117                 if(WITH_PYTHON)
1118                         # normally cached but not since we include them with blender
1119                         if(MSVC10)
1120                                 set(PYTHON_VERSION 3.3) # CACHE STRING)
1121                         else()
1122                                 set(PYTHON_VERSION 3.3) # CACHE STRING)
1123                         endif()
1124
1125                         set_lib_path(PYTHON "python")
1126                         STRING(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
1127                         # Use shared libs for vc2008 and vc2010 until we actually have vc2010 libs
1128                         set(PYTHON_LIBRARY ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.lib)
1129                         # set(PYTHON_LIBRARY ${PYTHON}/lib/python${_PYTHON_VERSION_NO_DOTS}.lib) #CACHE FILEPATH
1130                         unset(_PYTHON_VERSION_NO_DOTS)
1131
1132                         #Shared includes for both vc2008 and vc2010
1133                         set(PYTHON_INCLUDE_DIR ${LIBDIR}/python/include/python${PYTHON_VERSION})
1134
1135                         # uncached vars
1136                         set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
1137                         set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
1138                 endif()
1139
1140                 if(WITH_BOOST)
1141                         set(BOOST ${LIBDIR}/boost)
1142                         set(BOOST_INCLUDE_DIR ${BOOST}/include)
1143                         if(MSVC10)
1144                                 set(BOOST_LIBPATH ${BOOST}/vc2010/lib)
1145                                 set(BOOST_POSTFIX "vc100-mt-s-1_49.lib")
1146                                 set(BOOST_DEBUG_POSTFIX "vc100-mt-sgd-1_49.lib")
1147                         else()
1148                                 set(BOOST_LIBPATH ${BOOST}/lib)
1149                                 set(BOOST_POSTFIX "vc90-mt-s-1_49.lib")
1150                                 set(BOOST_DEBUG_POSTFIX "vc90-mt-sgd-1_49.lib")
1151                         endif()
1152                         set(BOOST_LIBRARIES
1153                                 optimized libboost_date_time-${BOOST_POSTFIX} optimized libboost_filesystem-${BOOST_POSTFIX}
1154                                 optimized libboost_regex-${BOOST_POSTFIX}
1155                                 optimized libboost_system-${BOOST_POSTFIX} optimized libboost_thread-${BOOST_POSTFIX}
1156                                 debug libboost_date_time-${BOOST_DEBUG_POSTFIX} debug libboost_filesystem-${BOOST_DEBUG_POSTFIX}
1157                                 debug libboost_regex-${BOOST_DEBUG_POSTFIX}
1158                                 debug libboost_system-${BOOST_DEBUG_POSTFIX} debug libboost_thread-${BOOST_DEBUG_POSTFIX})
1159                         if(WITH_CYCLES_OSL)
1160                                 set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
1161                                         optimized libboost_wave-${BOOST_POSTFIX}
1162                                         debug libboost_wave-${BOOST_DEBUG_POSTFIX})
1163                         endif()
1164                         if(WITH_INTERNATIONAL)
1165                                 set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
1166                                         optimized libboost_locale-${BOOST_POSTFIX}
1167                                         debug libboost_locale-${BOOST_DEBUG_POSTFIX})
1168                         endif()
1169                         set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
1170                 endif()
1171                         
1172                 if(WITH_OPENIMAGEIO)
1173                         set(OPENIMAGEIO ${LIBDIR}/openimageio)
1174                         set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
1175                         set(OPENIMAGEIO_LIBRARIES optimized OpenImageIO debug OpenImageIO_d)
1176                         set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
1177                         set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
1178                 endif()
1179
1180                 if(WITH_LLVM)
1181                         set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH    "Path to the LLVM installation")
1182                         file(GLOB LLVM_LIBRARY ${LLVM_DIRECTORY}/lib/*.lib)
1183                         set(LLVM_STATIC YES)
1184                 endif()
1185         
1186                 if(WITH_OPENCOLORIO)
1187                         set(OPENCOLORIO ${LIBDIR}/opencolorio)
1188                         set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
1189                         set(OPENCOLORIO_LIBRARIES OpenColorIO)
1190                         set(OPENCOLORIO_LIBPATH ${LIBDIR}/opencolorio/lib)
1191                         set(OPENCOLORIO_DEFINITIONS)
1192                 endif()
1193
1194
1195                 set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib")
1196
1197                 # MSVC only, Mingw doesnt need
1198                 if(CMAKE_CL_64)
1199                         set(PLATFORM_LINKFLAGS "/MACHINE:X64 /OPT:NOREF ${PLATFORM_LINKFLAGS}")
1200                 else()
1201                         set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}")
1202                 endif()
1203
1204                 set(PLATFORM_LINKFLAGS_DEBUG "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
1205
1206                 # used in many places so include globally, like OpenGL
1207                 blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
1208
1209         elseif(CMAKE_COMPILER_IS_GNUCC)
1210         # keep GCC specific stuff here
1211                 set(PLATFORM_LINKLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi")
1212                 set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
1213
1214                 if(WITH_MINGW64)
1215                         #We need to take care though not to have these on debug builds because they may play funky with gdb
1216                         if(CMAKE_BUILD_TYPE MATCHES "Release")
1217                                 set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmmx -ftree-vectorize")
1218                         endif()
1219                         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
1220                         set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -lpthread")
1221                         
1222                         add_definitions(-DFREE_WINDOWS64 -DMS_WIN64)
1223                         #Turn off OpenMP since it causes crashes on render for subsurfed/multiresolution meshes
1224                         set(WITH_OPENMP OFF)
1225                 endif()
1226
1227                 add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
1228
1229                 add_definitions(-DFREE_WINDOWS)
1230
1231                 set(PNG "${LIBDIR}/png")
1232                 set(PNG_INCLUDE_DIR "${PNG}/include")
1233                 set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
1234
1235                 if(WITH_MINGW64)
1236                         set(JPEG_LIBRARIES jpeg)
1237                 else()
1238                         set(JPEG_LIBRARIES libjpeg)
1239                 endif()
1240                 set(PNG_LIBRARIES png)
1241
1242                 set(ZLIB ${LIBDIR}/zlib)
1243                 set(ZLIB_INCLUDE_DIRS ${ZLIB}/include)
1244                 set(ZLIB_LIBPATH ${ZLIB}/lib)
1245                 set(ZLIB_LIBRARIES z)
1246
1247                 #comes with own pthread library
1248                 if(NOT WITH_MINGW64)
1249                         set(PTHREADS ${LIBDIR}/pthreads)
1250                         #set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include)
1251                         set(PTHREADS_LIBPATH ${PTHREADS}/lib)
1252                         set(PTHREADS_LIBRARIES pthreadGC2)
1253                 endif()
1254                 
1255                 set(FREETYPE ${LIBDIR}/freetype)
1256                 set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
1257                 set(FREETYPE_LIBPATH ${FREETYPE}/lib)
1258                 set(FREETYPE_LIBRARY freetype)
1259
1260                 if(WITH_FFTW3)
1261                         set(FFTW3 ${LIBDIR}/fftw3)
1262                         set(FFTW3_LIBRARIES fftw3)
1263                         set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
1264                         set(FFTW3_LIBPATH ${FFTW3}/lib)
1265                 endif()
1266
1267                 if(WITH_OPENCOLLADA)
1268                         set(OPENCOLLADA ${LIBDIR}/opencollada)
1269                         set(OPENCOLLADA_INCLUDE_DIRS
1270                                 ${LIBDIR}/opencollada/include/COLLADAStreamWriter/include
1271                                 ${LIBDIR}/opencollada/include/COLLADABaseUtils/include
1272                                 ${LIBDIR}/opencollada/include/COLLADAFramework/include
1273                                 ${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader/include
1274                                 ${LIBDIR}/opencollada/include/GeneratedSaxParser/include
1275                         )
1276                         set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib ${OPENCOLLADA}/lib)
1277                         if(WITH_MINGW64)
1278                                 set(OPENCOLLADA_LIBRARIES OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre buffer ftoa xml)
1279                         else()
1280                                 set(OPENCOLLADA_LIBRARIES OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa)
1281                         endif()
1282                         set(PCRE_LIBRARIES pcre)
1283                 endif()
1284
1285                 if(WITH_CODEC_FFMPEG)
1286                         set(FFMPEG ${LIBDIR}/ffmpeg)
1287                         set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
1288                         if(WITH_MINGW64)
1289                                 set(FFMPEG_LIBRARIES avcodec.dll avformat.dll avdevice.dll avutil.dll swscale.dll swresample.dll)
1290                         else()
1291                                 set(FFMPEG_LIBRARIES avcodec-53 avformat-53 avdevice-53 avutil-51 swscale-2)
1292                         endif()
1293                         set(FFMPEG_LIBPATH ${FFMPEG}/lib)
1294                 endif()
1295
1296                 if(WITH_IMAGE_OPENEXR)
1297                         set(OPENEXR ${LIBDIR}/openexr)
1298                         set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
1299                         set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
1300                         set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread Iex)
1301                         set(OPENEXR_LIBPATH ${OPENEXR}/lib)
1302                 endif()
1303
1304                 if(WITH_IMAGE_TIFF)
1305                         set(TIFF ${LIBDIR}/tiff)
1306                         set(TIFF_LIBRARY tiff)
1307                         set(TIFF_INCLUDE_DIR ${TIFF}/include)
1308                         set(TIFF_LIBPATH ${TIFF}/lib)
1309                 endif()
1310
1311                 if(WITH_JACK)
1312                         set(JACK ${LIBDIR}/jack)
1313                         set(JACK_INCLUDE_DIRS ${JACK}/include/jack ${JACK}/include)
1314                         set(JACK_LIBRARIES jack)
1315                         set(JACK_LIBPATH ${JACK}/lib)
1316
1317                         # TODO, gives linking errors, force off
1318                         set(WITH_JACK OFF)
1319                 endif()
1320
1321                 if(WITH_PYTHON)
1322                         # normally cached but not since we include them with blender
1323                         set(PYTHON_VERSION 3.3) #  CACHE STRING)
1324                         set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")  # CACHE PATH)
1325                         set(PYTHON_LIBRARY "${LIBDIR}/python/lib/python33mw.lib")  # CACHE FILEPATH)
1326
1327                         # uncached vars
1328                         set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
1329                         set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
1330                 endif()
1331
1332                 if(WITH_BOOST)
1333                         set(BOOST ${LIBDIR}/boost)
1334                         set(BOOST_INCLUDE_DIR ${BOOST}/include)
1335                         if(WITH_MINGW64)
1336                                 set(BOOST_POSTFIX "mgw47-mt-s-1_49")
1337                                 set(BOOST_DEBUG_POSTFIX "mgw47-mt-sd-1_49")
1338                         else()
1339                                 set(BOOST_POSTFIX "mgw46-mt-s-1_49")
1340                                 set(BOOST_DEBUG_POSTFIX "mgw46-mt-sd-1_49")
1341                         endif()
1342                         set(BOOST_LIBRARIES
1343                                 optimized boost_date_time-${BOOST_POSTFIX} boost_filesystem-${BOOST_POSTFIX}
1344                                 boost_regex-${BOOST_POSTFIX}
1345                                 boost_system-${BOOST_POSTFIX} boost_thread-${BOOST_POSTFIX}
1346                                 debug boost_date_time-${BOOST_DEBUG_POSTFIX} boost_filesystem-${BOOST_DEBUG_POSTFIX}
1347                                 boost_regex-${BOOST_DEBUG_POSTFIX}
1348                                 boost_system-${BOOST_DEBUG_POSTFIX} boost_thread-${BOOST_DEBUG_POSTFIX})
1349                         if(WITH_INTERNATIONAL)
1350                                 set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
1351                                         optimized boost_locale-${BOOST_POSTFIX}
1352                                         debug boost_locale-${BOOST_DEBUG_POSTFIX}) 
1353                         endif()
1354                         if(WITH_CYCLES_OSL)
1355                                 set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
1356                                         optimized boost_wave-${BOOST_POSTFIX}
1357                                         debug boost_wave-${BOOST_DEBUG_POSTFIX}) 
1358                         endif()
1359                         set(BOOST_LIBPATH ${BOOST}/lib)
1360                         set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB ")
1361                 endif()
1362                         
1363                 if(WITH_OPENIMAGEIO)
1364                         set(OPENIMAGEIO ${LIBDIR}/openimageio)
1365                         set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
1366                         set(OPENIMAGEIO_LIBRARIES OpenImageIO)
1367                         set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
1368                         set(OPENIMAGEIO_DEFINITIONS)
1369                 endif()
1370                 
1371                 if(WITH_LLVM)
1372                         set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH    "Path to the LLVM installation")
1373                         set(LLVM_LIB_DIR ${LLVM_DIRECTORY}/lib)
1374                         #Explicitly set llvm lib order.
1375                         #---- WARNING ON GCC ORDER OF LIBS IS IMPORTANT, DO NOT CHANGE! ---------
1376                         set(LLVM_LIBRARY LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMAnalysis LLVMArchive
1377                                 LLVMAsmParser LLVMAsmPrinter
1378                                 LLVMBitReader LLVMBitWriter
1379                                 LLVMDebugInfo LLVMExecutionEngine
1380                                 LLVMInstCombine LLVMInstrumentation
1381                                 LLVMInterpreter LLVMJIT
1382                                 LLVMLinker LLVMMC
1383                                 LLVMMCDisassembler LLVMMCJIT
1384                                 LLVMMCParser LLVMObject
1385                                 LLVMRuntimeDyld 
1386                                 LLVMSupport
1387                                 LLVMTableGen LLVMTarget
1388                                 LLVMTransformUtils LLVMVectorize
1389                                 LLVMX86AsmParser LLVMX86AsmPrinter
1390                                 LLVMX86CodeGen LLVMX86Desc
1391                                 LLVMX86Disassembler LLVMX86Info
1392                                 LLVMX86Utils LLVMipa
1393                                 LLVMipo LLVMCore)
1394                                 #imagehelp is needed by LLVM 3.1 on MinGW, check lib\Support\Windows\Signals.inc
1395                                 set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -limagehlp")
1396                         set(LLVM_STATIC YES)
1397                 endif()
1398                 
1399                 if(WITH_OPENCOLORIO)
1400                         set(OPENCOLORIO ${LIBDIR}/opencolorio)
1401                         set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
1402                         set(OPENCOLORIO_LIBRARIES OpenColorIO)
1403                         set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
1404                         set(OPENCOLORIO_DEFINITIONS)
1405                 endif()
1406
1407                 set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152")
1408
1409                 ## DISABLE - causes linking errors 
1410                 ## for re-distribution, so users dont need mingw installed
1411                 # set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-libgcc -static-libstdc++")
1412
1413         endif()
1414
1415 elseif(APPLE)
1416
1417         if(${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.5" OR ${CMAKE_OSX_DEPLOYMENT_TARGET} STRGREATER "10.5")
1418                 set(WITH_LIBS10.5 ON CACHE BOOL "Use 10.5 libs" FORCE) # valid also for 10.6/10.7
1419         endif()
1420
1421         if(WITH_LIBS10.5)
1422                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
1423         else()
1424                 if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
1425                         set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.x.i386)
1426                 else()
1427                         set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.0.0-powerpc)
1428                 endif()
1429         endif()
1430
1431
1432         if(WITH_OPENAL)
1433                 find_package(OpenAL)
1434                 if(OPENAL_FOUND)
1435                         set(WITH_OPENAL ON)
1436                         set(OPENAL_INCLUDE_DIR "${LIBDIR}/openal/include")
1437                 else()
1438                         set(WITH_OPENAL OFF)
1439                 endif()
1440         endif()
1441
1442         if(WITH_JACK)
1443                 find_library(JACK_FRAMEWORK
1444                         NAMES jackmp
1445                 )
1446                 set(JACK_INCLUDE_DIRS ${JACK_FRAMEWORK}/headers)
1447                 if(NOT JACK_FRAMEWORK)
1448                         set(WITH_JACK OFF)
1449                 endif()
1450         endif()
1451
1452         if(WITH_CODEC_SNDFILE)
1453                 set(SNDFILE ${LIBDIR}/sndfile)
1454                 set(SNDFILE_INCLUDE_DIRS ${SNDFILE}/include)
1455                 set(SNDFILE_LIBRARIES sndfile FLAC ogg vorbis vorbisenc)
1456                 set(SNDFILE_LIBPATH ${SNDFILE}/lib ${FFMPEG}/lib)  # TODO, deprecate
1457         endif()
1458
1459         if(WITH_PYTHON)
1460                 if(NOT WITH_PYTHON_MODULE)
1461                         # we use precompiled libraries for py 3.3 and up by default
1462
1463                         # normally cached but not since we include them with blender
1464                         set(PYTHON_VERSION 3.3)
1465                         set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
1466                         # set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet
1467                         set(PYTHON_LIBRARY python${PYTHON_VERSION}m)
1468                         set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
1469                         # set(PYTHON_LINKFLAGS "-u _PyMac_Error")  # won't  build with this enabled
1470                 else()
1471                         # module must be compiled against Python framework
1472
1473                         # normally cached but not since we include them with blender
1474                         set(PYTHON_VERSION 3.3)
1475                         set(PYTHON_INCLUDE_DIR "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/include/python${PYTHON_VERSION}m")
1476                         set(PYTHON_BINARY "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/bin/python${PYTHON_VERSION}")
1477                         #set(PYTHON_LIBRARY python${PYTHON_VERSION})
1478                         set(PYTHON_LIBPATH "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config-${PYTHON_VERSION}m")
1479                         #set(PYTHON_LINKFLAGS "-u _PyMac_Error -framework Python")  # won't  build with this enabled
1480                 endif()
1481                 
1482                 # uncached vars
1483                 set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
1484                 set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
1485         endif()
1486
1487         if(WITH_FFTW3)
1488                 set(FFTW3 ${LIBDIR}/fftw3)
1489                 set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
1490                 set(FFTW3_LIBRARIES fftw3)
1491                 set(FFTW3_LIBPATH ${FFTW3}/lib)
1492         endif()
1493
1494         set(PNG_LIBRARIES png)
1495         set(JPEG_LIBRARIES jpeg)
1496
1497         set(ZLIB /usr)
1498         set(ZLIB_INCLUDE_DIRS "${ZLIB}/include")
1499         set(ZLIB_LIBRARIES z bz2)
1500
1501         set(FREETYPE ${LIBDIR}/freetype)
1502         set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
1503         set(FREETYPE_LIBPATH ${FREETYPE}/lib)
1504         set(FREETYPE_LIBRARY freetype)
1505
1506         if(WITH_IMAGE_OPENEXR)
1507                 set(OPENEXR ${LIBDIR}/openexr)
1508                 set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
1509                 set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
1510                 set(OPENEXR_LIBRARIES Iex Half IlmImf Imath IlmThread)
1511                 set(OPENEXR_LIBPATH ${OPENEXR}/lib)
1512         endif()
1513
1514         if(WITH_CODEC_FFMPEG)
1515                 set(FFMPEG ${LIBDIR}/ffmpeg)
1516                 set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
1517                 set(FFMPEG_LIBRARIES avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg)
1518                 set(FFMPEG_LIBPATH ${FFMPEG}/lib)
1519                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
1520         endif()
1521
1522         find_library(SYSTEMSTUBS_LIBRARY
1523                 NAMES
1524                 SystemStubs
1525                 PATHS
1526         )
1527         mark_as_advanced(SYSTEMSTUBS_LIBRARY)
1528         if(SYSTEMSTUBS_LIBRARY)
1529                 set(PLATFORM_LINKLIBS stdc++ SystemStubs)
1530         else()
1531                 set(PLATFORM_LINKLIBS stdc++)
1532         endif()
1533
1534         if(WITH_COCOA)
1535                 set(PLATFORM_CFLAGS "-pipe -funsigned-char -DGHOST_COCOA")
1536                 set(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio")
1537                 if(USE_QTKIT)
1538                         set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DUSE_QTKIT")
1539                         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QTKit")
1540                         if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
1541                                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
1542                                 #libSDL still needs 32bit carbon quicktime
1543                         endif()
1544                 elseif(WITH_CODEC_QUICKTIME)
1545                         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
1546                 endif()
1547
1548                 # XXX - SOME MAC DEV PLEASE TEST WITH THE SDK INSTALLED!
1549                 # ALSO SHOULD BE MOVED INTO OWN MODULE WHEN FUNCTIONAL
1550                 if(WITH_INPUT_NDOF)
1551                         # This thread it *should* work and check the framework - campbell
1552                         # http://www.cmake.org/pipermail/cmake/2005-December/007740.html
1553                         find_library(3DCONNEXION_CLIENT_FRAMEWORK
1554                                 NAMES 3DconnexionClient
1555                         )
1556                         if(NOT 3DCONNEXION_CLIENT_FRAMEWORK)
1557                                 set(WITH_INPUT_NDOF OFF)
1558                         endif()
1559
1560                         if(WITH_INPUT_NDOF)
1561                                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -F/Library/Frameworks -weak_framework 3DconnexionClient")
1562                                 set(NDOF_INCLUDE_DIRS /Library/Frameworks/3DconnexionClient.framework/Headers )
1563                         endif()
1564                 endif()
1565
1566         if(WITH_JACK)
1567                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -weak_framework jackmp")
1568         endif()
1569
1570         else()
1571                 set(PLATFORM_CFLAGS "-pipe -funsigned-char")
1572                 set(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
1573                 set(WITH_INPUT_NDOF OFF)  # unsupported
1574         endif()
1575         
1576         if(WITH_PYTHON_MODULE)
1577                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/python")# force cmake to link right framework
1578         endif()
1579         
1580         if(WITH_OPENCOLLADA)
1581                 set(OPENCOLLADA ${LIBDIR}/opencollada)
1582
1583                 set(OPENCOLLADA_INCLUDE_DIRS
1584                         ${LIBDIR}/opencollada/include/COLLADAStreamWriter
1585                         ${LIBDIR}/opencollada/include/COLLADABaseUtils
1586                         ${LIBDIR}/opencollada/include/COLLADAFramework
1587                         ${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader
1588                         ${LIBDIR}/opencollada/include/GeneratedSaxParser
1589                 )
1590
1591                 set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
1592                 set(OPENCOLLADA_LIBRARIES "OpenCOLLADASaxFrameworkLoader -lOpenCOLLADAFramework -lOpenCOLLADABaseUtils -lOpenCOLLADAStreamWriter -lMathMLSolver -lGeneratedSaxParser -lUTF -lxml2 -lbuffer -lftoa")
1593                 #pcre is bundled with openCollada
1594                 #set(PCRE ${LIBDIR}/pcre)
1595                 #set(PCRE_LIBPATH ${PCRE}/lib)
1596                 set(PCRE_LIBRARIES pcre)
1597                 #libxml2 is used
1598                 #set(EXPAT ${LIBDIR}/expat)
1599                 #set(EXPAT_LIBPATH ${EXPAT}/lib)
1600                 set(EXPAT_LIB)
1601         endif()
1602
1603         if(WITH_SDL)
1604                 set(SDL ${LIBDIR}/sdl)
1605                 set(SDL_INCLUDE_DIR ${SDL}/include)
1606                 set(SDL_LIBRARY SDL)
1607                 set(SDL_LIBPATH ${SDL}/lib)
1608         endif()
1609
1610         set(PNG "${LIBDIR}/png")
1611         set(PNG_INCLUDE_DIR "${PNG}/include")
1612         set(PNG_LIBPATH ${PNG}/lib)
1613
1614         set(JPEG "${LIBDIR}/jpeg")
1615         set(JPEG_INCLUDE_DIR "${JPEG}/include")
1616         set(JPEG_LIBPATH ${JPEG}/lib)
1617
1618         if(WITH_IMAGE_TIFF)
1619                 set(TIFF ${LIBDIR}/tiff)
1620                 set(TIFF_INCLUDE_DIR ${TIFF}/include)
1621                 set(TIFF_LIBRARY tiff)
1622                 set(TIFF_LIBPATH ${TIFF}/lib)
1623         endif()
1624
1625         if (WITH_INPUT_NDOF)
1626                 # linker needs "-weak_framework 3DconnexionClient"
1627         endif()
1628
1629         if(WITH_BOOST)
1630                 set(BOOST ${LIBDIR}/boost)
1631                 set(BOOST_INCLUDE_DIR ${BOOST}/include)
1632                 set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt boost_wave-mt)
1633                 if (WITH_INTERNATIONAL)
1634                         list(APPEND BOOST_LIBRARIES boost_locale-mt)
1635                         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -liconv") # boost_locale needs it !
1636                 endif()
1637                 set(BOOST_LIBPATH ${BOOST}/lib)
1638                 set(BOOST_DEFINITIONS)
1639         endif()
1640
1641         if(WITH_OPENIMAGEIO)
1642                 set(OPENIMAGEIO ${LIBDIR}/openimageio)
1643                 set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
1644                 set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO}/lib/libOpenImageIO.a ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES})
1645                 set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib ${JPEG_LIBPATH} ${PNG_LIBPATH} ${TIFF_LIBPATH} ${OPENEXR_LIBPATH} ${ZLIB_LIBPATH})
1646                 set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
1647         endif()
1648
1649         if(WITH_OPENCOLORIO)
1650                 set(OPENCOLORIO ${LIBDIR}/opencolorio)
1651                 set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
1652                 set(OPENCOLORIO_LIBRARIES OpenColorIO tinyxml yaml-cpp)
1653                 set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
1654                 set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
1655         endif()
1656
1657         if(WITH_LLVM)
1658                 set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH    "Path to the LLVM installation")
1659                 set(LLVM_VERSION "3.1" CACHE STRING     "Version of LLVM to use")
1660                 set(LLVM_STATIC YES)
1661                 if(EXISTS "${LLVM_DIRECTORY}/bin/llvm-config")
1662                         set(LLVM_CONFIG "${LLVM_DIRECTORY}/bin/llvm-config")
1663                 else()
1664                         set(LLVM_CONFIG llvm-config)
1665                 endif()
1666                 execute_process(COMMAND ${LLVM_CONFIG} --version
1667                                 OUTPUT_VARIABLE LLVM_VERSION
1668                                 OUTPUT_STRIP_TRAILING_WHITESPACE)
1669                 execute_process(COMMAND ${LLVM_CONFIG} --prefix
1670                                 OUTPUT_VARIABLE LLVM_DIRECTORY
1671                                 OUTPUT_STRIP_TRAILING_WHITESPACE)
1672                 execute_process(COMMAND ${LLVM_CONFIG} --libdir
1673                                 OUTPUT_VARIABLE LLVM_LIB_DIR
1674                                 OUTPUT_STRIP_TRAILING_WHITESPACE)
1675                 find_library(LLVM_LIBRARY
1676                              NAMES LLVMAnalysis # first of a whole bunch of libs to get
1677                              PATHS ${LLVM_LIB_DIR})
1678
1679                 if(LLVM_LIBRARY AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
1680                         if(LLVM_STATIC)
1681                                 # if static LLVM libraries were requested, use llvm-config to generate
1682                                 # the list of what libraries we need, and substitute that in the right
1683                                 # way for LLVM_LIBRARY.
1684                                 execute_process(COMMAND ${LLVM_CONFIG} --libfiles
1685                                                 OUTPUT_VARIABLE LLVM_LIBRARY
1686                                                 OUTPUT_STRIP_TRAILING_WHITESPACE)
1687                                 string(REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
1688                         endif()
1689                 else()
1690                         message(FATAL_ERROR "LLVM not found.")
1691                 endif()
1692         endif()
1693
1694         if(WITH_CYCLES_OSL)
1695                 set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
1696         
1697                 find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
1698                 find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
1699                 find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
1700                 # WARNING! depends on correct order of OSL libs linking
1701                 list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -force_load ${OSL_LIB_EXEC} ${OSL_LIB_QUERY})
1702                 find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
1703                 find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
1704         
1705                 if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
1706                         set(OSL_FOUND TRUE)
1707                 else()
1708                         message(STATUS "OSL not found")
1709                 endif()
1710         endif()
1711
1712         set(EXETYPE MACOSX_BUNDLE)
1713
1714         set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
1715         set(CMAKE_CXX_FLAGS_DEBUG "-fno-strict-aliasing -g")
1716         if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "i386")
1717                 set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
1718                 set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic  -msse -msse2 -msse3 -mssse3")
1719                 if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1720                         set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ftree-vectorize  -fvariable-expansion-in-unroller")
1721                         set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-vectorize  -fvariable-expansion-in-unroller")
1722                 endif()
1723         else()
1724                 set(CMAKE_C_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
1725                 set(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
1726         endif()
1727 endif()
1728
1729 #-----------------------------------------------------------------------------
1730 # Common.
1731
1732 if(APPLE OR WIN32)
1733         if(NOT EXISTS "${LIBDIR}/")
1734                 message(FATAL_ERROR "Apple and Windows require pre-compiled libs at: '${LIBDIR}'")
1735         endif()
1736 endif()
1737
1738 if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM)
1739         message(FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON")
1740 endif()
1741
1742 if(WITH_CYCLES)
1743         if(NOT WITH_OPENIMAGEIO)
1744                 message(FATAL_ERROR "Cycles reqires WITH_OPENIMAGEIO, the library may not have been found. Configure OIIO or disable WITH_CYCLES")
1745         endif()
1746         if(NOT WITH_BOOST)
1747                 message(FATAL_ERROR "Cycles reqires WITH_BOOST, the library may not have been found. Configure BOOST or disable WITH_CYCLES")
1748         endif()
1749
1750         if(WITH_CYCLES_OSL)
1751                 if(NOT WITH_LLVM)
1752                         message(FATAL_ERROR "Cycles OSL reqires WITH_LLVM, the library may not have been found. Configure LLVM or disable WITH_CYCLES_OSL")
1753                 endif()
1754         endif()
1755 endif()
1756
1757 if(WITH_INTERNATIONAL)
1758         if(NOT WITH_BOOST)
1759                 message(FATAL_ERROR "Internationalization reqires WITH_BOOST, the library may not have been found. Configure BOOST or disable WITH_INTERNATIONAL")
1760         endif()
1761 endif()
1762
1763 # See TEST_SSE_SUPPORT() for how this is defined.
1764
1765 if(WITH_RAYOPTIMIZATION)
1766         if(SUPPORT_SSE_BUILD)
1767                 set(PLATFORM_CFLAGS " ${COMPILER_SSE_FLAG} ${PLATFORM_CFLAGS}")
1768                 add_definitions(-D__SSE__ -D__MMX__)
1769         endif()
1770         if(SUPPORT_SSE2_BUILD)
1771                 set(PLATFORM_CFLAGS " ${COMPILER_SSE2_FLAG} ${PLATFORM_CFLAGS}")
1772                 add_definitions(-D__SSE2__)
1773                 if(NOT SUPPORT_SSE_BUILD) # dont double up
1774                         add_definitions(-D__MMX__)
1775                 endif()
1776         endif()
1777 endif()
1778
1779
1780 # set the endian define
1781 if(MSVC)
1782         # for some reason this fails on msvc
1783         add_definitions(-D__LITTLE_ENDIAN__)
1784         
1785 # OSX-Note: as we do crosscompiling with specific set architecture,
1786 # endianess-detection and autosetting is counterproductive
1787 # so we just set endianess according CMAKE_OSX_ARCHITECTURES
1788
1789 elseif(CMAKE_OSX_ARCHITECTURES MATCHES i386 OR CMAKE_OSX_ARCHITECTURES MATCHES x86_64)
1790         add_definitions(-D__LITTLE_ENDIAN__)
1791 elseif(CMAKE_OSX_ARCHITECTURES MATCHES ppc OR CMAKE_OSX_ARCHITECTURES MATCHES ppc64)            
1792         add_definitions(-D__BIG_ENDIAN__)
1793         
1794 else()
1795         include(TestBigEndian)
1796         test_big_endian(_SYSTEM_BIG_ENDIAN)
1797         if(_SYSTEM_BIG_ENDIAN)
1798                 add_definitions(-D__BIG_ENDIAN__)
1799         else()
1800                 add_definitions(-D__LITTLE_ENDIAN__)
1801         endif()
1802         unset(_SYSTEM_BIG_ENDIAN)
1803 endif()
1804
1805
1806 if(WITH_IMAGE_OPENJPEG)
1807         if(WITH_SYSTEM_OPENJPEG)
1808                 # dealt with above
1809         else()
1810                 set(OPENJPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/libopenjpeg")
1811                 add_definitions(-DOPJ_STATIC)
1812         endif()
1813 endif()
1814
1815 if(WITH_IMAGE_REDCODE)
1816         set(REDCODE ${CMAKE_SOURCE_DIR}/extern)
1817         set(REDCODE_INC ${REDCODE})
1818 endif()
1819
1820 #-----------------------------------------------------------------------------
1821 # Blender WebPlugin
1822
1823 if(WITH_WEBPLUGIN)
1824         set(GECKO_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
1825         set(WEBPLUGIN_SANDBOX_MODE "apparmor" CACHE STRING "WEB Plugin sandbox mode, can be apparmor, privsep, none")
1826
1827         set(WITH_PLAYER ON)
1828 endif()
1829
1830
1831 #-----------------------------------------------------------------------------
1832 # Configure OpenGL.
1833 find_package(OpenGL)
1834 blender_include_dirs_sys("${OPENGL_INCLUDE_DIR}")
1835 # unset(OPENGL_LIBRARIES CACHE) # not compat with older cmake
1836 # unset(OPENGL_xmesa_INCLUDE_DIR CACHE) # not compat with older cmake
1837
1838 #-----------------------------------------------------------------------------
1839 # Configure OpenMP.
1840 if(WITH_OPENMP)
1841         find_package(OpenMP)
1842         if(OPENMP_FOUND)
1843                 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
1844                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
1845
1846                 if(APPLE AND ${CMAKE_GENERATOR} MATCHES "Xcode")
1847                         set(CMAKE_XCODE_ATTRIBUTE_ENABLE_OPENMP_SUPPORT "YES")
1848                 endif()
1849         else()
1850                 set(WITH_OPENMP OFF)
1851         endif()
1852
1853         mark_as_advanced(
1854                 OpenMP_C_FLAGS
1855                 OpenMP_CXX_FLAGS
1856         )
1857 endif()
1858
1859 #-----------------------------------------------------------------------------
1860 # Configure GLEW
1861
1862 if(WITH_SYSTEM_GLEW)
1863         find_package(GLEW)
1864
1865         if(NOT GLEW_FOUND)
1866                 message(FATAL_ERROR "GLEW is required to build blender, install it or disable WITH_SYSTEM_GLEW")
1867         endif()
1868
1869         mark_as_advanced(
1870                 GLEW_LIBRARY
1871                 GLEW_INCLUDE_PATH
1872         )
1873 else()
1874         # set(GLEW_LIBRARY "")  # unused
1875         set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include")
1876 endif()
1877
1878
1879 #-----------------------------------------------------------------------------
1880 # Configure Bullet
1881
1882 if(WITH_BULLET AND WITH_SYSTEM_BULLET)
1883         find_package(Bullet)
1884         if(NOT BULLET_FOUND)
1885                 set(WITH_BULLET OFF)
1886         endif()
1887 else()
1888         set(BULLET_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/bullet2/src")
1889         # set(BULLET_LIBRARIES "")
1890 endif()
1891
1892 #-----------------------------------------------------------------------------
1893 # Configure Python.
1894
1895 if(WITH_PYTHON_MODULE)
1896         add_definitions(-DPy_ENABLE_SHARED)
1897 endif()
1898
1899 #-----------------------------------------------------------------------------
1900 # Extra compile flags
1901
1902 if(CMAKE_COMPILER_IS_GNUCC)
1903
1904         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
1905         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_CAST_ALIGN -Wcast-align)
1906         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_DECLARATION_AFTER_STATEMENT -Werror=declaration-after-statement)
1907         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
1908         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_RETURN_TYPE  -Werror=return-type)
1909         # system headers sometimes do this, disable for now, was: -Werror=strict-prototypes
1910         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_STRICT_PROTOTYPES  -Wstrict-prototypes)
1911         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_PROTOTYPES -Wmissing-prototypes)
1912         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
1913         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
1914         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith)
1915         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
1916         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_WRITE_STRINGS -Wwrite-strings)
1917         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_LOGICAL_OP -Wlogical-op)
1918         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNDEF -Wundef)
1919         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_INIT_SELF -Winit-self)  # needs -Wuninitialized
1920         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_NULL -Wnonnull)  # C only
1921         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
1922         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
1923
1924         # gcc 4.2 gives annoying warnings on every file with this
1925         if (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
1926                 ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNINITIALIZED -Wuninitialized)
1927         endif()
1928
1929         # disable because it gives warnings for printf() & friends.
1930         # ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_DOUBLE_PROMOTION -Wdouble-promotion -Wno-error=double-promotion)
1931
1932         if(NOT APPLE)
1933                 ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
1934         endif()
1935
1936         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
1937         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
1938         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
1939         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_LOGICAL_OP -Wlogical-op)
1940         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_INIT_SELF -Winit-self)  # needs -Wuninitialized
1941         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
1942         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
1943
1944         # gcc 4.2 gives annoying warnings on every file with this
1945         if (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
1946                 ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized)
1947         endif()
1948
1949         # causes too many warnings
1950         if(NOT APPLE)
1951                 ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEF -Wundef)
1952                 ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_DECLARATIONS -Wmissing-declarations)
1953         endif()
1954
1955         # flags to undo strict flags
1956         ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
1957         ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER        -Wno-unused-parameter)
1958
1959         if(NOT APPLE)
1960                 ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
1961         endif()
1962
1963 elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1964
1965         # strange, clang complains these are not supported, but then yses them.
1966         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
1967         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
1968         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
1969         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
1970         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_STRICT_PROTOTYPES  -Wstrict-prototypes)
1971         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_PROTOTYPES -Wmissing-prototypes)
1972         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_MACROS      -Wunused-macros)
1973
1974         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
1975         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
1976         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS     -Wno-unknown-pragmas)
1977         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS     -Wno-char-subscripts)
1978         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_OVERLOADED_VIRTUAL  -Wno-overloaded-virtual)  # we get a lot of these, if its a problem a dev needs to look into it.
1979         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF    -Wno-invalid-offsetof)
1980         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_MACROS          -Wunused-macros)
1981
1982 elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
1983
1984         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
1985         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith)
1986         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
1987
1988         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
1989         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
1990         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
1991
1992         # disable numbered, false positives
1993         set(C_WARNINGS "${C_WARNINGS} -wd188,186,144,913,556")
1994         set(CXX_WARNINGS "${CXX_WARNINGS} -wd188,186,144,913,556")
1995
1996 endif()
1997
1998 # MSVC2010 fails to links C++ libs right
1999 if(MSVC10)
2000         if(WITH_OPENCOLLADA)
2001                 message(WARNING "MSVC 2010 does not support OpenCollada, disabling WITH_OPENCOLLADA. To enable support use Use MSVC 2008")
2002         endif()
2003 endif()
2004
2005 # ensure python header is found since detection can fail, this could happen
2006 # with _any_ library but since we used a fixed python version this tends to
2007 # be most problematic.
2008 if(WITH_PYTHON)
2009         if(NOT EXISTS "${PYTHON_INCLUDE_DIR}/Python.h")
2010                 message(FATAL_ERROR "Missing: \"${PYTHON_INCLUDE_DIR}/Python.h\",\n"
2011                                                         "Set the cache entry 'PYTHON_INCLUDE_DIR' to point "
2012                                                         "to a valid python include path. Containing "
2013                                                         "Python.h for python version \"${PYTHON_VERSION}\"")
2014         endif()
2015
2016         if(WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY)
2017                 # set but invalid
2018         # -- disabled until we make numpy bundled with blender - campbell
2019                 if((NOT ${PYTHON_NUMPY_PATH} STREQUAL "") AND (NOT ${PYTHON_NUMPY_PATH} MATCHES NOTFOUND))
2020 #                       if(NOT EXISTS "${PYTHON_NUMPY_PATH}/numpy")
2021 #                               message(WARNING "PYTHON_NUMPY_PATH is invalid, numpy not found in '${PYTHON_NUMPY_PATH}' "
2022 #                                               "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python")
2023 #                               set(WITH_PYTHON_INSTALL_NUMPY OFF)
2024 #                       endif()
2025                 # not set, so initialize
2026                 else()
2027                         string(REPLACE "." ";" _PY_VER_SPLIT "${PYTHON_VERSION}")
2028                         list(GET _PY_VER_SPLIT 0 _PY_VER_MAJOR)
2029
2030                         # re-cache
2031                         unset(PYTHON_NUMPY_PATH CACHE)
2032                         find_path(PYTHON_NUMPY_PATH
2033                           NAMES
2034                             numpy
2035                           HINTS
2036                             "${PYTHON_LIBPATH}/python${PYTHON_VERSION}/"
2037                             "${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/"
2038                           PATH_SUFFIXES
2039                             site-packages
2040                             dist-packages
2041                            NO_DEFAULT_PATH
2042                         )
2043
2044                         if(NOT EXISTS "${PYTHON_NUMPY_PATH}")
2045                                 message(WARNING "'numpy' path could not be found in:\n"
2046                                                 "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/numpy', "
2047                                                 "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/site-packages/numpy', "
2048                                                 "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/dist-packages/numpy', "
2049                                                 "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/dist-packages/numpy', "
2050                                                 "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python")
2051                                 set(WITH_PYTHON_INSTALL_NUMPY OFF)
2052                         else()
2053                                 message(STATUS "numpy found at '${PYTHON_NUMPY_PATH}'")
2054                         endif()
2055
2056                         unset(_PY_VER_SPLIT)
2057                         unset(_PY_VER_MAJOR)
2058                 endif()
2059         endif()
2060 endif()
2061
2062 # Include warnings first, so its possible to disable them with user defined flags
2063 # eg: -Wno-uninitialized
2064 set(CMAKE_C_FLAGS "${C_WARNINGS} ${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS}")
2065 set(CMAKE_CXX_FLAGS "${CXX_WARNINGS} ${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS}")
2066
2067 #-------------------------------------------------------------------------------
2068 # Global Defines
2069
2070 # better not set includes here but this debugging option is off by default.
2071 if(WITH_CXX_GUARDEDALLOC)
2072         include_directories(${CMAKE_SOURCE_DIR}/intern/guardedalloc)
2073         add_definitions(-DWITH_CXX_GUARDEDALLOC)
2074 endif()
2075
2076 if(WITH_ASSERT_ABORT)
2077         add_definitions(-DWITH_ASSERT_ABORT)
2078 endif()
2079
2080 # message(STATUS "Using CFLAGS: ${CMAKE_C_FLAGS}")
2081 # message(STATUS "Using CXXFLAGS: ${CMAKE_CXX_FLAGS}")
2082
2083 #-----------------------------------------------------------------------------
2084 # Libraries
2085
2086 add_subdirectory(source)
2087 add_subdirectory(intern)
2088 add_subdirectory(extern)
2089
2090
2091 #-----------------------------------------------------------------------------
2092 # Blender Application
2093 if(WITH_BLENDER)
2094         add_subdirectory(source/creator)
2095 endif()
2096
2097
2098 #-----------------------------------------------------------------------------
2099 # Blender Player
2100 if(WITH_PLAYER)
2101         add_subdirectory(source/blenderplayer)
2102 endif()
2103
2104 #-----------------------------------------------------------------------------
2105 # CPack for generating packages
2106 include(build_files/cmake/packaging.cmake)
2107
2108
2109 #-----------------------------------------------------------------------------
2110 # Print Final Configuration
2111
2112 if(FIRST_RUN)
2113         set(_config_msg "\n* Blender Configuration *")
2114         macro(info_cfg_option
2115                 _setting)
2116                 set(_msg "   * ${_setting}")
2117                 string(LENGTH "${_msg}" _len)
2118                 while("32" GREATER "${_len}")
2119                         set(_msg "${_msg} ")
2120                          math(EXPR _len "${_len} + 1")
2121                 endwhile()
2122
2123                 set(_config_msg "${_config_msg}\n${_msg}${${_setting}}")
2124         endmacro()
2125
2126         macro(info_cfg_text
2127                 _text)
2128                 set(_config_msg "${_config_msg}\n\n  ${_text}")
2129
2130
2131         endmacro()
2132
2133         info_cfg_text("Build Options:")
2134         info_cfg_option(WITH_GAMEENGINE)
2135         info_cfg_option(WITH_PLAYER)
2136         info_cfg_option(WITH_BULLET)
2137         info_cfg_option(WITH_IK_SOLVER)
2138         info_cfg_option(WITH_IK_ITASC)
2139         info_cfg_option(WITH_OPENCOLLADA)
2140         info_cfg_option(WITH_FFTW3)
2141         info_cfg_option(WITH_INTERNATIONAL)
2142         info_cfg_option(WITH_INPUT_NDOF)
2143         info_cfg_option(WITH_CYCLES)
2144         info_cfg_option(WITH_OPENCOLORIO)
2145
2146         info_cfg_text("Compiler Options:")
2147         info_cfg_option(WITH_BUILDINFO)
2148         info_cfg_option(WITH_OPENMP)
2149         info_cfg_option(WITH_RAYOPTIMIZATION)
2150
2151         info_cfg_text("System Options:")
2152         info_cfg_option(WITH_INSTALL_PORTABLE)
2153         info_cfg_option(WITH_X11_XF86VMODE)
2154         info_cfg_option(WITH_X11_XINPUT)
2155         info_cfg_option(WITH_MEM_JEMALLOC)
2156         info_cfg_option(WITH_SYSTEM_GLEW)
2157         info_cfg_option(WITH_SYSTEM_OPENJPEG)
2158
2159         info_cfg_text("Image Formats:")
2160         info_cfg_option(WITH_IMAGE_CINEON)
2161         info_cfg_option(WITH_IMAGE_DDS)
2162         info_cfg_option(WITH_IMAGE_HDR)
2163         info_cfg_option(WITH_IMAGE_OPENEXR)
2164         info_cfg_option(WITH_IMAGE_OPENJPEG)
2165         info_cfg_option(WITH_IMAGE_REDCODE)
2166         info_cfg_option(WITH_IMAGE_TIFF)
2167
2168         info_cfg_text("Audio:")
2169         info_cfg_option(WITH_OPENAL)
2170         info_cfg_option(WITH_SDL)
2171         info_cfg_option(WITH_JACK)
2172         info_cfg_option(WITH_CODEC_AVI)
2173         info_cfg_option(WITH_CODEC_FFMPEG)
2174         info_cfg_option(WITH_CODEC_SNDFILE)
2175
2176         info_cfg_text("Compression:")
2177         info_cfg_option(WITH_LZMA)
2178         info_cfg_option(WITH_LZO)
2179
2180         info_cfg_text("Python:")
2181         info_cfg_option(WITH_PYTHON_INSTALL)
2182         info_cfg_option(WITH_PYTHON_INSTALL_NUMPY)
2183         info_cfg_option(WITH_PYTHON_MODULE)
2184         info_cfg_option(WITH_PYTHON_SAFETY)
2185
2186         info_cfg_text("Modifiers:")
2187         info_cfg_option(WITH_MOD_BOOLEAN)
2188         info_cfg_option(WITH_MOD_REMESH)
2189         info_cfg_option(WITH_MOD_FLUID)
2190         info_cfg_option(WITH_MOD_OCEANSIM)
2191
2192         # debug
2193         message(STATUS "HAVE_STDBOOL_H = ${HAVE_STDBOOL_H}")
2194
2195         info_cfg_text("")
2196
2197         message("${_config_msg}")
2198 endif()