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