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