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