Merged 40338-40364
[blender.git] / CMakeLists.txt
1 # -*- mode: cmake; indent-tabs-mode: t; -*-
2 # $Id$
3 # ***** BEGIN GPL LICENSE BLOCK *****
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 #
19 # The Original Code is Copyright (C) 2006, Blender Foundation
20 # All rights reserved.
21 #
22 # The Original Code is: all of this file.
23 #
24 # Contributor(s): Jacques Beaurain.
25 #
26 # ***** END GPL LICENSE BLOCK *****
27
28 #-----------------------------------------------------------------------------
29 # We don't allow in-source builds. This causes no end of troubles because 
30 # all out-of-source builds will use the CMakeCache.txt file there and even 
31 # build the libs and objects in it.
32
33 if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
34         if(NOT DEFINED WITH_IN_SOURCE_BUILD)
35                 message(FATAL_ERROR
36                         "CMake generation for blender is not allowed within the source directory!"
37                         "\n Remove the CMakeCache.txt file and try again from another folder, e.g.:"
38                         "\n "
39                         "\n rm CMakeCache.txt"
40                         "\n cd .."
41                         "\n mkdir cmake-make"
42                         "\n cd cmake-make"
43                         "\n cmake ../blender"
44                         "\n "
45                         "\n Alternately define WITH_IN_SOURCE_BUILD to force this option (not recommended!)"
46                 )
47         endif()
48 endif()
49
50 cmake_minimum_required(VERSION 2.8)
51
52 if(NOT EXECUTABLE_OUTPUT_PATH)
53         set(FIRST_RUN "TRUE")
54 endif()
55
56 # this starts out unset
57 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build_files/cmake/Modules")
58
59 # avoid having empty buildtype
60 set(CMAKE_BUILD_TYPE_INIT "Release")
61
62 # quiet output for Makefiles, 'make -s' helps too
63 # set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
64
65 #-----------------------------------------------------------------------------
66 # Set policy
67
68 # see "cmake --help-policy CMP0003"
69 # So library linking is more sane
70 cmake_policy(SET CMP0003 NEW)
71
72 # So BUILDINFO and BLENDERPATH strings are automatically quoted
73 cmake_policy(SET CMP0005 NEW)
74
75 # So syntax problems are errors
76 cmake_policy(SET CMP0010 NEW)
77
78 # Input directories must have CMakeLists.txt
79 cmake_policy(SET CMP0014 NEW)
80
81 #-----------------------------------------------------------------------------
82 # Load some macros.
83 include(build_files/cmake/macros.cmake)
84
85
86 #-----------------------------------------------------------------------------
87 # Initialize project.
88
89 blender_project_hack_pre()
90
91 project(Blender)
92
93 blender_project_hack_post()
94
95 enable_testing()
96
97 #-----------------------------------------------------------------------------
98 # Redirect output files
99
100 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "" FORCE )
101 set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "" FORCE )
102
103 #-----------------------------------------------------------------------------
104 # Set default config options
105
106 get_blender_version()
107
108
109 # Blender internal features
110 option(WITH_BLENDER "Build blender (disable to build only the blender player)" ON)
111 mark_as_advanced(WITH_BLENDER)
112
113 option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
114
115 option(WITH_PYTHON        "Enable Embedded Python API  (only disable for development)" ON)
116 option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default (recommend to leave off)" OFF)
117 mark_as_advanced(WITH_PYTHON)  # dont want people disabling this unless they really know what they are doing.
118 mark_as_advanced(WITH_PYTHON_SECURITY)  # some distrobutions see this as a security issue, rather than have them patch it, make a build option.
119
120 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)
121 option(WITH_PYTHON_MODULE "Enable building as a python module (experemental, only enable for development)" OFF)
122 option(WITH_BUILDINFO     "Include extra build details (only disable for development & faster builds)" ON)
123 option(WITH_IK_ITASC      "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON)
124 option(WITH_FFTW3         "Enable FFTW3 support (Used for smoke and audio effects)" OFF)
125 option(WITH_BULLET        "Enable Bullet (Physics Engine)" ON)
126 option(WITH_GAMEENGINE    "Enable Game Engine" ON)
127 option(WITH_PLAYER        "Build Player" OFF)
128
129 # GHOST Windowing Library Options
130 option(WITH_GHOST_DEBUG   "Enable debugging output for the GHOST library" OFF)
131 mark_as_advanced(WITH_GHOST_DEBUG)
132
133 option(WITH_GHOST_SDL    "Enable building blender against SDL for windowing rather then the native APIs" OFF)
134 mark_as_advanced(WITH_GHOST_SDL)
135
136 # Misc...
137 option(WITH_HEADLESS      "Build without graphical support (renderfarm, server mode only)" OFF)
138 mark_as_advanced(WITH_HEADLESS)
139
140 option(WITH_AUDASPACE    "Build with blenders audio library (only disable if you know what you're doing!)" ON)
141 mark_as_advanced(WITH_AUDASPACE)
142
143
144 # (unix defaults to OpenMP On)
145 if(UNIX AND NOT APPLE)
146         option(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" ON)
147 else()
148         option(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" OFF)
149 endif()
150
151 if(UNIX AND NOT APPLE)
152         option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support)"     ON)
153         option(WITH_BUILTIN_GLEW "Use GLEW OpenGL wrapper library bundled with blender" ON)
154 else()
155         # not an option for other OS's
156         set(WITH_BUILTIN_GLEW ON)
157 endif()
158
159 # Modifiers
160 option(WITH_MOD_FLUID           "Enable Elbeem Modifier (Fluid Simulation)" ON)
161 option(WITH_MOD_SMOKE           "Enable Smoke Modifier (Smoke Simulation)" ON)
162 option(WITH_MOD_DECIMATE        "Enable Decimate Modifier" ON)
163 option(WITH_MOD_BOOLEAN         "Enable Boolean Modifier" ON)
164 option(WITH_MOD_CLOTH_ELTOPO    "Enable Experemental cloth solver" OFF)
165 mark_as_advanced(WITH_MOD_CLOTH_ELTOPO)
166
167 # Image format support
168 option(WITH_IMAGE_OPENEXR       "Enable OpenEXR Support (http://www.openexr.com)" ON)
169 option(WITH_IMAGE_OPENJPEG      "Enable OpenJpeg Support (http://www.openjpeg.org)" ON)
170 option(WITH_IMAGE_TIFF          "Enable LibTIFF Support" ON)
171 option(WITH_IMAGE_DDS           "Enable DDS Image Support" ON)
172 option(WITH_IMAGE_CINEON        "Enable CINEON and DPX Image Support" ON)
173 option(WITH_IMAGE_HDR           "Enable HDR Image Support" ON)
174 option(WITH_IMAGE_REDCODE       "Enable RedCode Image Support" OFF)
175 option(WITH_IMAGE_FRAMESERVER   "Enable image FrameServer Support for rendering" ON)
176
177 # Audio/Video format support
178 option(WITH_CODEC_FFMPEG        "Enable FFMPeg Support (http://ffmpeg.org)" OFF)
179 option(WITH_CODEC_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
180 if(APPLE OR (WIN32 AND NOT UNIX))
181         option(WITH_CODEC_QUICKTIME     "Enable Quicktime Support" OFF)
182 endif()
183
184 # 3D format support
185 # disable opencollada on non-apple unix because opencollada has no package for debian
186 option(WITH_OPENCOLLADA         "Enable OpenCollada Support (http://www.opencollada.org)"       OFF)
187
188 # Sound output
189 option(WITH_SDL           "Enable SDL for sound and joystick support" ON)
190 option(WITH_OPENAL        "Enable OpenAL Support (http://www.openal.org)" ON)
191 option(WITH_JACK          "Enable Jack Support (http://www.jackaudio.org)" OFF)
192 option(WITH_SAMPLERATE    "Enable samplerate conversion" ON)
193
194 # Compression
195 option(WITH_LZO           "Enable fast LZO compression (used for pointcache)" ON)
196 option(WITH_LZMA          "Enable best LZMA compression, (used for pointcache)" ON)
197
198 # Misc
199 option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ON)
200 option(WITH_RAYOPTIMIZATION     "Enable use of SIMD (SSE) optimizations for the raytracer" ON) 
201 if(UNIX AND NOT APPLE)
202         option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON)
203 endif()
204 option(WITH_PYTHON_INSTALL       "Copy system python into the blender install folder" ON)
205
206 # disable for now, but plan to support on all platforms eventually
207 option(WITH_MEM_JEMALLOC   "Enable malloc replacement (http://www.canonware.com/jemalloc)" OFF)
208 mark_as_advanced(WITH_MEM_JEMALLOC)
209
210 # Debug
211 option(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF)
212 mark_as_advanced(WITH_CXX_GUARDEDALLOC)
213
214 option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" OFF)
215 mark_as_advanced(WITH_ASSERT_ABORT)
216
217 if(APPLE)
218         if(NOT CMAKE_OSX_ARCHITECTURES)
219                 set(CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING
220                 "Choose the architecture you want to build Blender for: i386, x86_64 or ppc"
221                 FORCE)
222         endif()
223         if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
224                 set(CMAKE_OSX_DEPLOYMENT_TARGET 10.5 CACHE STRING
225                 "Choose the minimum OSX version required: 10.4 or 10.5"
226                 FORCE)
227         endif()
228         option(WITH_COCOA         "Use Cocoa framework instead of deprecated Carbon" ON)
229         option(USE_QTKIT          "Use QtKit instead of Carbon quicktime (needed for having partial quicktime for 64bit)" OFF)
230         option(WITH_LIBS10.5  "Use 10.5 libs (needed for 64bit builds)" OFF)
231 endif()
232
233 #-----------------------------------------------------------------------------
234 # Check for conflicting/unsupported configurations
235
236 if(NOT WITH_BLENDER AND NOT WITH_PLAYER)
237         message(FATAL_ERROR "At least one of WITH_BLENDER or WITH_PLAYER must be enabled, nothing to do!")
238 endif()
239
240 if(NOT WITH_GAMEENGINE AND WITH_PLAYER)
241         message(FATAL_ERROR "WITH_PLAYER requires WITH_GAMEENGINE")
242 endif()
243
244 if(NOT WITH_AUDASPACE AND (WITH_OPENAL OR WITH_SDL OR WITH_JACK))
245         message(FATAL_ERROR "WITH_OPENAL/WITH_SDL/WITH_JACK/WITH_CODEC_FFMPEG require WITH_AUDASPACE")
246 endif()
247
248 if(NOT WITH_SDL AND WITH_GHOST_SDL)
249         message(FATAL_ERROR "WITH_GHOST_SDL requires WITH_SDL to be ON")
250 endif()
251
252 if(NOT WITH_IMAGE_OPENJPEG AND WITH_IMAGE_REDCODE)
253         message(FATAL_ERROR "WITH_IMAGE_REDCODE requires WITH_IMAGE_OPENJPEG")
254 endif()
255
256 # python module, needs some different options
257 if(WITH_PYTHON_MODULE AND WITH_PLAYER)
258         message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PLAYER to be OFF")
259 endif()
260
261 if(WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL)
262         message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PYTHON_INSTALL to be OFF")
263 endif()
264
265 if(WITH_CODEC_QUICKTIME AND MINGW)
266         message(FATAL_ERROR "MINGW requires WITH_CODEC_QUICKTIME to be OFF "
267                                                 "because it is currently unsupported, remove this "
268                                                 "line if youre a developer who wants to add support.")
269 endif()
270
271 # may as well build python module without a UI
272 if(WITH_PYTHON_MODULE)
273         set(WITH_HEADLESS ON)
274 endif()
275
276 TEST_SSE_SUPPORT()
277
278 # don't store paths to libs for portable distrobution
279 if(WITH_INSTALL_PORTABLE)
280         set(CMAKE_SKIP_BUILD_RPATH TRUE)
281 endif()
282
283 #-----------------------------------------------------------------------------
284 # Initialize un-cached vars, avoid unused warning
285
286 # linux only, not cached
287 set(WITH_BINRELOC OFF)
288
289 # MAXOSX only, set to avoid uninitialized 
290 set(EXETYPE)
291
292 # C/C++ flags
293 set(PLATFORM_CFLAGS)
294
295 # these are added to later on.
296 set(C_WARNINGS)
297 set(CXX_WARNINGS)
298
299 # libraries to link the binary with passed to target_link_libraries()
300 # known as LLIBS to scons
301 set(PLATFORM_LINKLIBS)
302
303 # Added to linker flags in setup_liblinks
304 # - CMAKE_EXE_LINKER_FLAGS
305 # - CMAKE_EXE_LINKER_FLAGS_DEBUG
306 set(PLATFORM_LINKFLAGS)
307 set(PLATFORM_LINKFLAGS_DEBUG)
308
309
310 # disabled for now, not supported
311 # option(WITH_WEBPLUGIN     "Enable Web Plugin (Unix only)" OFF)
312
313 # For alternate Python locations the commandline can be used to override detected/default cache settings, e.g:
314 # On Unix: 
315 #   cmake ../blender \
316 #         -D PYTHON_VERSION=3.2 \
317 #         -D PYTHON_INCLUDE_DIR=/opt/py32/include/python3.2d \
318 #         -D PYTHON_LIBRARY=/opt/py32/lib/libpython3.2d.so
319 #
320 # On Macs: 
321 #   cmake ../blender \
322 #         -D PYTHON_INCLUDE_DIR=/System/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2 \
323 #         -D PYTHON_LIBPATH=/System/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/config \
324 #         -G Xcode
325 #
326 # When changing any of this remember to update the notes in doc/build_systems/cmake.txt
327
328 #-----------------------------------------------------------------------------
329 #Platform specifics
330
331 if(UNIX AND NOT APPLE)
332         
333         # needed for ubuntu 11.04
334         if(EXISTS "/usr/lib/x86_64-linux-gnu")
335                 set(CMAKE_LIBRARY_PATH "/usr/lib/x86_64-linux-gnu;${CMAKE_LIBRARY_PATH}")
336         endif()
337
338         find_package(JPEG REQUIRED)
339         find_package(PNG REQUIRED)
340         find_package(ZLIB REQUIRED)
341         find_package(Freetype REQUIRED)
342
343         if(WITH_PYTHON)
344                 # No way to set py32. remove for now.
345                 # find_package(PythonLibs)
346
347                 # Use our own instead, since wothout py is such a rare case,
348                 # require this package
349                 find_package(PythonLibsUnix REQUIRED)
350         endif()
351
352
353         if(WITH_IMAGE_OPENEXR)
354                 find_package(OpenEXR)  # our own module
355                 if(NOT OPENEXR_FOUND)
356                         set(WITH_IMAGE_OPENEXR OFF)
357                 endif()
358         endif()
359
360         if(WITH_IMAGE_OPENJPEG)
361                 find_package(OpenJPEG)
362                 if(NOT OPENJPEG_FOUND)
363                         set(WITH_IMAGE_OPENJPEG OFF)
364                 endif()
365         endif()
366
367         if(WITH_IMAGE_TIFF)
368                 find_package(TIFF)
369                 if(NOT TIFF_FOUND)
370                         set(WITH_IMAGE_TIFF OFF)
371                 endif()
372         endif()
373
374         # Audio IO
375         if(WITH_OPENAL)
376                 find_package(OpenAL)
377                 if(NOT OPENAL_FOUND)
378                         set(WITH_OPENAL OFF)
379                 endif()
380         endif()
381
382         if(WITH_SDL)
383                 find_package(SDL)
384                 mark_as_advanced(SDLMAIN_LIBRARY)
385                 mark_as_advanced(SDL_INCLUDE_DIR)
386                 mark_as_advanced(SDL_LIBRARY)
387                 mark_as_advanced(SDL_LIBRARY_TEMP)
388                 # unset(SDLMAIN_LIBRARY CACHE)
389                 if(NOT SDL_FOUND)
390                         set(WITH_SDL OFF)
391                 endif()
392         endif()
393
394         if(WITH_JACK)
395                 find_package(Jack)
396                 if(NOT JACK_FOUND)
397                         set(WITH_JACK OFF)
398                 endif()
399         endif()
400
401         # Codecs
402         if(WITH_CODEC_SNDFILE)
403                 find_package(SndFile)
404                 if(NOT SNDFILE_FOUND)
405                         set(WITH_CODEC_SNDFILE OFF)
406                 endif()
407         endif()
408
409         if(WITH_CODEC_FFMPEG)
410                 set(FFMPEG /usr CACHE PATH "FFMPEG Directory")
411                 mark_as_advanced(FFMPEG)
412                 set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
413                 set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
414                 mark_as_advanced(FFMPEG_LIBRARIES)
415                 set(FFMPEG_LIBPATH ${FFMPEG}/lib)
416                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
417         endif()
418
419         if(WITH_INTERNATIONAL)
420                 find_library(INTL_LIBRARY
421                         NAMES intl
422                         PATHS
423                         /sw/lib
424                 )
425
426                 find_library(ICONV_LIBRARY
427                         NAMES iconv
428                         PATHS
429                         /sw/lib
430                 )
431                 mark_as_advanced(ICONV_LIBRARY)
432                 mark_as_advanced(INTL_LIBRARY)
433
434                 if(INTL_LIBRARY AND ICONV_LIBRARY)
435                         set(GETTEXT_LIB ${INTL_LIBRARY} ${ICONV_LIBRARY})
436                 endif()
437         endif()
438
439         if(WITH_FFTW3)
440                 find_package(Fftw3)
441                 if(NOT FFTW3_FOUND)
442                         set(WITH_FFTW3 OFF)
443                 endif()
444         endif()
445
446         if(WITH_SAMPLERATE)
447                 find_package(Samplerate)
448                 if(NOT SAMPLERATE_FOUND)
449                         set(WITH_SAMPLERATE OFF)
450                 endif()
451         endif()
452
453         if(WITH_OPENCOLLADA)
454                 find_package(OpenCOLLADA)
455                 if(OPENCOLLADA_FOUND)
456                         find_package(XML2)
457                         find_package(PCRE)
458                 else()
459                         set(WITH_OPENCOLLADA OFF)
460                 endif()
461         endif()
462
463         if(WITH_MEM_JEMALLOC)
464                 find_package(JeMalloc)
465                 if(NOT JEMALLOC_FOUND)
466                         set(WITH_MEM_JEMALLOC OFF)
467                 endif()
468         endif()
469
470         if (WITH_INPUT_NDOF)
471                 find_package(Spacenav)
472                 if(NOT SPACENAV_FOUND)
473                         set(WITH_INPUT_NDOF OFF)
474                 endif()
475
476                 # use generic names within blenders buildsystem.
477                 if(SPACENAV_FOUND)
478                         set(NDOF_INCLUDE_DIRS ${SPACENAV_INCLUDE_DIRS})
479                         set(NDOF_LIBRARIES ${SPACENAV_LIBRARIES})
480                 endif()
481         endif()
482
483         # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
484         set(PLATFORM_LINKLIBS "-lutil -lc -lm -lpthread -lstdc++")
485
486         if((NOT WITH_HEADLESS) AND (NOT WITH_GHOST_SDL))
487                 find_package(X11 REQUIRED)
488                 find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH})
489                 mark_as_advanced(X11_XF86keysym_INCLUDE_PATH)
490
491                 list(APPEND PLATFORM_LINKLIBS ${X11_X11_LIB})
492
493                 if(WITH_X11_XINPUT)
494                         list(APPEND PLATFORM_LINKLIBS ${X11_Xinput_LIB})
495                 endif()
496         endif()
497
498         if(CMAKE_SYSTEM_NAME MATCHES "Linux")
499                 if(NOT WITH_PYTHON_MODULE)
500                         # BSD's dont use libdl.so
501                         list(APPEND PLATFORM_LINKLIBS -ldl)
502                         # binreloc is linux only
503                         set(BINRELOC_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/binreloc/include)
504                         set(WITH_BINRELOC ON)
505                 endif()
506         endif()
507
508         set(PLATFORM_LINKFLAGS "-pthread")
509
510         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE")
511         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE")
512
513         # GNU Compiler
514         if(CMAKE_COMPILER_IS_GNUCC)
515                 set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
516         # CLang is the same as GCC for now.
517         elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
518                 set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
519         # Intel C++ Compiler
520         elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
521                 # think these next two are broken
522                 find_program(XIAR xiar) 
523                 if(XIAR) 
524                         set(CMAKE_AR "${XIAR}")
525                 endif() 
526                 mark_as_advanced(XIAR)
527
528                 find_program(XILD xild) 
529                 if(XILD) 
530                         set(CMAKE_LINKER "${XILD}")
531                 endif() 
532                 mark_as_advanced(XILD)
533
534                 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fp-model precise -prec_div -parallel")
535                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fp-model precise -prec_div -parallel")
536
537                 # set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -diag-enable sc3")
538                 set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
539                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-intel")
540         endif()
541
542 elseif(WIN32)
543
544         # this file is included anyway when building under Windows with cl.exe
545         #  include(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
546
547         set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
548
549         # Setup 64bit and 64bit windows systems
550         if(CMAKE_CL_64)
551                 message("64 bit compiler detected.")
552                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64)
553         endif()
554         
555         add_definitions(-DWIN32)
556
557         if(WITH_INTERNATIONAL)
558                 set(ICONV ${LIBDIR}/iconv)
559                 set(ICONV_INCLUDE_DIRS ${ICONV}/include)
560                 set(ICONV_LIBRARIES iconv)
561                 set(ICONV_LIBPATH ${ICONV}/lib)
562         endif()
563
564         if(WITH_SAMPLERATE)
565                 set(SAMPLERATE ${LIBDIR}/samplerate)
566                 set(SAMPLERATE_INCLUDE_DIRS ${SAMPLERATE}/include)
567                 set(SAMPLERATE_LIBRARIES libsamplerate)
568                 set(SAMPLERATE_LIBPATH ${SAMPLERATE}/lib)
569         endif()
570
571         set(PNG "${LIBDIR}/png")
572         set(PNG_INCLUDE_DIR "${PNG}/include")
573         set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
574
575         set(JPEG "${LIBDIR}/jpeg")
576         set(JPEG_INCLUDE_DIR "${JPEG}/include")
577         set(JPEG_LIBPATH ${JPEG}/lib) # not cmake defined
578
579         set(WINTAB_INC ${LIBDIR}/wintab/include) 
580
581         if(WITH_OPENAL)
582                 set(OPENAL ${LIBDIR}/openal)
583                 set(OPENAL_INCLUDE_DIR ${OPENAL}/include)
584                 set(OPENAL_LIBRARY wrap_oal)
585                 set(OPENAL_LIBPATH ${OPENAL}/lib)
586         endif()
587
588         if(WITH_CODEC_SNDFILE)
589                 set(SNDFILE ${LIBDIR}/sndfile)
590                 set(SNDFILE_INCLUDE_DIRS ${SNDFILE}/include)
591                 set(SNDFILE_LIBRARIES libsndfile-1)
592                 set(SNDFILE_LIBPATH ${SNDFILE}/lib) # TODO, deprecate
593         endif()
594
595         if(WITH_SDL)
596                 set(SDL ${LIBDIR}/sdl)
597                 set(SDL_INCLUDE_DIR ${SDL}/include)
598                 set(SDL_LIBRARY SDL)
599                 set(SDL_LIBPATH ${SDL}/lib)
600         endif()
601
602         if(WITH_CODEC_QUICKTIME)
603                 set(QUICKTIME ${LIBDIR}/QTDevWin)
604                 set(QUICKTIME_INCLUDE_DIRS ${QUICKTIME}/CIncludes)
605                 set(QUICKTIME_LIBRARIES qtmlClient)
606                 set(QUICKTIME_LIBPATH ${QUICKTIME}/Libraries)
607         endif()
608
609         if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
610                 add_definitions(-D__SSE__ -D__MMX__)
611         endif()
612
613         if(MSVC)
614                 if(CMAKE_CL_64)
615                         set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
616                 else()
617                         set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
618                 endif()
619
620                 add_definitions(/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_CONSOLE /D_LIB)
621
622                 set(CMAKE_CXX_FLAGS "/nologo /J /W0 /Gd /wd4018 /wd4244 /wd4305 /wd4800 /wd4065 /wd4267 /we4013" CACHE STRING "MSVC MT C++ flags " FORCE)
623                 set(CMAKE_C_FLAGS   "/nologo /J /W0 /Gd /wd4018 /wd4244 /wd4305 /wd4800 /wd4065 /wd4267 /we4013 /EHsc" CACHE STRING "MSVC MT C++ flags " FORCE)
624
625                 if(CMAKE_CL_64)
626                         set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
627                 else()
628                         set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
629                 endif()
630                 set(CMAKE_CXX_FLAGS_RELEASE "/O2 /Ob2 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
631                 set(CMAKE_CXX_FLAGS_MINSIZEREL "/O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
632                 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
633                 if(CMAKE_CL_64)
634                         set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
635                 else()
636                         set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
637                 endif()
638                 set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
639                 set(CMAKE_C_FLAGS_MINSIZEREL "/O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
640                 set(CMAKE_C_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
641
642                 if(WITH_INTERNATIONAL)
643                         set(GETTEXT ${LIBDIR}/gettext)
644                         set(GETTEXT_INC ${GETTEXT}/include)
645                         set(GETTEXT_LIBPATH ${GETTEXT}/lib)
646                         set(GETTEXT_LIB gnu_gettext)
647                 endif()
648
649                 if(CMAKE_CL_64)
650                         set(PNG_LIBRARIES libpng)
651                 else()
652                         set(PNG_LIBRARIES libpng_st)
653                 endif()
654                 set(JPEG_LIBRARIES libjpeg)
655
656                 set(ZLIB_INCLUDE_DIRS ${LIBDIR}/zlib/include)
657                 if(CMAKE_CL_64)
658                         set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/libz.lib)
659                 else()
660                         set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/zlib.lib)
661                 endif()
662
663                 set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include)
664                 set(PTHREADS_LIBRARIES ${LIBDIR}/pthreads/lib/pthreadVC2.lib)
665
666                 set(FREETYPE ${LIBDIR}/freetype)
667                 set(FREETYPE_INCLUDE_DIRS
668                         ${LIBDIR}/freetype/include
669                         ${LIBDIR}/freetype/include/freetype2
670                 )
671                 set(FREETYPE_LIBRARY ${LIBDIR}/freetype/lib/freetype2ST.lib)
672
673                 if(WITH_FFTW3)
674                         set(FFTW3 ${LIBDIR}/fftw3)
675                         set(FFTW3_LIBRARIES libfftw)
676                         set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
677                         set(FFTW3_LIBPATH ${FFTW3}/lib)
678                 endif()
679
680                 if(WITH_OPENCOLLADA)
681
682                         set(OPENCOLLADA_INCLUDE_DIRS
683                                 ${LIBDIR}/opencollada/include/COLLADAStreamWriter/include
684                                 ${LIBDIR}/opencollada/include/COLLADABaseUtils/include
685                                 ${LIBDIR}/opencollada/include/COLLADAFramework/include
686                                 ${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader/include
687                                 ${LIBDIR}/opencollada/include/GeneratedSaxParser/include                        
688                         )
689
690                         set(OPENCOLLADA_LIBRARIES
691                                 ${LIBDIR}/opencollada/lib/OpenCOLLADASaxFrameworkLoader.lib
692                                 ${LIBDIR}/opencollada/lib/OpenCOLLADAFramework.lib
693                                 ${LIBDIR}/opencollada/lib/OpenCOLLADABaseUtils.lib
694                                 ${LIBDIR}/opencollada/lib/OpenCOLLADAStreamWriter.lib
695                                 ${LIBDIR}/opencollada/lib/MathMLSolver.lib
696                                 ${LIBDIR}/opencollada/lib/GeneratedSaxParser.lib
697                                 ${LIBDIR}/opencollada/lib/xml2.lib
698                                 ${LIBDIR}/opencollada/lib/buffer.lib
699                                 ${LIBDIR}/opencollada/lib/ftoa.lib
700                                 ${LIBDIR}/opencollada/lib/UTF.lib
701                         )
702                         set(PCRE_LIBRARIES
703                                 ${LIBDIR}/opencollada/lib/pcre.lib
704                         )
705                 endif()
706
707                 if(WITH_CODEC_FFMPEG)
708                         set(FFMPEG_INCLUDE_DIRS
709                                 ${LIBDIR}/ffmpeg/include
710                                 ${LIBDIR}/ffmpeg/include/msvc
711                         )
712                         set(FFMPEG_LIBRARIES
713                                 ${LIBDIR}/ffmpeg/lib/avcodec-53.lib
714                                 ${LIBDIR}/ffmpeg/lib/avformat-53.lib
715                                 ${LIBDIR}/ffmpeg/lib/avdevice-53.lib
716                                 ${LIBDIR}/ffmpeg/lib/avutil-51.lib
717                                 ${LIBDIR}/ffmpeg/lib/swscale-2.lib
718                         )
719                 endif()
720
721                 if(WITH_IMAGE_OPENEXR)
722                         if(MSVC90)
723                                 set(MSVC_LIB _vs2008)
724                                 set(MSVC_INC)
725                         elseif(MSVC10)
726                                 set(MSVC_LIB _vs2010)
727                                 set(MSVC_INC _vs2010)
728                         else()
729                                 set(MSVC_LIB msvc)
730                                 set(MSVC_INC)
731                         endif()
732                         set(OPENEXR ${LIBDIR}/openexr)
733                         set(OPENEXR_LIBPATH ${OPENEXR}/lib${MSVC_LIB})
734                         set(OPENEXR_LIBRARIES
735                                 ${OPENEXR_LIBPATH}/Iex.lib
736                                 ${OPENEXR_LIBPATH}/Half.lib
737                                 ${OPENEXR_LIBPATH}/IlmImf.lib
738                                 ${OPENEXR_LIBPATH}/Imath.lib
739                                 ${OPENEXR_LIBPATH}/IlmThread.lib
740                         )
741                         set(OPENEXR_INCUDE ${OPENEXR}/include${MSVC_INC})
742                         set(OPENEXR_INCLUDE_DIRS
743                                 ${OPENEXR_INCUDE}
744                                 ${OPENEXR_INCUDE}/IlmImf
745                                 ${OPENEXR_INCUDE}/Iex
746                                 ${OPENEXR_INCUDE}/Imath
747                         )
748                         unset(OPENEXR_INCUDE)
749                         unset(OPENEXR_LIBPATH)
750                 endif()
751
752                 if(WITH_IMAGE_TIFF)
753                         set(TIFF_LIBRARY ${LIBDIR}/tiff/lib/libtiff.lib)
754                         set(TIFF_INCLUDE_DIR ${LIBDIR}/tiff/include)
755                 endif()
756
757                 if(WITH_JACK)
758                         set(JACK_INCLUDE_DIRS
759                                 ${LIBDIR}/jack/include/jack
760                                 ${LIBDIR}/jack/include
761                         )
762                         set(JACK_LIBRARIES ${LIBDIR}/jack/lib/libjack.lib)
763                 endif()
764
765                 if(WITH_PYTHON)
766                         # normally cached but not since we include them with blender
767                         set(PYTHON_VERSION 3.2) # CACHE STRING)
768                         set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}") # CACHE PATH)
769                         set(PYTHON_LIBRARY "${LIBDIR}/python/lib/python32.lib") #CACHE FILEPATH)
770
771                         # uncached vars
772                         set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
773                         set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
774                 endif()
775
776                 set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib")
777
778                 # MSVC only, Mingw doesnt need
779                 if(CMAKE_CL_64)
780                         set(PLATFORM_LINKFLAGS "/MACHINE:X64 /OPT:NOREF ${PLATFORM_LINKFLAGS}")
781                 else()
782                         set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}")
783                 endif()
784
785                 set(PLATFORM_LINKFLAGS_DEBUG "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
786
787         else()
788                 # keep GCC spesific stuff here
789                 if(CMAKE_COMPILER_IS_GNUCC)
790                         set(PLATFORM_LINKLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32")
791                         set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
792
793                         add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
794                 endif()
795
796                 add_definitions(-DFREE_WINDOWS)
797
798                 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
799                 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
800
801                 if(WITH_INTERNATIONAL)
802                         set(GETTEXT ${LIBDIR}/gcc/gettext)
803                         set(GETTEXT_INC ${GETTEXT}/include)
804                         set(GETTEXT_LIBPATH ${GETTEXT}/lib)
805                         set(GETTEXT_LIB intl)
806                 endif()
807
808                 set(JPEG_LIBRARIES libjpeg)
809                 set(PNG_LIBRARIES png)
810
811                 set(ZLIB ${LIBDIR}/zlib)
812                 set(ZLIB_INCLUDE_DIRS ${ZLIB}/include)
813                 set(ZLIB_LIBPATH ${ZLIB}/lib)
814                 set(ZLIB_LIBRARIES z)
815
816                 set(PTHREADS ${LIBDIR}/pthreads)
817                 set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include)
818                 set(PTHREADS_LIBPATH ${PTHREADS}/lib)
819                 set(PTHREADS_LIBRARIES pthreadGC2)
820                 
821                 set(FREETYPE ${LIBDIR}/gcc/freetype)
822                 set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
823                 set(FREETYPE_LIBPATH ${FREETYPE}/lib)
824                 set(FREETYPE_LIBRARY freetype)
825
826                 if(WITH_FFTW3)
827                         set(FFTW3 ${LIBDIR}/gcc/fftw3)
828                         set(FFTW3_LIBRARIES fftw3)
829                         set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
830                         set(FFTW3_LIBPATH ${FFTW3}/lib)
831                 endif()
832
833                 if(WITH_OPENCOLLADA)
834                         set(OPENCOLLADA ${LIBDIR}/gcc/opencollada)
835                         set(OPENCOLLADA_INCLUDE_DIRS
836                                 ${LIBDIR}/gcc/opencollada/include/COLLADAStreamWriter/include
837                                 ${LIBDIR}/gcc/opencollada/include/COLLADABaseUtils/include
838                                 ${LIBDIR}/gcc/opencollada/include/COLLADAFramework/include
839                                 ${LIBDIR}/gcc/opencollada/include/COLLADASaxFrameworkLoader/include
840                                 ${LIBDIR}/gcc/opencollada/include/GeneratedSaxParser/include                    
841                         )
842                         set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib ${OPENCOLLADA}/lib)
843                         set(OPENCOLLADA_LIBRARIES OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa)
844                         set(PCRE_LIBRARIES pcre)
845                 endif()
846                 
847                 if(WITH_CODEC_FFMPEG)
848                         set(FFMPEG ${LIBDIR}/ffmpeg)
849                         set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include ${FFMPEG}/include)
850                         set(FFMPEG_LIBRARIES avcodec-53 avformat-53 avdevice-53 avutil-51 swscale-2)
851                         set(FFMPEG_LIBPATH ${FFMPEG}/lib)
852                 endif()
853
854                 if(WITH_IMAGE_OPENEXR)
855                         set(OPENEXR ${LIBDIR}/gcc/openexr)
856                         set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
857                         set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread Iex)
858                         set(OPENEXR_LIBPATH ${OPENEXR}/lib)
859                 endif()
860
861                 if(WITH_IMAGE_TIFF)
862                         set(TIFF ${LIBDIR}/gcc/tiff)
863                         set(TIFF_LIBRARY tiff)
864                         set(TIFF_INCLUDE_DIR ${TIFF}/include)
865                         set(TIFF_LIBPATH ${TIFF}/lib)
866                 endif()
867
868                 if(WITH_JACK)
869                         set(JACK ${LIBDIR}/jack)
870                         set(JACK_INCLUDE_DIRS ${JACK}/include/jack ${JACK}/include)
871                         set(JACK_LIBRARIES jack)
872                         set(JACK_LIBPATH ${JACK}/lib)
873                         
874                         # TODO, gives linking errors, force off
875                         set(WITH_JACK OFF)
876                 endif()
877
878                 if(WITH_PYTHON)
879                         # normally cached but not since we include them with blender
880                         set(PYTHON_VERSION 3.2) #  CACHE STRING)
881                         set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")  # CACHE PATH)
882                         set(PYTHON_LIBRARY "${LIBDIR}/python/lib/python32mw.lib")  # CACHE FILEPATH)
883
884                         # uncached vars
885                         set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
886                         set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
887                 endif()
888
889                 set(PLATFORM_LINKFLAGS "--stack,2097152")
890
891         endif()
892
893         # used in many places so include globally, like OpenGL
894         blender_include_dirs("${PTHREADS_INCLUDE_DIRS}")
895
896 elseif(APPLE)
897
898         if (${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.5")
899                 set(WITH_LIBS10.5 ON CACHE BOOL "Use 10.5 libs" FORCE)
900         endif()
901
902         if(WITH_LIBS10.5)
903                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
904         else()
905                 if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
906                         set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.x.i386)
907                 else()
908                         set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.0.0-powerpc)
909                 endif()
910         endif()
911         
912
913         if(WITH_OPENAL)
914                 find_package(OpenAL)
915                 if(OPENAL_FOUND)
916                         set(WITH_OPENAL ON)
917                         set(OPENAL_INCLUDE_DIR "${LIBDIR}/openal/include")
918                 else()
919                         set(WITH_OPENAL OFF)
920                 endif()
921         endif()
922
923         if(WITH_JACK)
924                 set(JACK /usr)
925                 set(JACK_INCLUDE_DIRS ${JACK}/include/jack)
926                 set(JACK_LIBRARIES jack)
927                 set(JACK_LIBPATH ${JACK}/lib)
928         endif()
929
930         if(WITH_CODEC_SNDFILE)
931                 set(SNDFILE ${LIBDIR}/sndfile)
932                 set(SNDFILE_INCLUDE_DIRS ${SNDFILE}/include)
933                 set(SNDFILE_LIBRARIES sndfile FLAC ogg vorbis vorbisenc)
934                 set(SNDFILE_LIBPATH ${SNDFILE}/lib ${FFMPEG}/lib)  # TODO, deprecate
935         endif()
936
937         if(WITH_PYTHON)
938                 # we use precompiled libraries for py 3.2 and up by default
939
940                 # normally cached but not since we include them with blender
941                 set(PYTHON_VERSION 3.2)
942                 set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")
943                 # set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet
944                 set(PYTHON_LIBRARY python${PYTHON_VERSION})
945                 set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
946                 # set(PYTHON_LINKFLAGS "-u _PyMac_Error")  # won't  build with this enabled
947
948                 # uncached vars
949                 set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
950                 set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
951         endif()
952
953         if(WITH_INTERNATIONAL)
954                 set(GETTEXT ${LIBDIR}/gettext)
955                 set(GETTEXT_INC "${GETTEXT}/include")
956                 set(GETTEXT_LIB intl iconv)
957                 set(GETTEXT_LIBPATH ${GETTEXT}/lib)
958         endif()
959
960         if(WITH_FFTW3)
961                 set(FFTW3 ${LIBDIR}/fftw3)
962                 set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
963                 set(FFTW3_LIBRARIES fftw3)
964                 set(FFTW3_LIBPATH ${FFTW3}/lib)
965         endif()
966
967         set(PNG_LIBRARIES png)
968         set(JPEG_LIBRARIES jpeg)
969
970         set(ZLIB /usr)
971         set(ZLIB_INCLUDE_DIRS "${ZLIB}/include")
972         set(ZLIB_LIBRARIES z bz2)
973
974         set(FREETYPE ${LIBDIR}/freetype)
975         set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
976         set(FREETYPE_LIBPATH ${FREETYPE}/lib)
977         set(FREETYPE_LIBRARY freetype)
978
979         if(WITH_IMAGE_OPENEXR)
980                 set(OPENEXR ${LIBDIR}/openexr)
981                 set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
982                 set(OPENEXR_LIBRARIES Iex Half IlmImf Imath IlmThread)
983                 set(OPENEXR_LIBPATH ${OPENEXR}/lib)
984         endif()
985
986         if(WITH_CODEC_FFMPEG)
987                 set(FFMPEG ${LIBDIR}/ffmpeg)
988                 set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
989                 set(FFMPEG_LIBRARIES avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg)
990                 set(FFMPEG_LIBPATH ${FFMPEG}/lib)
991                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
992         endif()
993
994         if(WITH_SAMPLERATE)
995                 set(SAMPLERATE ${LIBDIR}/samplerate)
996                 set(SAMPLERATE_INCLUDE_DIRS ${SAMPLERATE}/include)
997                 set(SAMPLERATE_LIBRARIES samplerate)
998                 set(SAMPLERATE_LIBPATH ${SAMPLERATE}/lib)
999         endif()
1000
1001         find_library(SYSTEMSTUBS_LIBRARY 
1002                 NAMES 
1003                 SystemStubs 
1004                 PATHS
1005         )
1006         mark_as_advanced(SYSTEMSTUBS_LIBRARY)
1007         if(SYSTEMSTUBS_LIBRARY)
1008                 set(PLATFORM_LINKLIBS stdc++ SystemStubs)
1009         else()
1010                 set(PLATFORM_LINKLIBS stdc++)
1011         endif()
1012
1013         if(WITH_COCOA)
1014                 set(PLATFORM_CFLAGS "-pipe -funsigned-char -DGHOST_COCOA")
1015                 set(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio")
1016                 if(USE_QTKIT)
1017                         set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DUSE_QTKIT")
1018                         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QTKit")
1019                         if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
1020                                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
1021                                 #libSDL still needs 32bit carbon quicktime 
1022                         endif()
1023                 elseif(WITH_CODEC_QUICKTIME)
1024                         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
1025                 endif()
1026
1027                 # XXX - SOME MAC DEV PLEASE TEST WITH THE SDK INSTALLED! 
1028                 # ALSO SHOULD BE MOVED INTO OWN MODULE WHEN FUNCTIONAL
1029                 if(WITH_INPUT_NDOF)
1030                         # This thread it *should* work and check the framework - campbell
1031                         # http://www.cmake.org/pipermail/cmake/2005-December/007740.html
1032                         find_library(3D_CONNEXION_CLIENT_LIBRARY
1033                                 NAMES 3DconnexionClient
1034                         )
1035                         if(NOT 3D_CONNEXION_CLIENT_LIBRARY)
1036                                 set(WITH_INPUT_NDOF OFF)
1037                         endif()
1038
1039                         if(WITH_INPUT_NDOF)
1040                                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -weak_framework 3DconnexionClient")
1041                         endif()
1042                 endif()
1043
1044         else()
1045                 set(PLATFORM_CFLAGS "-pipe -funsigned-char")
1046                 set(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
1047                 set(WITH_INPUT_NDOF OFF)  # unsupported
1048         endif()
1049
1050         if(WITH_OPENCOLLADA)
1051                 set(OPENCOLLADA ${LIBDIR}/opencollada)
1052
1053                 set(OPENCOLLADA_INCLUDE_DIRS
1054                         ${LIBDIR}/opencollada/include/COLLADAStreamWriter
1055                         ${LIBDIR}/opencollada/include/COLLADABaseUtils
1056                         ${LIBDIR}/opencollada/include/COLLADAFramework
1057                         ${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader
1058                         ${LIBDIR}/opencollada/include/GeneratedSaxParser
1059                 )
1060
1061                 set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
1062                 set(OPENCOLLADA_LIBRARIES "OpenCOLLADASaxFrameworkLoader -lOpenCOLLADAFramework -lOpenCOLLADABaseUtils -lOpenCOLLADAStreamWriter -lMathMLSolver -lGeneratedSaxParser -lUTF -lxml2 -lbuffer -lftoa" )
1063                 #pcre is bundled with openCollada
1064                 #set(PCRE ${LIBDIR}/pcre)
1065                 #set(PCRE_LIBPATH ${PCRE}/lib)
1066                 set(PCRE_LIBRARIES pcre)
1067                 #libxml2 is used
1068                 #set(EXPAT ${LIBDIR}/expat)
1069                 #set(EXPAT_LIBPATH ${EXPAT}/lib)
1070                 set(EXPAT_LIB)
1071         endif()
1072
1073         if(WITH_SDL)
1074                 set(SDL ${LIBDIR}/sdl)
1075                 set(SDL_INCLUDE_DIR ${SDL}/include)
1076                 set(SDL_LIBRARY SDL)
1077                 set(SDL_LIBPATH ${SDL}/lib)
1078         endif()
1079
1080         set(PNG "${LIBDIR}/png")
1081         set(PNG_INCLUDE_DIR "${PNG}/include")
1082         set(PNG_LIBPATH ${PNG}/lib)
1083
1084         set(JPEG "${LIBDIR}/jpeg")
1085         set(JPEG_INCLUDE_DIR "${JPEG}/include")
1086         set(JPEG_LIBPATH ${JPEG}/lib)
1087
1088         if(WITH_IMAGE_TIFF)
1089                 set(TIFF ${LIBDIR}/tiff)
1090                 set(TIFF_INCLUDE_DIR ${TIFF}/include)
1091                 set(TIFF_LIBRARY tiff)
1092                 set(TIFF_LIBPATH ${TIFF}/lib)
1093         endif()
1094
1095         if (WITH_INPUT_NDOF)
1096                 # linker needs "-weak_framework 3DconnexionClient"
1097         endif()
1098
1099         set(EXETYPE MACOSX_BUNDLE)
1100
1101         set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
1102         set(CMAKE_CXX_FLAGS_DEBUG "-fno-strict-aliasing -g")
1103         if(CMAKE_OSX_ARCHITECTURES MATCHES "i386")
1104                 set(CMAKE_CXX_FLAGS_RELEASE "-O3 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -fvariable-expansion-in-unroller")
1105                 set(CMAKE_C_FLAGS_RELEASE "-O3 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -fvariable-expansion-in-unroller")
1106         elseif(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
1107                 set(CMAKE_CXX_FLAGS_RELEASE "-O3 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller")
1108                 set(CMAKE_C_FLAGS_RELEASE "-O3 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller")
1109         else()
1110                 set(CMAKE_C_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
1111                 set(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
1112         endif()
1113 endif()
1114
1115 #-----------------------------------------------------------------------------
1116 # Common.
1117
1118 if(APPLE OR WIN32)
1119         if(NOT EXISTS "${LIBDIR}/")
1120                 message(FATAL_ERROR "Apple and Windows require pre-compiled libs at: '${LIBDIR}'")
1121         endif()
1122 endif()
1123
1124 # See TEST_SSE_SUPPORT() for how this is defined.
1125
1126 if(WITH_RAYOPTIMIZATION)
1127         if(CMAKE_COMPILER_IS_GNUCC)
1128                 set(_sse "-msse")
1129                 set(_sse2 "-msse2")
1130         elseif(MSVC)
1131                 set(_sse "/arch:SSE")
1132                 set(_sse2 "/arch:SSE2")
1133         else()
1134                 message(WARNING "SSE flags for this compiler not known")
1135                 set(_sse)
1136                 set(_sse2)
1137         endif()
1138
1139         if(SUPPORT_SSE_BUILD)
1140                 set(PLATFORM_CFLAGS " ${_sse} ${PLATFORM_CFLAGS}")
1141                 add_definitions(-D__SSE__ -D__MMX__)
1142         endif()
1143         if(SUPPORT_SSE2_BUILD)
1144                 set(PLATFORM_CFLAGS " ${_sse2} ${PLATFORM_CFLAGS}")
1145                 add_definitions(-D__SSE2__)
1146                 if(NOT SUPPORT_SSE_BUILD) # dont double up
1147                         add_definitions(-D__MMX__)
1148                 endif()
1149         endif()
1150         unset(_sse)
1151         unset(_sse2)
1152 endif()
1153
1154
1155 # set the endian define
1156 include(TestBigEndian)
1157 test_big_endian(_SYSTEM_BIG_ENDIAN)
1158 if(_SYSTEM_BIG_ENDIAN)
1159         add_definitions(-D__BIG_ENDIAN__)
1160 else()
1161         add_definitions(-D__LITTLE_ENDIAN__)
1162 endif()
1163 unset(_SYSTEM_BIG_ENDIAN)
1164
1165
1166 if(WITH_IMAGE_OPENJPEG)
1167         if(UNIX AND NOT APPLE)
1168                 # dealt with above
1169         else()
1170                 set(OPENJPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/libopenjpeg")
1171         endif()
1172 endif()
1173
1174 if(WITH_IMAGE_REDCODE)
1175         set(REDCODE ${CMAKE_SOURCE_DIR}/extern)
1176         set(REDCODE_INC ${REDCODE})
1177 endif()
1178
1179 #-----------------------------------------------------------------------------
1180 # Blender WebPlugin
1181
1182 if(WITH_WEBPLUGIN) 
1183         set(GECKO_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
1184         set(WEBPLUGIN_SANDBOX_MODE "apparmor" CACHE STRING "WEB Plugin sandbox mode, can be apparmor, privsep, none")
1185
1186         set(WITH_PLAYER ON)
1187 endif()
1188
1189
1190 #-----------------------------------------------------------------------------
1191 # Configure OpenGL.
1192 find_package(OpenGL)
1193 blender_include_dirs_sys("${OPENGL_INCLUDE_DIR}")
1194 # unset(OPENGL_LIBRARIES CACHE) # not compat with older cmake 
1195 # unset(OPENGL_xmesa_INCLUDE_DIR CACHE) # not compat with older cmake 
1196
1197 #-----------------------------------------------------------------------------
1198 # Configure OpenMP.
1199 if(WITH_OPENMP)
1200         find_package(OpenMP)    
1201         if(OPENMP_FOUND)
1202                 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
1203                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
1204
1205                 if(APPLE AND ${CMAKE_GENERATOR} MATCHES "Xcode")
1206                         set(CMAKE_XCODE_ATTRIBUTE_ENABLE_OPENMP_SUPPORT "YES")
1207                 endif()
1208         else()
1209                 set(WITH_OPENMP OFF)
1210         endif()
1211
1212         mark_as_advanced(OpenMP_C_FLAGS)
1213         mark_as_advanced(OpenMP_CXX_FLAGS)
1214 endif() 
1215
1216 #-----------------------------------------------------------------------------
1217 # Configure GLEW
1218
1219 if(WITH_BUILTIN_GLEW)
1220         # set(GLEW_LIBRARY "")  # unused
1221         set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include")
1222 else()
1223         find_package(GLEW)
1224
1225         if(NOT GLEW_FOUND)
1226                 message(FATAL_ERROR "GLEW is required to build blender, install it or use WITH_BUILTIN_GLEW")
1227         endif()
1228
1229         mark_as_advanced(GLEW_LIBRARY)
1230         mark_as_advanced(GLEW_INCLUDE_PATH)
1231 endif()
1232
1233 #-----------------------------------------------------------------------------
1234 # Configure Python.
1235
1236 if(WITH_PYTHON_MODULE)
1237         add_definitions(-DPy_ENABLE_SHARED)
1238 endif() 
1239
1240 #-----------------------------------------------------------------------------
1241 # Extra compile flags
1242
1243 if((NOT WIN32) AND (NOT MSVC))
1244         # used for internal debug checks
1245         set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
1246         set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
1247         
1248         # assert() checks for this.
1249         set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG")
1250         set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DNDEBUG")
1251         set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG")
1252
1253         set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG")
1254         set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DNDEBUG")
1255         set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DNDEBUG")
1256 endif()
1257
1258 if(CMAKE_COMPILER_IS_GNUCC)
1259
1260         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
1261         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_CAST_ALIGN -Wcast-align)
1262         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_DECLARATION_AFTER_STATEMENT -Werror=declaration-after-statement)
1263         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
1264         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_RETURN_TYPE -Werror=return-type)
1265         # system headers sometimes do this, disable for now, was: -Werror=strict-prototypes
1266         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_STRICT_PROTOTYPES -Wstrict-prototypes)
1267         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
1268         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
1269         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith)
1270         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
1271         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_WRITE_STRINGS -Wwrite-strings)
1272         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNDEFINED -Wundef)
1273         # disable because it gives warnings for printf() & friends.
1274         # ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_DOUBLE_PROMOTION -Wdouble-promotion -Wno-error=double-promotion)
1275         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
1276
1277         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
1278         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
1279         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
1280         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEFINED -Wundef)
1281
1282 elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
1283
1284         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
1285         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith)
1286         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
1287
1288         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
1289         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
1290         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
1291
1292 endif()
1293
1294 # MSVC2010 fails to links C++ libs right
1295 if(MSVC10)
1296         if(WITH_IMAGE_OPENEXR)
1297                 message(WARNING "MSVC 2010 does not support OpenEXR, disabling WITH_IMAGE_OPENEXR. To enable support use Use MSVC 2008")
1298                 set(WITH_IMAGE_OPENEXR OFF)
1299         endif()
1300         if(WITH_OPENCOLLADA)
1301                 message(WARNING "MSVC 2010 does not support OpenCollada, disabling WITH_OPENCOLLADA. To enable support use Use MSVC 2008")
1302                 set(WITH_OPENCOLLADA OFF)
1303         endif()
1304 endif()
1305
1306 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1307         if(WITH_IK_ITASC OR WITH_MOD_FLUID)
1308                 message(WARNING "Using Clang as CXX compiler: disabling WITH_IK_ITASC and WITH_MOD_FLUID, these features will be missing.")
1309                 set(WITH_IK_ITASC OFF)
1310                 set(WITH_MOD_FLUID OFF)
1311         endif()
1312 endif()
1313
1314
1315 # ensure python header is found since detection can fail, this could happen
1316 # with _any_ library but since we used a fixed python version this tends to
1317 # be most problematic.
1318 if(WITH_PYTHON)
1319         if(NOT EXISTS "${PYTHON_INCLUDE_DIR}/Python.h")
1320                 message(FATAL_ERROR "Missing: \"${PYTHON_INCLUDE_DIR}/Python.h\",\n"
1321                                                         "Set the cache entry 'PYTHON_INCLUDE_DIR' to point "
1322                                                         "to a valid python include path. Containing "
1323                                                         "Python.h for python version \"${PYTHON_VERSION}\"")
1324         endif()
1325 endif()
1326
1327
1328 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ${C_WARNINGS}")
1329 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ${CXX_WARNINGS}")
1330
1331 #-------------------------------------------------------------------------------
1332 # Global Defines
1333
1334 # better not set includes here but this debugging option is off by default.
1335 if(WITH_CXX_GUARDEDALLOC)
1336         include_directories(${CMAKE_SOURCE_DIR}/intern/guardedalloc)
1337 endif()
1338
1339 if(WITH_ASSERT_ABORT)
1340         add_definitions(-DWITH_ASSERT_ABORT)
1341 endif()
1342
1343 # message(STATUS "Using CFLAGS: ${CMAKE_C_FLAGS}")
1344 # message(STATUS "Using CXXFLAGS: ${CMAKE_CXX_FLAGS}")
1345
1346 #-----------------------------------------------------------------------------
1347 # Libraries
1348
1349 add_subdirectory(source)
1350 add_subdirectory(intern)
1351 add_subdirectory(extern)
1352
1353
1354 #-----------------------------------------------------------------------------
1355 # Blender Application
1356 if(WITH_BLENDER)
1357         add_subdirectory(source/creator)
1358 endif()
1359
1360
1361 #-----------------------------------------------------------------------------
1362 # Blender Player
1363 if(WITH_PLAYER)
1364         add_subdirectory(source/blenderplayer)
1365 endif()
1366
1367 #-----------------------------------------------------------------------------
1368 # CPack for generating packages
1369 include(build_files/cmake/packaging.cmake)
1370
1371
1372 #-----------------------------------------------------------------------------
1373 # Print Final Configuration
1374
1375 if(FIRST_RUN)
1376         set(_config_msg "\n* Blender Configuration *")
1377         macro(info_cfg_option
1378                 _setting)
1379                 set(_msg "   * ${_setting}")
1380                 string(LENGTH "${_msg}" _len)
1381                 while("28" GREATER "${_len}")
1382                         set(_msg "${_msg} ")
1383                          math(EXPR _len "${_len} + 1")
1384                 endwhile()
1385
1386                 set(_config_msg "${_config_msg}\n${_msg}${${_setting}}")
1387         endmacro()
1388
1389         macro(info_cfg_text
1390                 _text)
1391                 set(_config_msg "${_config_msg}\n\n  ${_text}")
1392                 
1393                 
1394         endmacro()
1395
1396         info_cfg_text("Build Options:")
1397         info_cfg_option(WITH_GAMEENGINE)
1398         info_cfg_option(WITH_PLAYER)
1399         info_cfg_option(WITH_BULLET)
1400         info_cfg_option(WITH_IK_ITASC)
1401         info_cfg_option(WITH_OPENCOLLADA)
1402         info_cfg_option(WITH_FFTW3)
1403         info_cfg_option(WITH_INTERNATIONAL)
1404         info_cfg_option(WITH_INPUT_NDOF)
1405
1406         info_cfg_text("Compiler Options:")
1407         info_cfg_option(WITH_BUILDINFO)
1408         info_cfg_option(WITH_OPENMP)
1409         info_cfg_option(WITH_RAYOPTIMIZATION)
1410
1411         info_cfg_text("System Options:")
1412         info_cfg_option(WITH_INSTALL_PORTABLE)
1413         info_cfg_option(WITH_X11_XINPUT)
1414         info_cfg_option(WITH_BUILTIN_GLEW)
1415
1416         info_cfg_text("Image Formats:")
1417         info_cfg_option(WITH_IMAGE_CINEON)
1418         info_cfg_option(WITH_IMAGE_DDS)
1419         info_cfg_option(WITH_IMAGE_HDR)
1420         info_cfg_option(WITH_IMAGE_OPENEXR)
1421         info_cfg_option(WITH_IMAGE_OPENJPEG)
1422         info_cfg_option(WITH_IMAGE_REDCODE)
1423         info_cfg_option(WITH_IMAGE_TIFF)
1424
1425         info_cfg_text("Audio:")
1426         info_cfg_option(WITH_OPENAL)
1427         info_cfg_option(WITH_SDL)
1428         info_cfg_option(WITH_JACK)
1429         info_cfg_option(WITH_CODEC_FFMPEG)
1430         info_cfg_option(WITH_CODEC_SNDFILE)
1431         info_cfg_option(WITH_SAMPLERATE)
1432
1433         info_cfg_text("Compression:")
1434         info_cfg_option(WITH_LZMA)
1435         info_cfg_option(WITH_LZO)
1436
1437         info_cfg_text("Python:")
1438         info_cfg_option(WITH_PYTHON_INSTALL)
1439         info_cfg_option(WITH_PYTHON_MODULE)
1440         info_cfg_option(WITH_PYTHON_SAFETY)
1441
1442         info_cfg_text("Modifiers:")
1443         info_cfg_option(WITH_MOD_BOOLEAN)
1444         info_cfg_option(WITH_MOD_DECIMATE)
1445         info_cfg_option(WITH_MOD_FLUID)
1446
1447         info_cfg_text("")
1448
1449         message("${_config_msg}")
1450 endif()