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