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