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