Further tweaks to support libav from wheezy
[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                         if(WITH_CYCLES_OSL)
1331                                 set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
1332                                         optimized boost_wave-${BOOST_POSTFIX}
1333                                         debug boost_wave-${BOOST_DEBUG_POSTFIX}) 
1334                         endif()
1335                         set(BOOST_LIBPATH ${BOOST}/lib)
1336                         set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB ")
1337                 endif()
1338                         
1339                 if(WITH_OPENIMAGEIO)
1340                         set(OPENIMAGEIO ${LIBDIR}/openimageio)
1341                         set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
1342                         set(OPENIMAGEIO_LIBRARIES OpenImageIO)
1343                         set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
1344                         set(OPENIMAGEIO_DEFINITIONS)
1345                 endif()
1346                 
1347                 if(WITH_LLVM)
1348                         set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH    "Path to the LLVM installation")
1349                         set(LLVM_LIB_DIR ${LLVM_DIRECTORY}/lib)
1350                         #Explicitly set llvm lib order.
1351                         #---- WARNING ON GCC ORDER OF LIBS IS IMPORTANT, DO NOT CHANGE! ---------
1352                         set(LLVM_LIBRARY LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMAnalysis LLVMArchive
1353                                 LLVMAsmParser LLVMAsmPrinter
1354                                 LLVMBitReader LLVMBitWriter
1355                                 LLVMDebugInfo LLVMExecutionEngine
1356                                 LLVMInstCombine LLVMInstrumentation
1357                                 LLVMInterpreter LLVMJIT
1358                                 LLVMLinker LLVMMC
1359                                 LLVMMCDisassembler LLVMMCJIT
1360                                 LLVMMCParser LLVMObject
1361                                 LLVMRuntimeDyld 
1362                                 LLVMSupport
1363                                 LLVMTableGen LLVMTarget
1364                                 LLVMTransformUtils LLVMVectorize
1365                                 LLVMX86AsmParser LLVMX86AsmPrinter
1366                                 LLVMX86CodeGen LLVMX86Desc
1367                                 LLVMX86Disassembler LLVMX86Info
1368                                 LLVMX86Utils LLVMipa
1369                                 LLVMipo LLVMCore)
1370                                 #imagehelp is needed by LLVM 3.1 on MinGW, check lib\Support\Windows\Signals.inc
1371                                 set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -limagehlp")
1372                         set(LLVM_STATIC YES)
1373                 endif()
1374                 
1375                 if(WITH_OPENCOLORIO)
1376                         set(OPENCOLORIO ${LIBDIR}/opencolorio)
1377                         set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
1378                         set(OPENCOLORIO_LIBRARIES OpenColorIO)
1379                         set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
1380                         set(OPENCOLORIO_DEFINITIONS)
1381                 endif()
1382
1383                 set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152")
1384
1385                 ## DISABLE - causes linking errors 
1386                 ## for re-distribution, so users dont need mingw installed
1387                 # set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-libgcc -static-libstdc++")
1388
1389         endif()
1390
1391 elseif(APPLE)
1392
1393         if(${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.5" OR ${CMAKE_OSX_DEPLOYMENT_TARGET} STRGREATER "10.5")
1394                 set(WITH_LIBS10.5 ON CACHE BOOL "Use 10.5 libs" FORCE) # valid also for 10.6/10.7
1395         endif()
1396
1397         if(WITH_LIBS10.5)
1398                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
1399         else()
1400                 if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
1401                         set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.x.i386)
1402                 else()
1403                         set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.0.0-powerpc)
1404                 endif()
1405         endif()
1406
1407
1408         if(WITH_OPENAL)
1409                 find_package(OpenAL)
1410                 if(OPENAL_FOUND)
1411                         set(WITH_OPENAL ON)
1412                         set(OPENAL_INCLUDE_DIR "${LIBDIR}/openal/include")
1413                 else()
1414                         set(WITH_OPENAL OFF)
1415                 endif()
1416         endif()
1417
1418         if(WITH_JACK)
1419                 find_library(JACK_FRAMEWORK
1420                         NAMES jackmp
1421                 )
1422                 set(JACK_INCLUDE_DIRS ${JACK_FRAMEWORK}/headers)
1423                 if(NOT JACK_FRAMEWORK)
1424                         set(WITH_JACK OFF)
1425                 endif()
1426         endif()
1427
1428         if(WITH_CODEC_SNDFILE)
1429                 set(SNDFILE ${LIBDIR}/sndfile)
1430                 set(SNDFILE_INCLUDE_DIRS ${SNDFILE}/include)
1431                 set(SNDFILE_LIBRARIES sndfile FLAC ogg vorbis vorbisenc)
1432                 set(SNDFILE_LIBPATH ${SNDFILE}/lib ${FFMPEG}/lib)  # TODO, deprecate
1433         endif()
1434
1435         if(WITH_PYTHON)
1436                 if(NOT WITH_PYTHON_MODULE)
1437                         # we use precompiled libraries for py 3.3 and up by default
1438
1439                         # normally cached but not since we include them with blender
1440                         set(PYTHON_VERSION 3.3)
1441                         set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
1442                         # set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet
1443                         set(PYTHON_LIBRARY python${PYTHON_VERSION}m)
1444                         set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
1445                         # set(PYTHON_LINKFLAGS "-u _PyMac_Error")  # won't  build with this enabled
1446                 else()
1447                         # module must be compiled against Python framework
1448
1449                         # normally cached but not since we include them with blender
1450                         set(PYTHON_VERSION 3.2)
1451                         set(PYTHON_INCLUDE_DIR "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/include/python${PYTHON_VERSION}m")
1452                         set(PYTHON_BINARY "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/bin/python${PYTHON_VERSION}")
1453                         #set(PYTHON_LIBRARY python${PYTHON_VERSION})
1454                         set(PYTHON_LIBPATH "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config-3.2m")
1455                         #set(PYTHON_LINKFLAGS "-u _PyMac_Error -framework Python")  # won't  build with this enabled
1456                 endif()
1457                 
1458                 # uncached vars
1459                 set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
1460                 set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
1461         endif()
1462
1463         if(WITH_FFTW3)
1464                 set(FFTW3 ${LIBDIR}/fftw3)
1465                 set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
1466                 set(FFTW3_LIBRARIES fftw3)
1467                 set(FFTW3_LIBPATH ${FFTW3}/lib)
1468         endif()
1469
1470         set(PNG_LIBRARIES png)
1471         set(JPEG_LIBRARIES jpeg)
1472
1473         set(ZLIB /usr)
1474         set(ZLIB_INCLUDE_DIRS "${ZLIB}/include")
1475         set(ZLIB_LIBRARIES z bz2)
1476
1477         set(FREETYPE ${LIBDIR}/freetype)
1478         set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
1479         set(FREETYPE_LIBPATH ${FREETYPE}/lib)
1480         set(FREETYPE_LIBRARY freetype)
1481
1482         if(WITH_IMAGE_OPENEXR)
1483                 set(OPENEXR ${LIBDIR}/openexr)
1484                 set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
1485                 set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
1486                 set(OPENEXR_LIBRARIES Iex Half IlmImf Imath IlmThread)
1487                 set(OPENEXR_LIBPATH ${OPENEXR}/lib)
1488         endif()
1489
1490         if(WITH_CODEC_FFMPEG)
1491                 set(FFMPEG ${LIBDIR}/ffmpeg)
1492                 set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
1493                 set(FFMPEG_LIBRARIES avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg)
1494                 set(FFMPEG_LIBPATH ${FFMPEG}/lib)
1495                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
1496         endif()
1497
1498         find_library(SYSTEMSTUBS_LIBRARY
1499                 NAMES
1500                 SystemStubs
1501                 PATHS
1502         )
1503         mark_as_advanced(SYSTEMSTUBS_LIBRARY)
1504         if(SYSTEMSTUBS_LIBRARY)
1505                 set(PLATFORM_LINKLIBS stdc++ SystemStubs)
1506         else()
1507                 set(PLATFORM_LINKLIBS stdc++)
1508         endif()
1509
1510         if(WITH_COCOA)
1511                 set(PLATFORM_CFLAGS "-pipe -funsigned-char -DGHOST_COCOA")
1512                 set(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio")
1513                 if(USE_QTKIT)
1514                         set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DUSE_QTKIT")
1515                         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QTKit")
1516                         if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
1517                                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
1518                                 #libSDL still needs 32bit carbon quicktime
1519                         endif()
1520                 elseif(WITH_CODEC_QUICKTIME)
1521                         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
1522                 endif()
1523
1524                 # XXX - SOME MAC DEV PLEASE TEST WITH THE SDK INSTALLED!
1525                 # ALSO SHOULD BE MOVED INTO OWN MODULE WHEN FUNCTIONAL
1526                 if(WITH_INPUT_NDOF)
1527                         # This thread it *should* work and check the framework - campbell
1528                         # http://www.cmake.org/pipermail/cmake/2005-December/007740.html
1529                         find_library(3DCONNEXION_CLIENT_FRAMEWORK
1530                                 NAMES 3DconnexionClient
1531                         )
1532                         if(NOT 3DCONNEXION_CLIENT_FRAMEWORK)
1533                                 set(WITH_INPUT_NDOF OFF)
1534                         endif()
1535
1536                         if(WITH_INPUT_NDOF)
1537                                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -F/Library/Frameworks -weak_framework 3DconnexionClient")
1538                                 set(NDOF_INCLUDE_DIRS /Library/Frameworks/3DconnexionClient.framework/Headers )
1539                         endif()
1540                 endif()
1541
1542         if(WITH_JACK)
1543                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -weak_framework jackmp")
1544         endif()
1545
1546         else()
1547                 set(PLATFORM_CFLAGS "-pipe -funsigned-char")
1548                 set(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
1549                 set(WITH_INPUT_NDOF OFF)  # unsupported
1550         endif()
1551         
1552         if(WITH_PYTHON_MODULE)
1553                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/python")# force cmake to link right framework
1554         endif()
1555         
1556         if(WITH_OPENCOLLADA)
1557                 set(OPENCOLLADA ${LIBDIR}/opencollada)
1558
1559                 set(OPENCOLLADA_INCLUDE_DIRS
1560                         ${LIBDIR}/opencollada/include/COLLADAStreamWriter
1561                         ${LIBDIR}/opencollada/include/COLLADABaseUtils
1562                         ${LIBDIR}/opencollada/include/COLLADAFramework
1563                         ${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader
1564                         ${LIBDIR}/opencollada/include/GeneratedSaxParser
1565                 )
1566
1567                 set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
1568                 set(OPENCOLLADA_LIBRARIES "OpenCOLLADASaxFrameworkLoader -lOpenCOLLADAFramework -lOpenCOLLADABaseUtils -lOpenCOLLADAStreamWriter -lMathMLSolver -lGeneratedSaxParser -lUTF -lxml2 -lbuffer -lftoa")
1569                 #pcre is bundled with openCollada
1570                 #set(PCRE ${LIBDIR}/pcre)
1571                 #set(PCRE_LIBPATH ${PCRE}/lib)
1572                 set(PCRE_LIBRARIES pcre)
1573                 #libxml2 is used
1574                 #set(EXPAT ${LIBDIR}/expat)
1575                 #set(EXPAT_LIBPATH ${EXPAT}/lib)
1576                 set(EXPAT_LIB)
1577         endif()
1578
1579         if(WITH_SDL)
1580                 set(SDL ${LIBDIR}/sdl)
1581                 set(SDL_INCLUDE_DIR ${SDL}/include)
1582                 set(SDL_LIBRARY SDL)
1583                 set(SDL_LIBPATH ${SDL}/lib)
1584         endif()
1585
1586         set(PNG "${LIBDIR}/png")
1587         set(PNG_INCLUDE_DIR "${PNG}/include")
1588         set(PNG_LIBPATH ${PNG}/lib)
1589
1590         set(JPEG "${LIBDIR}/jpeg")
1591         set(JPEG_INCLUDE_DIR "${JPEG}/include")
1592         set(JPEG_LIBPATH ${JPEG}/lib)
1593
1594         if(WITH_IMAGE_TIFF)
1595                 set(TIFF ${LIBDIR}/tiff)
1596                 set(TIFF_INCLUDE_DIR ${TIFF}/include)
1597                 set(TIFF_LIBRARY tiff)
1598                 set(TIFF_LIBPATH ${TIFF}/lib)
1599         endif()
1600
1601         if (WITH_INPUT_NDOF)
1602                 # linker needs "-weak_framework 3DconnexionClient"
1603         endif()
1604
1605         if(WITH_BOOST)
1606                 set(BOOST ${LIBDIR}/boost)
1607                 set(BOOST_INCLUDE_DIR ${BOOST}/include)
1608                 set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt boost_wave-mt)
1609                 if (WITH_INTERNATIONAL)
1610                         list(APPEND BOOST_LIBRARIES boost_locale-mt)
1611                         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -liconv") # boost_locale needs it !
1612                 endif()
1613                 set(BOOST_LIBPATH ${BOOST}/lib)
1614                 set(BOOST_DEFINITIONS)
1615         endif()
1616
1617         if(WITH_OPENIMAGEIO)
1618                 set(OPENIMAGEIO ${LIBDIR}/openimageio)
1619                 set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
1620                 set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO}/lib/libOpenImageIO.a ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES})
1621                 set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib ${JPEG_LIBPATH} ${PNG_LIBPATH} ${TIFF_LIBPATH} ${OPENEXR_LIBPATH} ${ZLIB_LIBPATH})
1622                 set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
1623         endif()
1624
1625         if(WITH_OPENCOLORIO)
1626                 set(OPENCOLORIO ${LIBDIR}/opencolorio)
1627                 set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
1628                 set(OPENCOLORIO_LIBRARIES OpenColorIO tinyxml yaml-cpp)
1629                 set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
1630                 set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
1631         endif()
1632
1633         if(WITH_LLVM)
1634                 set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH    "Path to the LLVM installation")
1635                 set(LLVM_VERSION "3.1" CACHE STRING     "Version of LLVM to use")
1636                 set(LLVM_STATIC YES)
1637                 if(EXISTS "${LLVM_DIRECTORY}/bin/llvm-config")
1638                         set(LLVM_CONFIG "${LLVM_DIRECTORY}/bin/llvm-config")
1639                 else()
1640                         set(LLVM_CONFIG llvm-config)
1641                 endif()
1642                 execute_process(COMMAND ${LLVM_CONFIG} --version
1643                                 OUTPUT_VARIABLE LLVM_VERSION
1644                                 OUTPUT_STRIP_TRAILING_WHITESPACE)
1645                 execute_process(COMMAND ${LLVM_CONFIG} --prefix
1646                                 OUTPUT_VARIABLE LLVM_DIRECTORY
1647                                 OUTPUT_STRIP_TRAILING_WHITESPACE)
1648                 execute_process(COMMAND ${LLVM_CONFIG} --libdir
1649                                 OUTPUT_VARIABLE LLVM_LIB_DIR
1650                                 OUTPUT_STRIP_TRAILING_WHITESPACE)
1651                 find_library(LLVM_LIBRARY
1652                              NAMES LLVMAnalysis # first of a whole bunch of libs to get
1653                              PATHS ${LLVM_LIB_DIR})
1654
1655                 if(LLVM_LIBRARY AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
1656                         if(LLVM_STATIC)
1657                                 # if static LLVM libraries were requested, use llvm-config to generate
1658                                 # the list of what libraries we need, and substitute that in the right
1659                                 # way for LLVM_LIBRARY.
1660                                 execute_process(COMMAND ${LLVM_CONFIG} --libfiles
1661                                                 OUTPUT_VARIABLE LLVM_LIBRARY
1662                                                 OUTPUT_STRIP_TRAILING_WHITESPACE)
1663                                 string(REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
1664                         endif()
1665                 else()
1666                         message(FATAL_ERROR "LLVM not found.")
1667                 endif()
1668         endif()
1669
1670         if(WITH_CYCLES_OSL)
1671                 set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
1672         
1673                 find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
1674                 find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
1675                 find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
1676                 # WARNING! depends on correct order of OSL libs linking
1677                 list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -force_load ${OSL_LIB_EXEC} ${OSL_LIB_QUERY})
1678                 find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
1679                 find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
1680         
1681                 if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
1682                         set(OSL_FOUND TRUE)
1683                 else()
1684                         message(STATUS "OSL not found")
1685                 endif()
1686         endif()
1687
1688         set(EXETYPE MACOSX_BUNDLE)
1689
1690         set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
1691         set(CMAKE_CXX_FLAGS_DEBUG "-fno-strict-aliasing -g")
1692         if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "i386")
1693                 set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
1694                 set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic  -msse -msse2 -msse3 -mssse3")
1695                 if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1696                         set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ftree-vectorize  -fvariable-expansion-in-unroller")
1697                         set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-vectorize  -fvariable-expansion-in-unroller")
1698                 endif()
1699         else()
1700                 set(CMAKE_C_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
1701                 set(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
1702         endif()
1703 endif()
1704
1705 #-----------------------------------------------------------------------------
1706 # Common.
1707
1708 if(APPLE OR WIN32)
1709         if(NOT EXISTS "${LIBDIR}/")
1710                 message(FATAL_ERROR "Apple and Windows require pre-compiled libs at: '${LIBDIR}'")
1711         endif()
1712 endif()
1713
1714 if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM)
1715         message(FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON")
1716 endif()
1717
1718 if(WITH_CYCLES)
1719         if(NOT WITH_OPENIMAGEIO)
1720                 message(FATAL_ERROR "Cycles reqires WITH_OPENIMAGEIO, the library may not have been found. Configure OIIO or disable WITH_CYCLES")
1721         endif()
1722         if(NOT WITH_BOOST)
1723                 message(FATAL_ERROR "Cycles reqires WITH_BOOST, the library may not have been found. Configure BOOST or disable WITH_CYCLES")
1724         endif()
1725
1726         if(WITH_CYCLES_OSL)
1727                 if(NOT WITH_LLVM)
1728                         message(FATAL_ERROR "Cycles OSL reqires WITH_LLVM, the library may not have been found. Configure LLVM or disable WITH_CYCLES_OSL")
1729                 endif()
1730         endif()
1731 endif()
1732
1733 if(WITH_INTERNATIONAL)
1734         if(NOT WITH_BOOST)
1735                 message(FATAL_ERROR "Internationalization reqires WITH_BOOST, the library may not have been found. Configure BOOST or disable WITH_INTERNATIONAL")
1736         endif()
1737 endif()
1738
1739 # See TEST_SSE_SUPPORT() for how this is defined.
1740
1741 if(WITH_RAYOPTIMIZATION)
1742         if(SUPPORT_SSE_BUILD)
1743                 set(PLATFORM_CFLAGS " ${COMPILER_SSE_FLAG} ${PLATFORM_CFLAGS}")
1744                 add_definitions(-D__SSE__ -D__MMX__)
1745         endif()
1746         if(SUPPORT_SSE2_BUILD)
1747                 set(PLATFORM_CFLAGS " ${COMPILER_SSE2_FLAG} ${PLATFORM_CFLAGS}")
1748                 add_definitions(-D__SSE2__)
1749                 if(NOT SUPPORT_SSE_BUILD) # dont double up
1750                         add_definitions(-D__MMX__)
1751                 endif()
1752         endif()
1753 endif()
1754
1755
1756 # set the endian define
1757 if(MSVC)
1758         # for some reason this fails on msvc
1759         add_definitions(-D__LITTLE_ENDIAN__)
1760         
1761 # OSX-Note: as we do crosscompiling with specific set architecture,
1762 # endianess-detection and autosetting is counterproductive
1763 # so we just set endianess according CMAKE_OSX_ARCHITECTURES
1764
1765 elseif(CMAKE_OSX_ARCHITECTURES MATCHES i386 OR CMAKE_OSX_ARCHITECTURES MATCHES x86_64)
1766         add_definitions(-D__LITTLE_ENDIAN__)
1767 elseif(CMAKE_OSX_ARCHITECTURES MATCHES ppc OR CMAKE_OSX_ARCHITECTURES MATCHES ppc64)            
1768         add_definitions(-D__BIG_ENDIAN__)
1769         
1770 else()
1771         include(TestBigEndian)
1772         test_big_endian(_SYSTEM_BIG_ENDIAN)
1773         if(_SYSTEM_BIG_ENDIAN)
1774                 add_definitions(-D__BIG_ENDIAN__)
1775         else()
1776                 add_definitions(-D__LITTLE_ENDIAN__)
1777         endif()
1778         unset(_SYSTEM_BIG_ENDIAN)
1779 endif()
1780
1781
1782 if(WITH_IMAGE_OPENJPEG)
1783         if(WITH_SYSTEM_OPENJPEG)
1784                 # dealt with above
1785         else()
1786                 set(OPENJPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/libopenjpeg")
1787                 add_definitions(-DOPJ_STATIC)
1788         endif()
1789 endif()
1790
1791 if(WITH_IMAGE_REDCODE)
1792         set(REDCODE ${CMAKE_SOURCE_DIR}/extern)
1793         set(REDCODE_INC ${REDCODE})
1794 endif()
1795
1796 #-----------------------------------------------------------------------------
1797 # Blender WebPlugin
1798
1799 if(WITH_WEBPLUGIN)
1800         set(GECKO_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
1801         set(WEBPLUGIN_SANDBOX_MODE "apparmor" CACHE STRING "WEB Plugin sandbox mode, can be apparmor, privsep, none")
1802
1803         set(WITH_PLAYER ON)
1804 endif()
1805
1806
1807 #-----------------------------------------------------------------------------
1808 # Configure OpenGL.
1809 find_package(OpenGL)
1810 blender_include_dirs_sys("${OPENGL_INCLUDE_DIR}")
1811 # unset(OPENGL_LIBRARIES CACHE) # not compat with older cmake
1812 # unset(OPENGL_xmesa_INCLUDE_DIR CACHE) # not compat with older cmake
1813
1814 #-----------------------------------------------------------------------------
1815 # Configure OpenMP.
1816 if(WITH_OPENMP)
1817         find_package(OpenMP)
1818         if(OPENMP_FOUND)
1819                 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
1820                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
1821
1822                 if(APPLE AND ${CMAKE_GENERATOR} MATCHES "Xcode")
1823                         set(CMAKE_XCODE_ATTRIBUTE_ENABLE_OPENMP_SUPPORT "YES")
1824                 endif()
1825         else()
1826                 set(WITH_OPENMP OFF)
1827         endif()
1828
1829         mark_as_advanced(
1830                 OpenMP_C_FLAGS
1831                 OpenMP_CXX_FLAGS
1832         )
1833 endif()
1834
1835 #-----------------------------------------------------------------------------
1836 # Configure GLEW
1837
1838 if(WITH_SYSTEM_GLEW)
1839         find_package(GLEW)
1840
1841         if(NOT GLEW_FOUND)
1842                 message(FATAL_ERROR "GLEW is required to build blender, install it or disable WITH_SYSTEM_GLEW")
1843         endif()
1844
1845         mark_as_advanced(
1846                 GLEW_LIBRARY
1847                 GLEW_INCLUDE_PATH
1848         )
1849 else()
1850         # set(GLEW_LIBRARY "")  # unused
1851         set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include")
1852 endif()
1853
1854
1855 #-----------------------------------------------------------------------------
1856 # Configure Bullet
1857
1858 if(WITH_BULLET AND WITH_SYSTEM_BULLET)
1859         find_package(Bullet)
1860         if(NOT BULLET_FOUND)
1861                 set(WITH_BULLET OFF)
1862         endif()
1863 else()
1864         set(BULLET_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/bullet2/src")
1865         # set(BULLET_LIBRARIES "")
1866 endif()
1867
1868 #-----------------------------------------------------------------------------
1869 # Configure Python.
1870
1871 if(WITH_PYTHON_MODULE)
1872         add_definitions(-DPy_ENABLE_SHARED)
1873 endif()
1874
1875 #-----------------------------------------------------------------------------
1876 # Extra compile flags
1877
1878 if(CMAKE_COMPILER_IS_GNUCC)
1879
1880         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
1881         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_CAST_ALIGN -Wcast-align)
1882         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_DECLARATION_AFTER_STATEMENT -Werror=declaration-after-statement)
1883         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
1884         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_RETURN_TYPE  -Werror=return-type)
1885         # system headers sometimes do this, disable for now, was: -Werror=strict-prototypes
1886         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_STRICT_PROTOTYPES  -Wstrict-prototypes)
1887         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_PROTOTYPES -Wmissing-prototypes)
1888         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
1889         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
1890         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith)
1891         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
1892         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_WRITE_STRINGS -Wwrite-strings)
1893         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_LOGICAL_OP -Wlogical-op)
1894         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNDEF -Wundef)
1895         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_INIT_SELF -Winit-self)  # needs -Wuninitialized
1896         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_NULL -Wnonnull)  # C only
1897         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
1898         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
1899
1900         # gcc 4.2 gives annoying warnings on every file with this
1901         if (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
1902                 ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNINITIALIZED -Wuninitialized)
1903         endif()
1904
1905         # disable because it gives warnings for printf() & friends.
1906         # ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_DOUBLE_PROMOTION -Wdouble-promotion -Wno-error=double-promotion)
1907
1908         if(NOT APPLE)
1909                 ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
1910         endif()
1911
1912         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
1913         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
1914         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
1915         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_LOGICAL_OP -Wlogical-op)
1916         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_INIT_SELF -Winit-self)  # needs -Wuninitialized
1917         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
1918         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
1919
1920         # gcc 4.2 gives annoying warnings on every file with this
1921         if (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
1922                 ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized)
1923         endif()
1924
1925         # causes too many warnings
1926         if(NOT APPLE)
1927                 ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEF -Wundef)
1928                 ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_DECLARATIONS -Wmissing-declarations)
1929         endif()
1930
1931         # flags to undo strict flags
1932         ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
1933         ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER        -Wno-unused-parameter)
1934
1935         if(NOT APPLE)
1936                 ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
1937         endif()
1938
1939 elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1940
1941         # strange, clang complains these are not supported, but then yses them.
1942         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
1943         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
1944         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
1945         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
1946         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_STRICT_PROTOTYPES  -Wstrict-prototypes)
1947         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_PROTOTYPES -Wmissing-prototypes)
1948         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_MACROS      -Wunused-macros)
1949
1950         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
1951         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
1952         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS     -Wno-unknown-pragmas)
1953         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS     -Wno-char-subscripts)
1954         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.
1955         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF    -Wno-invalid-offsetof)
1956         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_MACROS          -Wunused-macros)
1957
1958 elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
1959
1960         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
1961         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith)
1962         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
1963
1964         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
1965         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
1966         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
1967
1968         # disable numbered, false positives
1969         set(C_WARNINGS "${C_WARNINGS} -wd188,186,144,913,556")
1970         set(CXX_WARNINGS "${CXX_WARNINGS} -wd188,186,144,913,556")
1971
1972 endif()
1973
1974 # MSVC2010 fails to links C++ libs right
1975 if(MSVC10)
1976         if(WITH_OPENCOLLADA)
1977                 message(WARNING "MSVC 2010 does not support OpenCollada, disabling WITH_OPENCOLLADA. To enable support use Use MSVC 2008")
1978         endif()
1979 endif()
1980
1981 # ensure python header is found since detection can fail, this could happen
1982 # with _any_ library but since we used a fixed python version this tends to
1983 # be most problematic.
1984 if(WITH_PYTHON)
1985         if(NOT EXISTS "${PYTHON_INCLUDE_DIR}/Python.h")
1986                 message(FATAL_ERROR "Missing: \"${PYTHON_INCLUDE_DIR}/Python.h\",\n"
1987                                                         "Set the cache entry 'PYTHON_INCLUDE_DIR' to point "
1988                                                         "to a valid python include path. Containing "
1989                                                         "Python.h for python version \"${PYTHON_VERSION}\"")
1990         endif()
1991
1992         if(WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY)
1993                 # set but invalid
1994         # -- disabled until we make numpy bundled with blender - campbell
1995                 if((NOT ${PYTHON_NUMPY_PATH} STREQUAL "") AND (NOT ${PYTHON_NUMPY_PATH} MATCHES NOTFOUND))
1996 #                       if(NOT EXISTS "${PYTHON_NUMPY_PATH}/numpy")
1997 #                               message(WARNING "PYTHON_NUMPY_PATH is invalid, numpy not found in '${PYTHON_NUMPY_PATH}' "
1998 #                                               "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python")
1999 #                               set(WITH_PYTHON_INSTALL_NUMPY OFF)
2000 #                       endif()
2001                 # not set, so initialize
2002                 else()
2003                         string(REPLACE "." ";" _PY_VER_SPLIT "${PYTHON_VERSION}")
2004                         list(GET _PY_VER_SPLIT 0 _PY_VER_MAJOR)
2005
2006                         # re-cache
2007                         unset(PYTHON_NUMPY_PATH CACHE)
2008                         find_path(PYTHON_NUMPY_PATH
2009                           NAMES
2010                             numpy
2011                           HINTS
2012                             "${PYTHON_LIBPATH}/python${PYTHON_VERSION}/"
2013                             "${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/"
2014                           PATH_SUFFIXES
2015                             site-packages
2016                             dist-packages
2017                            NO_DEFAULT_PATH
2018                         )
2019
2020                         if(NOT EXISTS "${PYTHON_NUMPY_PATH}")
2021                                 message(WARNING "'numpy' path could not be found in:\n"
2022                                                 "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/numpy', "
2023                                                 "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/site-packages/numpy', "
2024                                                 "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/dist-packages/numpy', "
2025                                                 "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/dist-packages/numpy', "
2026                                                 "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python")
2027                                 set(WITH_PYTHON_INSTALL_NUMPY OFF)
2028                         else()
2029                                 message(STATUS "numpy found at '${PYTHON_NUMPY_PATH}'")
2030                         endif()
2031
2032                         unset(_PY_VER_SPLIT)
2033                         unset(_PY_VER_MAJOR)
2034                 endif()
2035         endif()
2036 endif()
2037
2038 # Include warnings first, so its possible to disable them with user defined flags
2039 # eg: -Wno-uninitialized
2040 set(CMAKE_C_FLAGS "${C_WARNINGS} ${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS}")
2041 set(CMAKE_CXX_FLAGS "${CXX_WARNINGS} ${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS}")
2042
2043 #-------------------------------------------------------------------------------
2044 # Global Defines
2045
2046 # better not set includes here but this debugging option is off by default.
2047 if(WITH_CXX_GUARDEDALLOC)
2048         include_directories(${CMAKE_SOURCE_DIR}/intern/guardedalloc)
2049         add_definitions(-DWITH_CXX_GUARDEDALLOC)
2050 endif()
2051
2052 if(WITH_ASSERT_ABORT)
2053         add_definitions(-DWITH_ASSERT_ABORT)
2054 endif()
2055
2056 # message(STATUS "Using CFLAGS: ${CMAKE_C_FLAGS}")
2057 # message(STATUS "Using CXXFLAGS: ${CMAKE_CXX_FLAGS}")
2058
2059 #-----------------------------------------------------------------------------
2060 # Libraries
2061
2062 add_subdirectory(source)
2063 add_subdirectory(intern)
2064 add_subdirectory(extern)
2065
2066
2067 #-----------------------------------------------------------------------------
2068 # Blender Application
2069 if(WITH_BLENDER)
2070         add_subdirectory(source/creator)
2071 endif()
2072
2073
2074 #-----------------------------------------------------------------------------
2075 # Blender Player
2076 if(WITH_PLAYER)
2077         add_subdirectory(source/blenderplayer)
2078 endif()
2079
2080 #-----------------------------------------------------------------------------
2081 # CPack for generating packages
2082 include(build_files/cmake/packaging.cmake)
2083
2084
2085 #-----------------------------------------------------------------------------
2086 # Print Final Configuration
2087
2088 if(FIRST_RUN)
2089         set(_config_msg "\n* Blender Configuration *")
2090         macro(info_cfg_option
2091                 _setting)
2092                 set(_msg "   * ${_setting}")
2093                 string(LENGTH "${_msg}" _len)
2094                 while("32" GREATER "${_len}")
2095                         set(_msg "${_msg} ")
2096                          math(EXPR _len "${_len} + 1")
2097                 endwhile()
2098
2099                 set(_config_msg "${_config_msg}\n${_msg}${${_setting}}")
2100         endmacro()
2101
2102         macro(info_cfg_text
2103                 _text)
2104                 set(_config_msg "${_config_msg}\n\n  ${_text}")
2105
2106
2107         endmacro()
2108
2109         info_cfg_text("Build Options:")
2110         info_cfg_option(WITH_GAMEENGINE)
2111         info_cfg_option(WITH_PLAYER)
2112         info_cfg_option(WITH_BULLET)
2113         info_cfg_option(WITH_IK_SOLVER)
2114         info_cfg_option(WITH_IK_ITASC)
2115         info_cfg_option(WITH_OPENCOLLADA)
2116         info_cfg_option(WITH_FFTW3)
2117         info_cfg_option(WITH_INTERNATIONAL)
2118         info_cfg_option(WITH_INPUT_NDOF)
2119         info_cfg_option(WITH_CYCLES)
2120         info_cfg_option(WITH_OPENCOLORIO)
2121
2122         info_cfg_text("Compiler Options:")
2123         info_cfg_option(WITH_BUILDINFO)
2124         info_cfg_option(WITH_OPENMP)
2125         info_cfg_option(WITH_RAYOPTIMIZATION)
2126
2127         info_cfg_text("System Options:")
2128         info_cfg_option(WITH_INSTALL_PORTABLE)
2129         info_cfg_option(WITH_X11_XF86VMODE)
2130         info_cfg_option(WITH_X11_XINPUT)
2131         info_cfg_option(WITH_MEM_JEMALLOC)
2132         info_cfg_option(WITH_SYSTEM_GLEW)
2133         info_cfg_option(WITH_SYSTEM_OPENJPEG)
2134
2135         info_cfg_text("Image Formats:")
2136         info_cfg_option(WITH_IMAGE_CINEON)
2137         info_cfg_option(WITH_IMAGE_DDS)
2138         info_cfg_option(WITH_IMAGE_HDR)
2139         info_cfg_option(WITH_IMAGE_OPENEXR)
2140         info_cfg_option(WITH_IMAGE_OPENJPEG)
2141         info_cfg_option(WITH_IMAGE_REDCODE)
2142         info_cfg_option(WITH_IMAGE_TIFF)
2143
2144         info_cfg_text("Audio:")
2145         info_cfg_option(WITH_OPENAL)
2146         info_cfg_option(WITH_SDL)
2147         info_cfg_option(WITH_JACK)
2148         info_cfg_option(WITH_CODEC_AVI)
2149         info_cfg_option(WITH_CODEC_FFMPEG)
2150         info_cfg_option(WITH_CODEC_SNDFILE)
2151
2152         info_cfg_text("Compression:")
2153         info_cfg_option(WITH_LZMA)
2154         info_cfg_option(WITH_LZO)
2155
2156         info_cfg_text("Python:")
2157         info_cfg_option(WITH_PYTHON_INSTALL)
2158         info_cfg_option(WITH_PYTHON_INSTALL_NUMPY)
2159         info_cfg_option(WITH_PYTHON_MODULE)
2160         info_cfg_option(WITH_PYTHON_SAFETY)
2161
2162         info_cfg_text("Modifiers:")
2163         info_cfg_option(WITH_MOD_BOOLEAN)
2164         info_cfg_option(WITH_MOD_REMESH)
2165         info_cfg_option(WITH_MOD_FLUID)
2166         info_cfg_option(WITH_MOD_OCEANSIM)
2167
2168         info_cfg_text("")
2169
2170         message("${_config_msg}")
2171 endif()
2172
2173 # debug
2174 message(
2175     STATUS "HAVE_STDBOOL_H = ${HAVE_STDBOOL_H}"
2176 )