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