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