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