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