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