* Merge trunk up to r39790.
[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         endif()
569
570         if(WITH_SAMPLERATE)
571                 set(SAMPLERATE ${LIBDIR}/samplerate)
572                 set(SAMPLERATE_INCLUDE_DIRS ${SAMPLERATE}/include)
573                 set(SAMPLERATE_LIBRARIES libsamplerate)
574                 set(SAMPLERATE_LIBPATH ${SAMPLERATE}/lib)
575         endif()
576
577         set(PNG "${LIBDIR}/png")
578         set(PNG_INCLUDE_DIR "${PNG}/include")
579         set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
580
581         set(JPEG "${LIBDIR}/jpeg")
582         set(JPEG_INCLUDE_DIR "${JPEG}/include")
583         set(JPEG_LIBPATH ${JPEG}/lib) # not cmake defined
584
585         set(WINTAB_INC ${LIBDIR}/wintab/include) 
586
587         if(WITH_OPENAL)
588                 set(OPENAL ${LIBDIR}/openal)
589                 set(OPENAL_INCLUDE_DIR ${OPENAL}/include)
590                 set(OPENAL_LIBRARY wrap_oal)
591                 set(OPENAL_LIBPATH ${OPENAL}/lib)
592         endif()
593
594         if(WITH_CODEC_SNDFILE)
595                 set(SNDFILE ${LIBDIR}/sndfile)
596                 set(SNDFILE_INCLUDE_DIRS ${SNDFILE}/include)
597                 set(SNDFILE_LIBRARIES libsndfile-1)
598                 set(SNDFILE_LIBPATH ${SNDFILE}/lib) # TODO, deprecate
599         endif()
600
601         if(WITH_SDL)
602                 set(SDL ${LIBDIR}/sdl)
603                 set(SDL_INCLUDE_DIR ${SDL}/include)
604                 set(SDL_LIBRARY SDL)
605                 set(SDL_LIBPATH ${SDL}/lib)
606         endif()
607
608         if(WITH_CODEC_QUICKTIME)
609                 set(QUICKTIME ${LIBDIR}/QTDevWin)
610                 set(QUICKTIME_INCLUDE_DIRS ${QUICKTIME}/CIncludes)
611                 set(QUICKTIME_LIBRARIES qtmlClient)
612                 set(QUICKTIME_LIBPATH ${QUICKTIME}/Libraries)
613         endif()
614
615         if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
616                 add_definitions(-D__SSE__ -D__MMX__)
617         endif()
618
619         if(MSVC)
620                 if(CMAKE_CL_64)
621                         set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
622                 else()
623                         set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
624                 endif()
625
626                 add_definitions(/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_CONSOLE /D_LIB)
627
628                 set(CMAKE_CXX_FLAGS "/nologo /J /W0 /Gd /wd4018 /wd4244 /wd4305 /wd4800 /wd4065 /wd4267 /we4013" CACHE STRING "MSVC MT C++ flags " FORCE)
629                 set(CMAKE_C_FLAGS   "/nologo /J /W0 /Gd /wd4018 /wd4244 /wd4305 /wd4800 /wd4065 /wd4267 /we4013 /EHsc" CACHE STRING "MSVC MT C++ flags " FORCE)
630
631                 if(CMAKE_CL_64)
632                         set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
633                 else()
634                         set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
635                 endif()
636                 set(CMAKE_CXX_FLAGS_RELEASE "/O2 /Ob2 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
637                 set(CMAKE_CXX_FLAGS_MINSIZEREL "/O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
638                 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
639                 if(CMAKE_CL_64)
640                         set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
641                 else()
642                         set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
643                 endif()
644                 set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
645                 set(CMAKE_C_FLAGS_MINSIZEREL "/O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
646                 set(CMAKE_C_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
647
648                 if(WITH_INTERNATIONAL)
649                         set(GETTEXT ${LIBDIR}/gettext)
650                         set(GETTEXT_INC ${GETTEXT}/include)
651                         set(GETTEXT_LIBPATH ${GETTEXT}/lib)
652                         if(CMAKE_CL_64)
653                                 set(GETTEXT_LIB gettext)
654                         else()
655                                 set(GETTEXT_LIB gnu_gettext)
656                         endif()
657                 endif()
658
659                 if(CMAKE_CL_64)
660                         set(PNG_LIBRARIES libpng)
661                 else()
662                         set(PNG_LIBRARIES libpng_st)
663                 endif()
664                 set(JPEG_LIBRARIES libjpeg)
665
666                 set(ZLIB_INCLUDE_DIRS ${LIBDIR}/zlib/include)
667                 if(CMAKE_CL_64)
668                         set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/libz.lib)
669                 else()
670                         set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/zlib.lib)
671                 endif()
672
673                 set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include)
674                 set(PTHREADS_LIBRARIES ${LIBDIR}/pthreads/lib/pthreadVC2.lib)
675
676                 set(FREETYPE ${LIBDIR}/freetype)
677                 set(FREETYPE_INCLUDE_DIRS
678                         ${LIBDIR}/freetype/include
679                         ${LIBDIR}/freetype/include/freetype2
680                 )
681                 set(FREETYPE_LIBRARY ${LIBDIR}/freetype/lib/freetype2ST.lib)
682
683                 if(WITH_FFTW3)
684                         set(FFTW3 ${LIBDIR}/fftw3)
685                         set(FFTW3_LIBRARIES libfftw)
686                         set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
687                         set(FFTW3_LIBPATH ${FFTW3}/lib)
688                 endif()
689
690                 if(WITH_OPENCOLLADA)
691
692                         set(OPENCOLLADA_INCLUDE_DIRS
693                                 ${LIBDIR}/opencollada/include/COLLADAStreamWriter/include
694                                 ${LIBDIR}/opencollada/include/COLLADABaseUtils/include
695                                 ${LIBDIR}/opencollada/include/COLLADAFramework/include
696                                 ${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader/include
697                                 ${LIBDIR}/opencollada/include/GeneratedSaxParser/include                        
698                         )
699
700                         set(OPENCOLLADA_LIBRARIES
701                                 ${LIBDIR}/opencollada/lib/OpenCOLLADASaxFrameworkLoader.lib
702                                 ${LIBDIR}/opencollada/lib/OpenCOLLADAFramework.lib
703                                 ${LIBDIR}/opencollada/lib/OpenCOLLADABaseUtils.lib
704                                 ${LIBDIR}/opencollada/lib/OpenCOLLADAStreamWriter.lib
705                                 ${LIBDIR}/opencollada/lib/MathMLSolver.lib
706                                 ${LIBDIR}/opencollada/lib/GeneratedSaxParser.lib
707                                 ${LIBDIR}/opencollada/lib/xml2.lib
708                                 ${LIBDIR}/opencollada/lib/buffer.lib
709                                 ${LIBDIR}/opencollada/lib/ftoa.lib
710                                 ${LIBDIR}/opencollada/lib/UTF.lib
711                         )
712                         set(PCRE_LIB
713                                 ${LIBDIR}/opencollada/lib/pcre.lib
714                         )
715                 endif()
716
717                 if(WITH_CODEC_FFMPEG)
718                         set(FFMPEG_INCLUDE_DIRS
719                                 ${LIBDIR}/ffmpeg/include
720                                 ${LIBDIR}/ffmpeg/include/msvc
721                         )
722                         set(FFMPEG_LIBRARIES
723                                 ${LIBDIR}/ffmpeg/lib/avcodec-53.lib
724                                 ${LIBDIR}/ffmpeg/lib/avformat-53.lib
725                                 ${LIBDIR}/ffmpeg/lib/avdevice-53.lib
726                                 ${LIBDIR}/ffmpeg/lib/avutil-51.lib
727                                 ${LIBDIR}/ffmpeg/lib/swscale-2.lib
728                         )
729                 endif()
730
731                 if(WITH_IMAGE_OPENEXR)
732                         if(MSVC90)
733                                 set(MSVC_LIB _vs2008)
734                                 set(MSVC_INC)
735                         elseif(MSVC10)
736                                 set(MSVC_LIB _vs2010)
737                                 set(MSVC_INC _vs2010)
738                         else()
739                                 set(MSVC_LIB msvc)
740                                 set(MSVC_INC)
741                         endif()
742                         set(OPENEXR ${LIBDIR}/openexr)
743                         set(OPENEXR_LIBPATH ${OPENEXR}/lib${MSVC_LIB})
744                         set(OPENEXR_LIBRARIES
745                                 ${OPENEXR_LIBPATH}/Iex.lib
746                                 ${OPENEXR_LIBPATH}/Half.lib
747                                 ${OPENEXR_LIBPATH}/IlmImf.lib
748                                 ${OPENEXR_LIBPATH}/Imath.lib
749                                 ${OPENEXR_LIBPATH}/IlmThread.lib
750                         )
751                         set(OPENEXR_INCUDE ${OPENEXR}/include${MSVC_INC})
752                         set(OPENEXR_INCLUDE_DIRS
753                                 ${OPENEXR_INCUDE}
754                                 ${OPENEXR_INCUDE}/IlmImf
755                                 ${OPENEXR_INCUDE}/Iex
756                                 ${OPENEXR_INCUDE}/Imath
757                         )
758                         unset(OPENEXR_INCUDE)
759                         unset(OPENEXR_LIBPATH)
760                 endif()
761
762                 if(WITH_IMAGE_TIFF)
763                         set(TIFF_LIBRARY ${LIBDIR}/tiff/lib/libtiff.lib)
764                         set(TIFF_INCLUDE_DIR ${LIBDIR}/tiff/include)
765                 endif()
766
767                 if(WITH_JACK)
768                         set(JACK_INCLUDE_DIRS
769                                 ${LIBDIR}/jack/include/jack
770                                 ${LIBDIR}/jack/include
771                         )
772                         set(JACK_LIBRARIES ${LIBDIR}/jack/lib/libjack.lib)
773                 endif()
774
775                 if(WITH_PYTHON)
776                         # normally cached but not since we include them with blender
777                         set(PYTHON_VERSION 3.2) # CACHE STRING)
778                         set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}") # CACHE PATH)
779                         set(PYTHON_LIBRARY "${LIBDIR}/python/lib/python32.lib") #CACHE FILEPATH)
780
781                         # uncached vars
782                         set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
783                         set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
784                 endif()
785
786                 set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib")
787
788                 # MSVC only, Mingw doesnt need
789                 if(CMAKE_CL_64)
790                         set(PLATFORM_LINKFLAGS "/MACHINE:X64 /OPT:NOREF ${PLATFORM_LINKFLAGS}")
791                 else()
792                         set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}")
793                 endif()
794
795                 set(PLATFORM_LINKFLAGS_DEBUG "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
796
797         else()
798                 # keep GCC spesific stuff here
799                 if(CMAKE_COMPILER_IS_GNUCC)
800                         set(PLATFORM_LINKLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid")
801                         set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
802
803                         add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
804                 endif()
805
806                 add_definitions(-DFREE_WINDOWS)
807
808                 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
809                 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
810
811                 if(WITH_INTERNATIONAL)
812                         set(GETTEXT ${LIBDIR}/gcc/gettext)
813                         set(GETTEXT_INC ${GETTEXT}/include)
814                         set(GETTEXT_LIBPATH ${GETTEXT}/lib)
815                         set(GETTEXT_LIB intl)
816                 endif()
817
818                 set(JPEG_LIBRARIES libjpeg)
819                 set(PNG_LIBRARIES png)
820
821                 set(ZLIB ${LIBDIR}/zlib)
822                 set(ZLIB_INCLUDE_DIRS ${ZLIB}/include)
823                 set(ZLIB_LIBPATH ${ZLIB}/lib)
824                 set(ZLIB_LIBRARIES z)
825
826                 set(PTHREADS ${LIBDIR}/pthreads)
827                 set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include)
828                 set(PTHREADS_LIBPATH ${PTHREADS}/lib)
829                 set(PTHREADS_LIBRARIES pthreadGC2)
830                 
831                 set(FREETYPE ${LIBDIR}/gcc/freetype)
832                 set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
833                 set(FREETYPE_LIBPATH ${FREETYPE}/lib)
834                 set(FREETYPE_LIBRARY freetype)
835
836                 if(WITH_FFTW3)
837                         set(FFTW3 ${LIBDIR}/gcc/fftw3)
838                         set(FFTW3_LIBRARIES fftw3)
839                         set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
840                         set(FFTW3_LIBPATH ${FFTW3}/lib)
841                 endif()
842
843                 if(WITH_OPENCOLLADA)
844                         set(OPENCOLLADA ${LIBDIR}/gcc/opencollada)
845                         set(OPENCOLLADA_INCLUDE_DIRS
846                                 ${LIBDIR}/gcc/opencollada/include/COLLADAStreamWriter/include
847                                 ${LIBDIR}/gcc/opencollada/include/COLLADABaseUtils/include
848                                 ${LIBDIR}/gcc/opencollada/include/COLLADAFramework/include
849                                 ${LIBDIR}/gcc/opencollada/include/COLLADASaxFrameworkLoader/include
850                                 ${LIBDIR}/gcc/opencollada/include/GeneratedSaxParser/include                    
851                         )
852                         set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib ${OPENCOLLADA}/lib)
853                         set(OPENCOLLADA_LIBRARIES OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa)
854                         set(PCRE_LIB pcre)
855                 endif()
856                 
857                 if(WITH_CODEC_FFMPEG)
858                         set(FFMPEG ${LIBDIR}/ffmpeg)
859                         set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include ${FFMPEG}/include)
860                         set(FFMPEG_LIBRARIES avcodec-53 avformat-53 avdevice-53 avutil-51 swscale-2)
861                         set(FFMPEG_LIBPATH ${FFMPEG}/lib)
862                 endif()
863
864                 if(WITH_IMAGE_OPENEXR)
865                         set(OPENEXR ${LIBDIR}/gcc/openexr)
866                         set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
867                         set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread Iex)
868                         set(OPENEXR_LIBPATH ${OPENEXR}/lib)
869                 endif()
870
871                 if(WITH_IMAGE_TIFF)
872                         set(TIFF ${LIBDIR}/gcc/tiff)
873                         set(TIFF_LIBRARY tiff)
874                         set(TIFF_INCLUDE_DIR ${TIFF}/include)
875                         set(TIFF_LIBPATH ${TIFF}/lib)
876                 endif()
877
878                 if(WITH_JACK)
879                         set(JACK ${LIBDIR}/jack)
880                         set(JACK_INCLUDE_DIRS ${JACK}/include/jack ${JACK}/include)
881                         set(JACK_LIBRARIES jack)
882                         set(JACK_LIBPATH ${JACK}/lib)
883                         
884                         # TODO, gives linking errors, force off
885                         set(WITH_JACK OFF)
886                 endif()
887
888                 if(WITH_PYTHON)
889                         # normally cached but not since we include them with blender
890                         set(PYTHON_VERSION 3.2) #  CACHE STRING)
891                         set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")  # CACHE PATH)
892                         set(PYTHON_LIBRARY "${LIBDIR}/python/lib/python32mw.lib")  # CACHE FILEPATH)
893
894                         # uncached vars
895                         set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
896                         set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
897                 endif()
898
899                 set(PLATFORM_LINKFLAGS "--stack,2097152")
900
901         endif()
902
903         # used in many places so include globally, like OpenGL
904         blender_include_dirs("${PTHREADS_INCLUDE_DIRS}")
905
906 elseif(APPLE)
907
908         if (${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.5")
909                 set(WITH_LIBS10.5 ON CACHE BOOL "Use 10.5 libs" FORCE)
910         endif()
911
912         if(WITH_LIBS10.5)
913                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
914         else()
915                 if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
916                         set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.x.i386)
917                 else()
918                         set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.0.0-powerpc)
919                 endif()
920         endif()
921         
922
923         if(WITH_OPENAL)
924                 find_package(OpenAL)
925                 if(OPENAL_FOUND)
926                         set(WITH_OPENAL ON)
927                         set(OPENAL_INCLUDE_DIR "${LIBDIR}/openal/include")
928                 else()
929                         set(WITH_OPENAL OFF)
930                 endif()
931         endif()
932
933         if(WITH_JACK)
934                 set(JACK /usr)
935                 set(JACK_INCLUDE_DIRS ${JACK}/include/jack)
936                 set(JACK_LIBRARIES jack)
937                 set(JACK_LIBPATH ${JACK}/lib)
938         endif()
939
940         if(WITH_CODEC_SNDFILE)
941                 set(SNDFILE ${LIBDIR}/sndfile)
942                 set(SNDFILE_INCLUDE_DIRS ${SNDFILE}/include)
943                 set(SNDFILE_LIBRARIES sndfile FLAC ogg vorbis vorbisenc)
944                 set(SNDFILE_LIBPATH ${SNDFILE}/lib ${FFMPEG}/lib)  # TODO, deprecate
945         endif()
946
947         if(WITH_PYTHON)
948                 # we use precompiled libraries for py 3.2 and up by default
949
950                 # normally cached but not since we include them with blender
951                 set(PYTHON_VERSION 3.2)
952                 set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")
953                 # set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet
954                 set(PYTHON_LIBRARY python${PYTHON_VERSION})
955                 set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
956                 # set(PYTHON_LINKFLAGS "-u _PyMac_Error")  # won't  build with this enabled
957
958                 # uncached vars
959                 set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
960                 set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
961         endif()
962
963         if(WITH_INTERNATIONAL)
964                 set(GETTEXT ${LIBDIR}/gettext)
965                 set(GETTEXT_INC "${GETTEXT}/include")
966                 set(GETTEXT_LIB intl iconv)
967                 set(GETTEXT_LIBPATH ${GETTEXT}/lib)
968         endif()
969
970         if(WITH_FFTW3)
971                 set(FFTW3 ${LIBDIR}/fftw3)
972                 set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
973                 set(FFTW3_LIBRARIES fftw3)
974                 set(FFTW3_LIBPATH ${FFTW3}/lib)
975         endif()
976
977         set(PNG_LIBRARIES png)
978         set(JPEG_LIBRARIES jpeg)
979
980         set(ZLIB /usr)
981         set(ZLIB_INCLUDE_DIRS "${ZLIB}/include")
982         set(ZLIB_LIBRARIES z bz2)
983
984         set(FREETYPE ${LIBDIR}/freetype)
985         set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
986         set(FREETYPE_LIBPATH ${FREETYPE}/lib)
987         set(FREETYPE_LIBRARY freetype)
988
989         if(WITH_IMAGE_OPENEXR)
990                 set(OPENEXR ${LIBDIR}/openexr)
991                 set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
992                 set(OPENEXR_LIBRARIES Iex Half IlmImf Imath IlmThread)
993                 set(OPENEXR_LIBPATH ${OPENEXR}/lib)
994         endif()
995
996         if(WITH_CODEC_FFMPEG)
997                 set(FFMPEG ${LIBDIR}/ffmpeg)
998                 set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
999                 set(FFMPEG_LIBRARIES avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg)
1000                 set(FFMPEG_LIBPATH ${FFMPEG}/lib)
1001                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
1002         endif()
1003
1004         if(WITH_SAMPLERATE)
1005                 set(SAMPLERATE ${LIBDIR}/samplerate)
1006                 set(SAMPLERATE_INCLUDE_DIRS ${SAMPLERATE}/include)
1007                 set(SAMPLERATE_LIBRARIES samplerate)
1008                 set(SAMPLERATE_LIBPATH ${SAMPLERATE}/lib)
1009         endif()
1010
1011         find_library(SYSTEMSTUBS_LIBRARY 
1012                 NAMES 
1013                 SystemStubs 
1014                 PATHS
1015         )
1016         mark_as_advanced(SYSTEMSTUBS_LIBRARY)
1017         if(SYSTEMSTUBS_LIBRARY)
1018                 set(PLATFORM_LINKLIBS stdc++ SystemStubs)
1019         else()
1020                 set(PLATFORM_LINKLIBS stdc++)
1021         endif()
1022
1023         if(WITH_COCOA)
1024                 set(PLATFORM_CFLAGS "-pipe -funsigned-char -DGHOST_COCOA")
1025                 set(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio")
1026                 if(USE_QTKIT)
1027                         set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DUSE_QTKIT")
1028                         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QTKit")
1029                         if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
1030                                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
1031                                 #libSDL still needs 32bit carbon quicktime 
1032                         endif()
1033                 elseif(WITH_CODEC_QUICKTIME)
1034                         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
1035                 endif()
1036
1037                 # XXX - SOME MAC DEV PLEASE TEST WITH THE SDK INSTALLED! 
1038                 # ALSO SHOULD BE MOVED INTO OWN MODULE WHEN FUNCTIONAL
1039                 if(WITH_INPUT_NDOF)
1040                         # This thread it *should* work and check the framework - campbell
1041                         # http://www.cmake.org/pipermail/cmake/2005-December/007740.html
1042                         find_library(3D_CONNEXION_CLIENT_LIBRARY
1043                                 NAMES 3DconnexionClient
1044                         )
1045                         if(NOT 3D_CONNEXION_CLIENT_LIBRARY)
1046                                 set(WITH_INPUT_NDOF OFF)
1047                         endif()
1048
1049                         if(WITH_INPUT_NDOF)
1050                                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -weak_framework 3DconnexionClient")
1051                         endif()
1052                 endif()
1053
1054         else()
1055                 set(PLATFORM_CFLAGS "-pipe -funsigned-char")
1056                 set(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
1057                 set(WITH_INPUT_NDOF OFF)  # unsupported
1058         endif()
1059
1060         if(WITH_OPENCOLLADA)
1061                 set(OPENCOLLADA ${LIBDIR}/opencollada)
1062
1063                 set(OPENCOLLADA_INCLUDE_DIRS
1064                         ${LIBDIR}/opencollada/include/COLLADAStreamWriter
1065                         ${LIBDIR}/opencollada/include/COLLADABaseUtils
1066                         ${LIBDIR}/opencollada/include/COLLADAFramework
1067                         ${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader
1068                         ${LIBDIR}/opencollada/include/GeneratedSaxParser
1069                 )
1070
1071                 set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
1072                 set(OPENCOLLADA_LIBRARIES "OpenCOLLADASaxFrameworkLoader -lOpenCOLLADAFramework -lOpenCOLLADABaseUtils -lOpenCOLLADAStreamWriter -lMathMLSolver -lGeneratedSaxParser -lUTF -lxml2 -lbuffer -lftoa" )
1073                 #pcre is bundled with openCollada
1074                 #set(PCRE ${LIBDIR}/pcre)
1075                 #set(PCRE_LIBPATH ${PCRE}/lib)
1076                 set(PCRE_LIB pcre)
1077                 #libxml2 is used
1078                 #set(EXPAT ${LIBDIR}/expat)
1079                 #set(EXPAT_LIBPATH ${EXPAT}/lib)
1080                 set(EXPAT_LIB)
1081         endif()
1082
1083         if(WITH_SDL)
1084                 set(SDL ${LIBDIR}/sdl)
1085                 set(SDL_INCLUDE_DIR ${SDL}/include)
1086                 set(SDL_LIBRARY SDL)
1087                 set(SDL_LIBPATH ${SDL}/lib)
1088         endif()
1089
1090         set(PNG "${LIBDIR}/png")
1091         set(PNG_INCLUDE_DIR "${PNG}/include")
1092         set(PNG_LIBPATH ${PNG}/lib)
1093
1094         set(JPEG "${LIBDIR}/jpeg")
1095         set(JPEG_INCLUDE_DIR "${JPEG}/include")
1096         set(JPEG_LIBPATH ${JPEG}/lib)
1097
1098         if(WITH_IMAGE_TIFF)
1099                 set(TIFF ${LIBDIR}/tiff)
1100                 set(TIFF_INCLUDE_DIR ${TIFF}/include)
1101                 set(TIFF_LIBRARY tiff)
1102                 set(TIFF_LIBPATH ${TIFF}/lib)
1103         endif()
1104
1105         if (WITH_INPUT_NDOF)
1106                 # linker needs "-weak_framework 3DconnexionClient"
1107         endif()
1108
1109         set(EXETYPE MACOSX_BUNDLE)
1110
1111         set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
1112         set(CMAKE_CXX_FLAGS_DEBUG "-fno-strict-aliasing -g")
1113         if(CMAKE_OSX_ARCHITECTURES MATCHES "i386")
1114                 set(CMAKE_CXX_FLAGS_RELEASE "-O3 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -fvariable-expansion-in-unroller")
1115                 set(CMAKE_C_FLAGS_RELEASE "-O3 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -fvariable-expansion-in-unroller")
1116         elseif(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
1117                 set(CMAKE_CXX_FLAGS_RELEASE "-O3 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller")
1118                 set(CMAKE_C_FLAGS_RELEASE "-O3 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller")
1119         else()
1120                 set(CMAKE_C_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
1121                 set(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
1122         endif()
1123 endif()
1124
1125 #-----------------------------------------------------------------------------
1126 # Common.
1127
1128 if(APPLE OR WIN32)
1129         if(NOT EXISTS "${LIBDIR}/")
1130                 message(FATAL_ERROR "Apple and Windows require pre-compiled libs at: '${LIBDIR}'")
1131         endif()
1132 endif()
1133
1134 # See TEST_SSE_SUPPORT() for how this is defined.
1135
1136 if(WITH_RAYOPTIMIZATION)
1137         if(CMAKE_COMPILER_IS_GNUCC)
1138                 set(_sse "-msse")
1139                 set(_sse2 "-msse2")
1140         elseif(MSVC)
1141                 set(_sse "/arch:SSE")
1142                 set(_sse2 "/arch:SSE2")
1143         else()
1144                 message(WARNING "SSE flags for this compiler not known")
1145                 set(_sse)
1146                 set(_sse2)
1147         endif()
1148
1149         if(SUPPORT_SSE_BUILD)
1150                 set(PLATFORM_CFLAGS " ${_sse} ${PLATFORM_CFLAGS}")
1151                 add_definitions(-D__SSE__ -D__MMX__)
1152         endif()
1153         if(SUPPORT_SSE2_BUILD)
1154                 set(PLATFORM_CFLAGS " ${_sse2} ${PLATFORM_CFLAGS}")
1155                 add_definitions(-D__SSE2__)
1156                 if(NOT SUPPORT_SSE_BUILD) # dont double up
1157                         add_definitions(-D__MMX__)
1158                 endif()
1159         endif()
1160         unset(_sse)
1161         unset(_sse2)
1162 endif()
1163
1164 if(WITH_IMAGE_OPENJPEG)
1165         if(UNIX AND NOT APPLE)
1166                 # dealt with above
1167         else()
1168                 set(OPENJPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/libopenjpeg")
1169         endif()
1170 endif()
1171
1172 if(WITH_IMAGE_REDCODE)
1173         set(REDCODE ${CMAKE_SOURCE_DIR}/extern)
1174         set(REDCODE_INC ${REDCODE})
1175 endif()
1176
1177 #-----------------------------------------------------------------------------
1178 # Blender WebPlugin
1179
1180 if(WITH_WEBPLUGIN) 
1181         set(GECKO_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
1182         set(WEBPLUGIN_SANDBOX_MODE "apparmor" CACHE STRING "WEB Plugin sandbox mode, can be apparmor, privsep, none")
1183
1184         set(WITH_PLAYER ON)
1185 endif()
1186
1187
1188 #-----------------------------------------------------------------------------
1189 # Configure OpenGL.
1190 find_package(OpenGL)
1191 blender_include_dirs_sys("${OPENGL_INCLUDE_DIR}")
1192 # unset(OPENGL_LIBRARIES CACHE) # not compat with older cmake 
1193 # unset(OPENGL_xmesa_INCLUDE_DIR CACHE) # not compat with older cmake 
1194
1195 #-----------------------------------------------------------------------------
1196 # Configure OpenMP.
1197 if(WITH_OPENMP)
1198         find_package(OpenMP)    
1199         if(OPENMP_FOUND)
1200                 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
1201                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
1202
1203                 if(APPLE AND ${CMAKE_GENERATOR} MATCHES "Xcode")
1204                         set(CMAKE_XCODE_ATTRIBUTE_ENABLE_OPENMP_SUPPORT "YES")
1205                 endif()
1206         else()
1207                 set(WITH_OPENMP OFF)
1208         endif()
1209
1210         mark_as_advanced(OpenMP_C_FLAGS)
1211         mark_as_advanced(OpenMP_CXX_FLAGS)
1212 endif() 
1213
1214 #-----------------------------------------------------------------------------
1215 # Configure GLEW
1216
1217 if(WITH_BUILTIN_GLEW)
1218         # set(GLEW_LIBRARY "")  # unused
1219         set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include")
1220 else()
1221         find_package(GLEW)
1222
1223         if(NOT GLEW_FOUND)
1224                 message(FATAL_ERROR "GLEW is required to build blender, install it or use WITH_BUILTIN_GLEW")
1225         endif()
1226
1227         mark_as_advanced(GLEW_LIBRARY)
1228         mark_as_advanced(GLEW_INCLUDE_PATH)
1229 endif()
1230
1231 #-----------------------------------------------------------------------------
1232 # Configure Python.
1233
1234 if(WITH_PYTHON_MODULE)
1235         add_definitions(-DPy_ENABLE_SHARED)
1236 endif() 
1237
1238 #-----------------------------------------------------------------------------
1239 # Extra compile flags
1240
1241 if((NOT WIN32) AND (NOT MSVC))
1242         # used for internal debug checks
1243         set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
1244         set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
1245         
1246         # assert() checks for this.
1247         set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG")
1248         set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DNDEBUG")
1249         set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG")
1250
1251         set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG")
1252         set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DNDEBUG")
1253         set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DNDEBUG")
1254 endif()
1255
1256 if(CMAKE_COMPILER_IS_GNUCC)
1257
1258         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
1259         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_CAST_ALIGN -Wcast-align)
1260         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_DECLARATION_AFTER_STATEMENT -Werror=declaration-after-statement)
1261         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
1262         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_RETURN_TYPE -Werror=return-type)
1263         # system headers sometimes do this, disable for now, was: -Werror=strict-prototypes
1264         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_STRICT_PROTOTYPES -Wstrict-prototypes)
1265         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
1266         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
1267         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith)
1268         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
1269         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_WRITE_STRINGS -Wwrite-strings)
1270         # disable because it gives warnings for printf() & friends.
1271         # ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_DOUBLE_PROMOTION -Wdouble-promotion -Wno-error=double-promotion)
1272         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
1273
1274         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
1275         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
1276         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
1277
1278 elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
1279
1280         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
1281         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith)
1282         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
1283
1284         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
1285         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
1286         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
1287
1288 endif()
1289
1290 # MSVC2010 fails to links C++ libs right
1291 if(MSVC10)
1292         if(WITH_IMAGE_OPENEXR)
1293                 message(WARNING "MSVC 2010 does not support OpenEXR, disabling WITH_IMAGE_OPENEXR. To enable support use Use MSVC 2008")
1294                 set(WITH_IMAGE_OPENEXR OFF)
1295         endif()
1296         if(WITH_OPENCOLLADA)
1297                 message(WARNING "MSVC 2010 does not support OpenCollada, disabling WITH_OPENCOLLADA. To enable support use Use MSVC 2008")
1298                 set(WITH_OPENCOLLADA OFF)
1299         endif()
1300 endif()
1301
1302 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1303         if(WITH_IK_ITASC OR WITH_MOD_FLUID)
1304                 message(WARNING "Using Clang as CXX compiler: disabling WITH_IK_ITASC and WITH_MOD_FLUID, these features will be missing.")
1305                 set(WITH_IK_ITASC OFF)
1306                 set(WITH_MOD_FLUID OFF)
1307         endif()
1308 endif()
1309
1310
1311 # ensure python header is found since detection can fail, this could happen
1312 # with _any_ library but since we used a fixed python version this tends to
1313 # be most problematic.
1314 if(WITH_PYTHON)
1315         if(NOT EXISTS "${PYTHON_INCLUDE_DIR}/Python.h")
1316                 message(FATAL_ERROR "Missing: \"${PYTHON_INCLUDE_DIR}/Python.h\",\n"
1317                                                         "Set the cache entry 'PYTHON_INCLUDE_DIR' to point "
1318                                                         "to a valid python include path. Containing "
1319                                                         "Python.h for python version \"${PYTHON_VERSION}\"")
1320         endif()
1321 endif()
1322
1323
1324 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ${C_WARNINGS}")
1325 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ${CXX_WARNINGS}")
1326
1327 #-------------------------------------------------------------------------------
1328 # Global Defines
1329
1330 # better not set includes here but this debugging option is off by default.
1331 if(WITH_CXX_GUARDEDALLOC)
1332         include_directories(${CMAKE_SOURCE_DIR}/intern/guardedalloc)
1333 endif()
1334
1335 if(WITH_ASSERT_ABORT)
1336         add_definitions(-DWITH_ASSERT_ABORT)
1337 endif()
1338
1339 # message(STATUS "Using CFLAGS: ${CMAKE_C_FLAGS}")
1340 # message(STATUS "Using CXXFLAGS: ${CMAKE_CXX_FLAGS}")
1341
1342 #-----------------------------------------------------------------------------
1343 # Libraries
1344
1345 add_subdirectory(source)
1346 add_subdirectory(intern)
1347 add_subdirectory(extern)
1348
1349
1350 #-----------------------------------------------------------------------------
1351 # Blender Application
1352 if(WITH_BLENDER)
1353         add_subdirectory(source/creator)
1354 endif()
1355
1356
1357 #-----------------------------------------------------------------------------
1358 # Blender Player
1359 if(WITH_PLAYER)
1360         add_subdirectory(source/blenderplayer)
1361 endif()
1362
1363 #-----------------------------------------------------------------------------
1364 # CPack for generating packages
1365 include(build_files/cmake/packaging.cmake)
1366
1367
1368 #-----------------------------------------------------------------------------
1369 # Print Final Configuration
1370
1371 if(FIRST_RUN)
1372         set(_config_msg "\n* Blender Configuration *")
1373         macro(info_cfg_option
1374                 _setting)
1375                 set(_msg "   * ${_setting}")
1376                 string(LENGTH "${_msg}" _len)
1377                 while("28" GREATER "${_len}")
1378                         set(_msg "${_msg} ")
1379                          math(EXPR _len "${_len} + 1")
1380                 endwhile()
1381
1382                 set(_config_msg "${_config_msg}\n${_msg}${${_setting}}")
1383         endmacro()
1384
1385         macro(info_cfg_text
1386                 _text)
1387                 set(_config_msg "${_config_msg}\n\n  ${_text}")
1388                 
1389                 
1390         endmacro()
1391
1392         info_cfg_text("Build Options:")
1393         info_cfg_option(WITH_GAMEENGINE)
1394         info_cfg_option(WITH_PLAYER)
1395         info_cfg_option(WITH_BULLET)
1396         info_cfg_option(WITH_IK_ITASC)
1397         info_cfg_option(WITH_OPENCOLLADA)
1398         info_cfg_option(WITH_FFTW3)
1399         info_cfg_option(WITH_INTERNATIONAL)
1400         info_cfg_option(WITH_INPUT_NDOF)
1401
1402         info_cfg_text("Compiler Options:")
1403         info_cfg_option(WITH_BUILDINFO)
1404         info_cfg_option(WITH_OPENMP)
1405         info_cfg_option(WITH_RAYOPTIMIZATION)
1406
1407         info_cfg_text("System Options:")
1408         info_cfg_option(WITH_INSTALL_PORTABLE)
1409         info_cfg_option(WITH_X11_XINPUT)
1410         info_cfg_option(WITH_BUILTIN_GLEW)
1411
1412         info_cfg_text("Image Formats:")
1413         info_cfg_option(WITH_IMAGE_CINEON)
1414         info_cfg_option(WITH_IMAGE_DDS)
1415         info_cfg_option(WITH_IMAGE_HDR)
1416         info_cfg_option(WITH_IMAGE_OPENEXR)
1417         info_cfg_option(WITH_IMAGE_OPENJPEG)
1418         info_cfg_option(WITH_IMAGE_REDCODE)
1419         info_cfg_option(WITH_IMAGE_TIFF)
1420
1421         info_cfg_text("Audio:")
1422         info_cfg_option(WITH_OPENAL)
1423         info_cfg_option(WITH_SDL)
1424         info_cfg_option(WITH_JACK)
1425         info_cfg_option(WITH_CODEC_FFMPEG)
1426         info_cfg_option(WITH_CODEC_SNDFILE)
1427         info_cfg_option(WITH_SAMPLERATE)
1428
1429         info_cfg_text("Compression:")
1430         info_cfg_option(WITH_LZMA)
1431         info_cfg_option(WITH_LZO)
1432
1433         info_cfg_text("Python:")
1434         info_cfg_option(WITH_PYTHON_INSTALL)
1435         info_cfg_option(WITH_PYTHON_MODULE)
1436         info_cfg_option(WITH_PYTHON_SAFETY)
1437
1438         info_cfg_text("Modifiers:")
1439         info_cfg_option(WITH_MOD_BOOLEAN)
1440         info_cfg_option(WITH_MOD_DECIMATE)
1441         info_cfg_option(WITH_MOD_FLUID)
1442
1443         info_cfg_text("")
1444
1445         message("${_config_msg}")
1446 endif()