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