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