only use tiff/exr when enabled.
[blender.git] / CMakeLists.txt
1 set(Boost_DEBUG TRUE)
2 # ***** BEGIN GPL LICENSE BLOCK *****
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software Foundation,
16 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 #
18 # The Original Code is Copyright (C) 2006, Blender Foundation
19 # All rights reserved.
20 #
21 # The Original Code is: all of this file.
22 #
23 # Contributor(s): Jacques Beaurain.
24 #
25 # ***** END GPL LICENSE BLOCK *****
26
27 #-----------------------------------------------------------------------------
28 # We don't allow in-source builds. This causes no end of troubles because
29 # all out-of-source builds will use the CMakeCache.txt file there and even
30 # build the libs and objects in it.
31
32 if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
33         if(NOT DEFINED WITH_IN_SOURCE_BUILD)
34                 message(FATAL_ERROR
35                         "CMake generation for blender is not allowed within the source directory!"
36                         "\n Remove the CMakeCache.txt file and try again from another folder, e.g.:"
37                         "\n "
38                         "\n rm CMakeCache.txt"
39                         "\n cd .."
40                         "\n mkdir cmake-make"
41                         "\n cd cmake-make"
42                         "\n cmake ../blender"
43                         "\n "
44                         "\n Alternately define WITH_IN_SOURCE_BUILD to force this option (not recommended!)"
45                 )
46         endif()
47 endif()
48
49 cmake_minimum_required(VERSION 2.8)
50
51 if(NOT EXECUTABLE_OUTPUT_PATH)
52         set(FIRST_RUN "TRUE")
53 endif()
54
55 # this starts out unset
56 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build_files/cmake/Modules")
57
58 # avoid having empty buildtype
59 set(CMAKE_BUILD_TYPE_INIT "Release")
60
61 # quiet output for Makefiles, 'make -s' helps too
62 # set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
63
64 # global compile definitions since add_definitions() adds for all.
65 set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG           DEBUG _DEBUG)
66 set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE         NDEBUG)
67 set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL      NDEBUG)
68 set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO  NDEBUG)
69
70
71 #-----------------------------------------------------------------------------
72 # Set policy
73
74 # see "cmake --help-policy CMP0003"
75 # So library linking is more sane
76 cmake_policy(SET CMP0003 NEW)
77
78 # So BUILDINFO and BLENDERPATH strings are automatically quoted
79 cmake_policy(SET CMP0005 NEW)
80
81 # So syntax problems are errors
82 cmake_policy(SET CMP0010 NEW)
83
84 # Input directories must have CMakeLists.txt
85 cmake_policy(SET CMP0014 NEW)
86
87 #-----------------------------------------------------------------------------
88 # Load some macros.
89 include(build_files/cmake/macros.cmake)
90
91
92 #-----------------------------------------------------------------------------
93 # Initialize project.
94
95 blender_project_hack_pre()
96
97 project(Blender)
98
99 blender_project_hack_post()
100
101 enable_testing()
102
103 #-----------------------------------------------------------------------------
104 # Redirect output files
105
106 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "" FORCE)
107 set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "" FORCE)
108
109 #-----------------------------------------------------------------------------
110 # Set default config options
111
112 get_blender_version()
113
114
115 # Blender internal features
116 option(WITH_BLENDER "Build blender (disable to build only the blender player)" ON)
117 mark_as_advanced(WITH_BLENDER)
118
119 option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
120
121 option(WITH_PYTHON        "Enable Embedded Python API  (only disable for development)" ON)
122 option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default (recommend to leave off)" OFF)
123 mark_as_advanced(WITH_PYTHON)  # dont want people disabling this unless they really know what they are doing.
124 mark_as_advanced(WITH_PYTHON_SECURITY)  # some distrobutions see this as a security issue, rather than have them patch it, make a build option.
125
126 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)
127 option(WITH_PYTHON_MODULE "Enable building as a python module (experimental, only enable for development)" OFF)
128 option(WITH_BUILDINFO     "Include extra build details (only disable for development & faster builds)" ON)
129 option(WITH_IK_ITASC      "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON)
130 option(WITH_FFTW3         "Enable FFTW3 support (Used for smoke and audio effects)" OFF)
131 option(WITH_BULLET        "Enable Bullet (Physics Engine)" ON)
132 option(WITH_GAMEENGINE    "Enable Game Engine" ON)
133 option(WITH_PLAYER        "Build Player" OFF)
134
135 # GHOST Windowing Library Options
136 option(WITH_GHOST_DEBUG   "Enable debugging output for the GHOST library" OFF)
137 mark_as_advanced(WITH_GHOST_DEBUG)
138
139 option(WITH_GHOST_SDL    "Enable building blender against SDL for windowing rather then the native APIs" OFF)
140 mark_as_advanced(WITH_GHOST_SDL)
141
142 # Misc...
143 option(WITH_HEADLESS      "Build without graphical support (renderfarm, server mode only)" OFF)
144 mark_as_advanced(WITH_HEADLESS)
145
146 option(WITH_AUDASPACE    "Build with blenders audio library (only disable if you know what you're doing!)" ON)
147 mark_as_advanced(WITH_AUDASPACE)
148
149
150 # (unix defaults to OpenMP On)
151 if(UNIX AND NOT APPLE)
152         set(PLATFORM_DEFAULT ON)
153 else()
154         set(PLATFORM_DEFAULT OFF)
155 endif()
156 option(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" ${PLATFORM_DEFAULT})
157 unset(PLATFORM_DEFAULT)
158
159
160 if(UNIX AND NOT APPLE)
161         option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)"   ON)
162         option(WITH_X11_XF86VMODE "Enable X11 video mode switching"     ON)
163         option(WITH_BUILTIN_GLEW "Use GLEW OpenGL wrapper library bundled with blender" ON)
164
165         # freebsd doesn't seems to support XDND
166         if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
167                 option(WITH_GHOST_XDND   "Enable drag'n'drop support on Linux using XDND protocol" ON)
168         endif()
169 else()
170         # not an option for other OS's
171         set(WITH_BUILTIN_GLEW ON)
172 endif()
173
174 # Modifiers
175 option(WITH_MOD_FLUID           "Enable Elbeem Modifier (Fluid Simulation)" ON)
176 option(WITH_MOD_SMOKE           "Enable Smoke Modifier (Smoke Simulation)" ON)
177 option(WITH_MOD_DECIMATE        "Enable Decimate Modifier" ON)
178 option(WITH_MOD_BOOLEAN         "Enable Boolean Modifier" ON)
179 option(WITH_MOD_REMESH          "Enable Remesh Modifier" ON)
180 option(WITH_MOD_CLOTH_ELTOPO    "Enable Experimental cloth solver" OFF)
181 mark_as_advanced(WITH_MOD_CLOTH_ELTOPO)
182 option(WITH_MOD_OCEANSIM        "Enable Ocean Modifier" OFF)
183
184 # Image format support
185 option(WITH_IMAGE_OPENEXR       "Enable OpenEXR Support (http://www.openexr.com)" ON)
186 option(WITH_IMAGE_OPENJPEG      "Enable OpenJpeg Support (http://www.openjpeg.org)" ON)
187 option(WITH_IMAGE_TIFF          "Enable LibTIFF Support" ON)
188 option(WITH_IMAGE_DDS           "Enable DDS Image Support" ON)
189 option(WITH_IMAGE_CINEON        "Enable CINEON and DPX Image Support" ON)
190 option(WITH_IMAGE_HDR           "Enable HDR Image Support" ON)
191 option(WITH_IMAGE_REDCODE       "Enable RedCode Image Support" OFF)
192 option(WITH_IMAGE_FRAMESERVER   "Enable image FrameServer Support for rendering" ON)
193
194 # Audio/Video format support
195 option(WITH_CODEC_FFMPEG        "Enable FFMPeg Support (http://ffmpeg.org)" OFF)
196
197 option(WITH_CODEC_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
198 if(APPLE OR (WIN32 AND NOT UNIX))
199         option(WITH_CODEC_QUICKTIME     "Enable Quicktime Support" OFF)
200 endif()
201
202 # 3D format support
203 # disable opencollada on non-apple unix because opencollada has no package for debian
204 option(WITH_OPENCOLLADA         "Enable OpenCollada Support (http://www.opencollada.org)"       OFF)
205
206 # Sound output
207 option(WITH_SDL           "Enable SDL for sound and joystick support" ON)
208 option(WITH_OPENAL        "Enable OpenAL Support (http://www.openal.org)" ON)
209 option(WITH_JACK          "Enable Jack Support (http://www.jackaudio.org)" OFF)
210
211 # Compression
212 option(WITH_LZO           "Enable fast LZO compression (used for pointcache)" ON)
213 option(WITH_LZMA          "Enable best LZMA compression, (used for pointcache)" ON)
214
215 # Camera/motion tracking
216 option(WITH_LIBMV         "Enable libmv structure from motion library" ON)
217
218 # Mesh boolean lib
219 option(WITH_CARVE         "Enable Carve library to handle mesh boolean operations" ON)
220
221 # Misc
222 option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ON)
223 option(WITH_RAYOPTIMIZATION     "Enable use of SIMD (SSE) optimizations for the raytracer" ON)
224 if(UNIX AND NOT APPLE)
225         option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON)
226 endif()
227 option(WITH_PYTHON_INSTALL       "Copy system python into the blender install folder" ON)
228 option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install folder"  ON)
229 set(PYTHON_NUMPY_PATH            "" CACHE PATH "Python to python site-packages or dist-packages containing 'numpy' module")
230 mark_as_advanced(PYTHON_NUMPY_PATH)
231
232 if(MINGW)
233         option(WITH_MINGW64                   "Use the 64-bit version of MinGW" OFF)
234         mark_as_advanced(WITH_MINGW64)
235 endif()
236
237 # Cycles
238 option(WITH_CYCLES                                      "Enable cycles Render Engine" ON)
239 option(WITH_CYCLES_TEST                         "Build cycles test application" OFF)
240 option(WITH_CYCLES_OSL                          "Build Cycles with OSL support" OFF)
241 option(WITH_CYCLES_CUDA_BINARIES        "Build cycles CUDA binaries" OFF)
242 set(CYCLES_CUDA_BINARIES_ARCH sm_13 sm_20 sm_21 CACHE STRING "CUDA architectures to build binaries for")
243 mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
244 unset(PLATFORM_DEFAULT)
245
246 # disable for now, but plan to support on all platforms eventually
247 option(WITH_MEM_JEMALLOC   "Enable malloc replacement (http://www.canonware.com/jemalloc)" OFF)
248 mark_as_advanced(WITH_MEM_JEMALLOC)
249
250 # Debug
251 option(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF)
252 mark_as_advanced(WITH_CXX_GUARDEDALLOC)
253
254 option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" OFF)
255 mark_as_advanced(WITH_ASSERT_ABORT)
256
257
258 if(APPLE)
259         if(NOT CMAKE_OSX_ARCHITECTURES)
260                 set(CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING
261                 "Choose the architecture you want to build Blender for: i386, x86_64 or ppc"
262                 FORCE)
263         endif()
264         
265         execute_process(COMMAND uname -r OUTPUT_VARIABLE MAC_SYS) # check for actual system-version
266         if (${MAC_SYS} MATCHES 11)
267                 set(OSX_SYSTEM 10.7)
268         elseif(${MAC_SYS} MATCHES 10)
269                 set(OSX_SYSTEM 10.6)
270         elseif(${MAC_SYS} MATCHES 9)
271                 set(OSX_SYSTEM 10.5)
272         else()
273                 set(OSX_SYSTEM unsupported)
274         endif()
275         message(STATUS "Detected system-version: " ${OSX_SYSTEM})
276         
277         if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
278                         set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5" CACHE STRING "" FORCE) # 10.5 is our minimum target, if you have higher sdk, weak linking happens
279         endif()
280
281         if(${CMAKE_GENERATOR} MATCHES "Xcode")
282         
283                 ##### workaround for actual official cmake incompatibility with xcode 4.3 ##### 
284                 if(${XCODE_VERSION} MATCHES '') # cmake fails due looking for xcode in the wrong path, thus will be empty var
285                         message("Official cmake does not yet support Xcode 4.3, get a patched version here: http://www.jensverwiebe.de/Blender/CMake%202.8-7patched.zip")
286                 endif()
287                 ### end workaround for actual official cmake incompatibility with xcode 4.3 ### 
288                 
289                 if(${XCODE_VERSION} VERSION_EQUAL 4 OR ${XCODE_VERSION} VERSION_GREATER 4 AND ${XCODE_VERSION} VERSION_LESS 4.3)
290                         # Xcode 4 defaults to the Apple LLVM Compiler.
291                         # Override the default compiler selection because Blender only compiles with gcc up to xcode 4.2
292                         set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42")
293                         message(STATUS "Setting compiler to: " ${CMAKE_XCODE_ATTRIBUTE_GCC_VERSION})
294                 endif()
295         else() # unix makefile generator does not fill XCODE_VERSION var, so we get it with a command
296                 execute_process(COMMAND xcodebuild -version OUTPUT_VARIABLE XCODE_VERS_BUILD_NR)
297                 string(SUBSTRING "${XCODE_VERS_BUILD_NR}" 6 3 XCODE_VERSION) # truncate away build-nr
298                 unset(XCODE_VERS_BUILD_NR)
299         endif()
300         
301         message(STATUS "Detected Xcode-version: " ${XCODE_VERSION})
302         
303         option(WITH_COCOA         "Use Cocoa framework instead of deprecated Carbon" ON)
304         option(USE_QTKIT          "Use QtKit instead of Carbon quicktime (needed for having partial quicktime for 64bit)" OFF)
305         option(WITH_LIBS10.5  "Use 10.5 libs (needed for 64bit builds)" OFF)
306 endif()
307
308
309 #-----------------------------------------------------------------------------
310 # Check for conflicting/unsupported configurations
311
312 if(NOT WITH_BLENDER AND NOT WITH_PLAYER AND NOT WITH_CYCLES_TEST)
313         message(FATAL_ERROR "At least one of WITH_BLENDER or WITH_PLAYER must be enabled, nothing to do!")
314 endif()
315
316 if(NOT WITH_GAMEENGINE AND WITH_PLAYER)
317         message(FATAL_ERROR "WITH_PLAYER requires WITH_GAMEENGINE")
318 endif()
319
320 if(NOT WITH_AUDASPACE AND (WITH_OPENAL OR WITH_SDL OR WITH_JACK OR WITH_GAMEENGINE))
321         message(FATAL_ERROR "WITH_OPENAL/WITH_SDL/WITH_JACK/WITH_CODEC_FFMPEG/WITH_GAMEENGINE require WITH_AUDASPACE")
322 endif()
323
324 if(NOT WITH_SDL AND WITH_GHOST_SDL)
325         message(FATAL_ERROR "WITH_GHOST_SDL requires WITH_SDL to be ON")
326 endif()
327
328 if(WITH_IMAGE_REDCODE AND ((NOT WITH_IMAGE_OPENJPEG) OR (NOT WITH_CODEC_FFMPEG)))
329         message(FATAL_ERROR "WITH_IMAGE_REDCODE requires WITH_IMAGE_OPENJPEG and WITH_CODEC_FFMPEG")
330 endif()
331
332 # python module, needs some different options
333 if(WITH_PYTHON_MODULE AND WITH_PLAYER)
334         message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PLAYER to be OFF")
335 endif()
336
337 if(WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL)
338         message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PYTHON_INSTALL to be OFF")
339 endif()
340
341
342 if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM)
343         message(FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON")
344 endif()
345
346 # may as well build python module without a UI
347 if(WITH_PYTHON_MODULE)
348         set(WITH_HEADLESS ON)
349 endif()
350
351 # auto enable openimageio for cycles
352 if(WITH_CYCLES)
353         set(WITH_OPENIMAGEIO ON)
354 endif()
355
356 # auto enable boost for cycles and carve
357 if(WITH_CYCLES OR WITH_CARVE)
358         set(WITH_BOOST ON)
359 endif()
360
361 # don't store paths to libs for portable distrobution
362 if(WITH_INSTALL_PORTABLE)
363         set(CMAKE_SKIP_BUILD_RPATH TRUE)
364 endif()
365
366 if(WITH_GHOST_SDL OR WITH_HEADLESS)
367         set(WITH_GHOST_XDND OFF)
368 endif()
369
370 if(MINGW)
371         if(WITH_CODEC_QUICKTIME)
372                 message(FATAL_ERROR "MINGW requires WITH_CODEC_QUICKTIME to be OFF "
373                                     "because it is currently unsupported, remove this "
374                                     "line if youre a developer who wants to add support.")
375         endif()
376 endif()
377
378 TEST_SSE_SUPPORT(COMPILER_SSE_FLAG COMPILER_SSE2_FLAG)
379
380
381 #-----------------------------------------------------------------------------
382 # Check for valid directories
383 # ... svn extern paths can be missing because of svn-git.
384
385 if(WITH_INTERNATIONAL)
386         if(NOT EXISTS "${CMAKE_SOURCE_DIR}/release/datafiles/locale")
387                 message(WARNING "Translation path '${CMAKE_SOURCE_DIR}/release/datafiles/locale' is missing, "
388                                                 "This is an 'svn external', which are known not to work with bridges to other version "
389                                                 "control systems, disabling 'WITH_INTERNATIONAL'.")
390                 set(WITH_INTERNATIONAL OFF)
391         endif()
392 endif()
393
394 if(WITH_PYTHON)
395         if(NOT EXISTS "${CMAKE_SOURCE_DIR}/release/scripts/addons")
396                 message(WARNING "Addons path '${CMAKE_SOURCE_DIR}/release/scripts/addons' is missing, "
397                                                 "This is an 'svn external', which are known not to work with bridges to other version "
398                                                 "control systems: * CONTINUING WITHOUT ADDONS *")
399         endif()
400 endif()
401
402 #-----------------------------------------------------------------------------
403 # Initialize un-cached vars, avoid unused warning
404
405 # linux only, not cached
406 set(WITH_BINRELOC OFF)
407
408 # MAXOSX only, set to avoid uninitialized
409 set(EXETYPE "")
410
411 # C/C++ flags
412 set(PLATFORM_CFLAGS)
413
414 # these are added to later on.
415 set(C_WARNINGS)
416 set(CXX_WARNINGS)
417
418 # for gcc -Wno-blah-blah
419 set(CC_REMOVE_STRICT_FLAGS)
420
421 # libraries to link the binary with passed to target_link_libraries()
422 # known as LLIBS to scons
423 set(PLATFORM_LINKLIBS "")
424
425 # Added to linker flags in setup_liblinks
426 # - CMAKE_EXE_LINKER_FLAGS
427 # - CMAKE_EXE_LINKER_FLAGS_DEBUG
428 set(PLATFORM_LINKFLAGS "")
429 set(PLATFORM_LINKFLAGS_DEBUG "")
430
431
432 # disabled for now, not supported
433 # option(WITH_WEBPLUGIN     "Enable Web Plugin (Unix only)" OFF)
434
435 # For alternate Python locations the commandline can be used to override detected/default cache settings, e.g:
436 # On Unix:
437 #   cmake ../blender \
438 #         -D PYTHON_VERSION=3.2 \
439 #         -D PYTHON_INCLUDE_DIR=/opt/py32/include/python3.2d \
440 #         -D PYTHON_LIBRARY=/opt/py32/lib/libpython3.2d.so
441 #
442 # On Macs:
443 #   cmake ../blender \
444 #         -D PYTHON_INCLUDE_DIR=/System/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2 \
445 #         -D PYTHON_LIBPATH=/System/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/config \
446 #         -G Xcode
447 #
448 # When changing any of this remember to update the notes in doc/build_systems/cmake.txt
449
450 #-----------------------------------------------------------------------------
451 #Platform specifics
452
453 if(UNIX AND NOT APPLE)
454
455         # needed for ubuntu 11.04
456         if(EXISTS "/usr/lib/x86_64-linux-gnu")
457                 set(CMAKE_LIBRARY_PATH "/usr/lib/x86_64-linux-gnu;${CMAKE_LIBRARY_PATH}")
458         endif()
459
460         # set lib directory if it exists
461         if(CMAKE_SYSTEM_NAME MATCHES "Linux")
462                 if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
463                         set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/linux64)
464                 else()
465                         set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/linux)
466                 endif()
467
468                 if(NOT EXISTS ${LIBDIR})
469                         unset(LIBDIR)
470                 endif()
471         endif()
472
473         find_package(JPEG REQUIRED)
474         find_package(PNG REQUIRED)
475         find_package(ZLIB REQUIRED)
476         find_package(Freetype REQUIRED)
477
478         if(WITH_PYTHON)
479                 # No way to set py32. remove for now.
480                 # find_package(PythonLibs)
481
482                 # Use our own instead, since wothout py is such a rare case,
483                 # require this package
484                 find_package(PythonLibsUnix REQUIRED)
485         endif()
486
487
488         if(WITH_IMAGE_OPENEXR)
489                 find_package(OpenEXR)  # our own module
490                 if(NOT OPENEXR_FOUND)
491                         set(WITH_IMAGE_OPENEXR OFF)
492                 endif()
493         endif()
494
495         if(WITH_IMAGE_OPENJPEG)
496                 find_package(OpenJPEG)
497                 if(NOT OPENJPEG_FOUND)
498                         set(WITH_IMAGE_OPENJPEG OFF)
499                 endif()
500         endif()
501
502         if(WITH_IMAGE_TIFF)
503                 find_package(TIFF)
504                 if(NOT TIFF_FOUND)
505                         set(WITH_IMAGE_TIFF OFF)
506                 endif()
507         endif()
508
509         # Audio IO
510         if(WITH_OPENAL)
511                 find_package(OpenAL)
512                 if(NOT OPENAL_FOUND)
513                         set(WITH_OPENAL OFF)
514                 endif()
515         endif()
516
517         if(WITH_SDL)
518                 find_package(SDL)
519                 mark_as_advanced(
520                         SDLMAIN_LIBRARY
521                         SDL_INCLUDE_DIR
522                         SDL_LIBRARY
523                         SDL_LIBRARY_TEMP
524                 )
525                 # unset(SDLMAIN_LIBRARY CACHE)
526                 if(NOT SDL_FOUND)
527                         set(WITH_SDL OFF)
528                 endif()
529         endif()
530
531         if(WITH_JACK)
532                 find_package(Jack)
533                 if(NOT JACK_FOUND)
534                         set(WITH_JACK OFF)
535                 endif()
536         endif()
537
538         # Codecs
539         if(WITH_CODEC_SNDFILE)
540                 find_package(SndFile)
541                 if(NOT SNDFILE_FOUND)
542                         set(WITH_CODEC_SNDFILE OFF)
543                 endif()
544         endif()
545
546         if(WITH_CODEC_FFMPEG)
547                 # use lib dir if available and nothing else specified
548                 if(LIBDIR AND NOT FFMPEG)
549                         set(FFMPEG ${LIBDIR}/ffmpeg CACHE PATH "FFMPEG Directory")
550                         # XXX, some distros might need 'theoraenc theoradec' too
551                         set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale dirac_encoder mp3lame ogg orc-0.4 schroedinger-1.0 theora vorbis vorbisenc vpx x264 xvidcore faad asound CACHE STRING "FFMPEG Libraries")
552                 else()
553                         set(FFMPEG /usr CACHE PATH "FFMPEG Directory")
554                         set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
555                 endif()
556
557                 mark_as_advanced(FFMPEG)
558                 set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include ${FFMPEG}/include/ffmpeg)
559                 mark_as_advanced(FFMPEG_LIBRARIES)
560                 set(FFMPEG_LIBPATH ${FFMPEG}/lib)
561                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
562         endif()
563
564         if(WITH_INTERNATIONAL)
565                 find_library(INTL_LIBRARY
566                         NAMES intl
567                         PATHS
568                         /sw/lib
569                 )
570
571                 find_library(ICONV_LIBRARY
572                         NAMES iconv
573                         PATHS
574                         /sw/lib
575                 )
576                 mark_as_advanced(
577                         ICONV_LIBRARY
578                         INTL_LIBRARY
579                 )
580
581                 if(INTL_LIBRARY AND ICONV_LIBRARY)
582                         set(GETTEXT_LIBRARIES ${INTL_LIBRARY} ${ICONV_LIBRARY})
583                 endif()
584         endif()
585
586         if(WITH_FFTW3)
587                 find_package(Fftw3)
588                 if(NOT FFTW3_FOUND)
589                         set(WITH_FFTW3 OFF)
590                 endif()
591         endif()
592
593         if(WITH_OPENCOLLADA)
594                 find_package(OpenCOLLADA)
595                 if(OPENCOLLADA_FOUND)
596                         find_package(XML2)
597                         find_package(PCRE)
598                 else()
599                         set(WITH_OPENCOLLADA OFF)
600                 endif()
601         endif()
602
603         if(WITH_MEM_JEMALLOC)
604                 find_package(JeMalloc)
605                 if(NOT JEMALLOC_FOUND)
606                         set(WITH_MEM_JEMALLOC OFF)
607                 endif()
608         endif()
609
610         if (WITH_INPUT_NDOF)
611                 find_package(Spacenav)
612                 if(NOT SPACENAV_FOUND)
613                         set(WITH_INPUT_NDOF OFF)
614                 endif()
615
616                 # use generic names within blenders buildsystem.
617                 if(SPACENAV_FOUND)
618                         set(NDOF_INCLUDE_DIRS ${SPACENAV_INCLUDE_DIRS})
619                         set(NDOF_LIBRARIES ${SPACENAV_LIBRARIES})
620                 endif()
621         endif()
622
623         if(WITH_BOOST)
624                 # uses in build instructions to override include and library variables
625                 if(NOT BOOST_CUSTOM)
626                         # use lib dir if available and nothing else specified
627                         if(LIBDIR AND NOT BOOST_ROOT)
628                                 set(BOOST_ROOT ${LIBDIR}/boost)
629                                 set(Boost_USE_MULTITHREADED OFF)
630                         else()
631                                 set(Boost_USE_MULTITHREADED ON)
632                         endif()
633                         find_package(Boost 1.34 COMPONENTS filesystem regex system thread)
634                         mark_as_advanced(Boost_DIR)  # why doesnt boost do this?
635                 endif()
636
637                 set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
638                 set(BOOST_LIBRARIES ${Boost_LIBRARIES})
639                 set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS})
640                 set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
641         endif()
642
643         if(WITH_OPENIMAGEIO)
644                 # use lib dir if available and nothing else specified
645                 if(LIBDIR AND NOT OPENIMAGEIO_ROOT_DIR)
646                         set(OPENIMAGEIO_ROOT_DIR ${LIBDIR}/oiio)
647                 endif()
648
649                 find_package(OpenImageIO)
650
651                 set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${ZLIB_LIBRARIES} ${BOOST_LIBRARIES})
652                 set(OPENIMAGEIO_LIBPATH)  # TODO, remove and reference the absolute path everywhere
653                 set(OPENIMAGEIO_DEFINITIONS)
654
655                 if(WITH_IMAGE_TIFF)
656                         set(OPENIMAGEIO_LIBRARIES "${OPENIMAGEIO_LIBRARIES} ${TIFF_LIBRARY}")
657                 endif()
658                 if(WITH_IMAGE_OPENEXR)
659                         set(OPENIMAGEIO_LIBRARIES "${OPENIMAGEIO_LIBRARIES} ${OPENEXR_LIBRARIES}")
660                 endif()
661
662                 if(NOT OPENIMAGEIO_FOUND)
663                         set(WITH_OPENIMAGEIO OFF)
664                         set(WITH_CYCLES OFF)
665                         message(STATUS "OpenImageIO not found, disabling WITH_CYCLES")
666                 endif()
667         endif()
668
669         # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
670         set(PLATFORM_LINKLIBS "-lutil -lc -lm -lpthread -lstdc++")
671
672         if((NOT WITH_HEADLESS) AND (NOT WITH_GHOST_SDL))
673                 find_package(X11 REQUIRED)
674                 find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH})
675                 mark_as_advanced(X11_XF86keysym_INCLUDE_PATH)
676
677                 set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} ${X11_X11_LIB}")
678
679                 if(WITH_X11_XINPUT)
680                         set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} ${X11_Xinput_LIB}")
681                 endif()
682
683                 if(WITH_X11_XF86VMODE)
684                         # XXX, why dont cmake make this available?
685                         FIND_LIBRARY(X11_Xxf86vmode_LIB Xxf86vm   ${X11_LIB_SEARCH_PATH})
686                         mark_as_advanced(X11_Xxf86vmode_LIB)
687                         if(X11_Xxf86vmode_LIB)
688                                 set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} ${X11_Xxf86vmode_LIB}")
689                         else()
690                                 set(WITH_X11_XF86VMODE OFF)
691                         endif()
692                 endif()
693         endif()
694
695         if(CMAKE_SYSTEM_NAME MATCHES "Linux")
696                 if(NOT WITH_PYTHON_MODULE)
697                         # BSD's dont use libdl.so
698                 set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -ldl")
699                         # binreloc is linux only
700                         set(BINRELOC_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/binreloc/include)
701                         set(WITH_BINRELOC ON)
702                 endif()
703         endif()
704
705         set(PLATFORM_LINKFLAGS "-pthread")
706
707         # lfs on glibc, all compilers should use
708         add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
709
710         # GNU Compiler
711         if(CMAKE_COMPILER_IS_GNUCC)
712                 set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
713         # CLang is the same as GCC for now.
714         elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
715                 set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
716         # Solaris CC
717         elseif(CMAKE_CXX_COMPILER_ID MATCHES "SunPro") 
718                 set(PLATFORM_CFLAGS "-pipe -features=extensions -fPIC -D__FUNCTION__=__func__")
719                 
720         # Intel C++ Compiler
721         elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
722                 # think these next two are broken
723                 find_program(XIAR xiar)
724                 if(XIAR)
725                         set(CMAKE_AR "${XIAR}")
726                 endif()
727                 mark_as_advanced(XIAR)
728
729                 find_program(XILD xild)
730                 if(XILD)
731                         set(CMAKE_LINKER "${XILD}")
732                 endif()
733                 mark_as_advanced(XILD)
734
735                 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fp-model precise -prec_div -parallel")
736                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fp-model precise -prec_div -parallel")
737
738                 # set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -diag-enable sc3")
739                 set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
740                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-intel")
741         endif()
742
743 elseif(WIN32)
744
745         # this file is included anyway when building under Windows with cl.exe
746         #  include(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
747
748         if(CMAKE_COMPILER_IS_GNUCC)
749                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32)
750
751                 # Setup 64bit and 64bit windows systems         
752                 if(WITH_MINGW64)
753                         message("Set 64 bit compiler for MinGW.")
754                         set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64)
755                 endif()
756         else()
757                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
758
759                 # Setup 64bit and 64bit windows systems
760                 if(CMAKE_CL_64)
761                         message("64 bit compiler detected.")
762                         set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64)
763                 endif()
764         endif()
765                 
766         add_definitions(-DWIN32)
767
768         if(WITH_INTERNATIONAL)
769                 set(ICONV ${LIBDIR}/iconv)
770                 set(ICONV_INCLUDE_DIRS ${ICONV}/include)
771                 set(ICONV_LIBRARIES iconv)
772                 set(ICONV_LIBPATH ${ICONV}/lib)
773         endif()
774
775         set(JPEG "${LIBDIR}/jpeg")
776         set(JPEG_INCLUDE_DIR "${JPEG}/include")
777         set(JPEG_LIBPATH ${JPEG}/lib) # not cmake defined
778
779         set(WINTAB_INC ${LIBDIR}/wintab/include)
780
781         if(WITH_OPENAL)
782                 set(OPENAL ${LIBDIR}/openal)
783                 set(OPENAL_INCLUDE_DIR ${OPENAL}/include)
784                 set(OPENAL_LIBRARY wrap_oal)
785                 set(OPENAL_LIBPATH ${OPENAL}/lib)
786         endif()
787
788         if(WITH_CODEC_SNDFILE)
789                 set(SNDFILE ${LIBDIR}/sndfile)
790                 set(SNDFILE_INCLUDE_DIRS ${SNDFILE}/include)
791                 set(SNDFILE_LIBRARIES libsndfile-1)
792                 set(SNDFILE_LIBPATH ${SNDFILE}/lib) # TODO, deprecate
793         endif()
794
795         if(WITH_SDL)
796                 set(SDL ${LIBDIR}/sdl)
797                 set(SDL_INCLUDE_DIR ${SDL}/include)
798                 set(SDL_LIBRARY SDL)
799                 set(SDL_LIBPATH ${SDL}/lib)
800         endif()
801
802         if(WITH_CODEC_QUICKTIME)
803                 set(QUICKTIME ${LIBDIR}/QTDevWin)
804                 set(QUICKTIME_INCLUDE_DIRS ${QUICKTIME}/CIncludes)
805                 set(QUICKTIME_LIBRARIES qtmlClient)
806                 set(QUICKTIME_LIBPATH ${QUICKTIME}/Libraries)
807         endif()
808
809         if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
810                 add_definitions(-D__SSE__ -D__MMX__)
811         endif()
812
813         if(MSVC)
814                 set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
815
816                 add_definitions(/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_CONSOLE /D_LIB)
817
818                 set(CMAKE_CXX_FLAGS "/nologo /J /Gd /EHsc" CACHE STRING "MSVC MT C++ flags " FORCE)
819                 set(CMAKE_C_FLAGS   "/nologo /J /Gd"       CACHE STRING "MSVC MT C++ flags " FORCE)
820
821                 if(CMAKE_CL_64)
822                         set(CMAKE_CXX_FLAGS_DEBUG "/Od /Gm /RTC1 /MTd /Zi" CACHE STRING "MSVC MT flags " FORCE)
823                 else()
824                         set(CMAKE_CXX_FLAGS_DEBUG "/Od /Gm /RTC1 /MTd /ZI" CACHE STRING "MSVC MT flags " FORCE)
825                 endif()
826                 set(CMAKE_CXX_FLAGS_RELEASE "/O2 /Ob2 /MT" CACHE STRING "MSVC MT flags " FORCE)
827                 set(CMAKE_CXX_FLAGS_MINSIZEREL "/O1 /Ob1 /MT" CACHE STRING "MSVC MT flags " FORCE)
828                 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /MT /Zi" CACHE STRING "MSVC MT flags " FORCE)
829                 if(CMAKE_CL_64)
830                         set(CMAKE_C_FLAGS_DEBUG "/Od /Gm /RTC1 /MTd /Zi" CACHE STRING "MSVC MT flags " FORCE)
831                 else()
832                         set(CMAKE_C_FLAGS_DEBUG "/Od /Gm /RTC1 /MTd /ZI" CACHE STRING "MSVC MT flags " FORCE)
833                 endif()
834                 set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /MT" CACHE STRING "MSVC MT flags " FORCE)
835                 set(CMAKE_C_FLAGS_MINSIZEREL "/O1 /Ob1 /MT" CACHE STRING "MSVC MT flags " FORCE)
836                 set(CMAKE_C_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /MT /Zi" CACHE STRING "MSVC MT flags " FORCE)
837
838                 # most msvc warnings are C & C++
839                 set(_WARNINGS "/W3 /wd4018 /wd4244 /wd4305 /wd4800 /wd4181 /wd4065 /wd4267 /we4013 /wd4200")
840                 set(C_WARNINGS "${_WARNINGS}")
841                 set(CXX_WARNINGS "${_WARNINGS}")
842                 unset(_WARNINGS)
843
844                 if(WITH_INTERNATIONAL)
845                         set(GETTEXT ${LIBDIR}/gettext)
846                         set(GETTEXT_INCLUDE_DIRS ${GETTEXT}/include)
847                         set(GETTEXT_LIBPATH ${GETTEXT}/lib)
848                         set(GETTEXT_LIBRARIES gnu_gettext)
849                 endif()
850                 
851                 if(WITH_MOD_CLOTH_ELTOPO)
852                         set(LAPACK ${LIBDIR}/lapack)
853                         # set(LAPACK_INCLUDE_DIR ${LAPACK}/include)
854                         set_lib_path(LAPACK_LIBPATH ${LAPACK}/lib)      
855                         set(LAPACK_LIBRARIES
856                                 ${LIBDIR}/lapack/lib/libf2c.lib
857                                 ${LIBDIR}/lapack/lib/clapack_nowrap.lib
858                                 ${LIBDIR}/lapack/lib/BLAS_nowrap.lib
859                         )
860                 endif()
861
862                 set(PNG_LIBRARIES libpng)
863                 set(JPEG_LIBRARIES libjpeg)
864                 
865                 set(PNG "${LIBDIR}/png")
866                 set(PNG_INCLUDE_DIR "${PNG}/include")
867                 set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
868
869                 set(ZLIB_INCLUDE_DIRS ${LIBDIR}/zlib/include)
870                 if(CMAKE_CL_64)
871                         set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/libz.lib)
872                 else()
873                         set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/zlib.lib)
874                 endif()
875
876                 set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include)
877                 set(PTHREADS_LIBRARIES ${LIBDIR}/pthreads/lib/pthreadVC2.lib)
878
879                 set(FREETYPE ${LIBDIR}/freetype)
880                 set(FREETYPE_INCLUDE_DIRS
881                         ${LIBDIR}/freetype/include
882                         ${LIBDIR}/freetype/include/freetype2
883                 )
884                 set(FREETYPE_LIBRARY ${LIBDIR}/freetype/lib/freetype2ST.lib)
885
886                 if(WITH_FFTW3)
887                         set(FFTW3 ${LIBDIR}/fftw3)
888                         set(FFTW3_LIBRARIES libfftw)
889                         set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
890                         set(FFTW3_LIBPATH ${FFTW3}/lib)
891                 endif()
892
893                 if(WITH_OPENCOLLADA)
894
895                         set(OPENCOLLADA_INCLUDE_DIRS
896                                 ${LIBDIR}/opencollada/include/COLLADAStreamWriter/include
897                                 ${LIBDIR}/opencollada/include/COLLADABaseUtils/include
898                                 ${LIBDIR}/opencollada/include/COLLADAFramework/include
899                                 ${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader/include
900                                 ${LIBDIR}/opencollada/include/GeneratedSaxParser/include
901                         )
902                         
903                         set_lib_path(OPENCOLLADA_LIBPATH "opencollada/lib")
904
905                         set(OPENCOLLADA_LIBRARIES
906                                 ${OPENCOLLADA_LIBPATH}/OpenCOLLADASaxFrameworkLoader.lib
907                                 ${OPENCOLLADA_LIBPATH}/OpenCOLLADAFramework.lib
908                                 ${OPENCOLLADA_LIBPATH}/OpenCOLLADABaseUtils.lib
909                                 ${OPENCOLLADA_LIBPATH}/OpenCOLLADAStreamWriter.lib
910                                 ${OPENCOLLADA_LIBPATH}/MathMLSolver.lib
911                                 ${OPENCOLLADA_LIBPATH}/GeneratedSaxParser.lib
912                                 ${OPENCOLLADA_LIBPATH}/xml2.lib
913                                 ${OPENCOLLADA_LIBPATH}/buffer.lib
914                                 ${OPENCOLLADA_LIBPATH}/ftoa.lib
915                                 ${OPENCOLLADA_LIBPATH}/UTF.lib
916                         )
917                         set(PCRE_LIBRARIES
918                                 ${OPENCOLLADA_LIBPATH}/pcre.lib
919                         )
920                         
921                         unset(OPENCOLLADA_LIBPATH)
922                         
923                 endif()
924
925                 if(WITH_CODEC_FFMPEG)
926                         set(FFMPEG_INCLUDE_DIRS
927                                 ${LIBDIR}/ffmpeg/include
928                                 ${LIBDIR}/ffmpeg/include/msvc
929                         )
930                         set(FFMPEG_LIBRARIES
931                                 ${LIBDIR}/ffmpeg/lib/avcodec-53.lib
932                                 ${LIBDIR}/ffmpeg/lib/avformat-53.lib
933                                 ${LIBDIR}/ffmpeg/lib/avdevice-53.lib
934                                 ${LIBDIR}/ffmpeg/lib/avutil-51.lib
935                                 ${LIBDIR}/ffmpeg/lib/swscale-2.lib
936                         )
937                 endif()
938
939                 if(WITH_IMAGE_OPENEXR)
940                         set_lib_path(OPENEXR "openexr")
941                         set_lib_path(OPENEXR_LIBPATH "openexr/lib")
942                         set(OPENEXR_LIBRARIES
943                                 ${OPENEXR_LIBPATH}/Iex.lib
944                                 ${OPENEXR_LIBPATH}/Half.lib
945                                 ${OPENEXR_LIBPATH}/IlmImf.lib
946                                 ${OPENEXR_LIBPATH}/Imath.lib
947                                 ${OPENEXR_LIBPATH}/IlmThread.lib
948                         )
949                         set_lib_path(OPENEXR_INCUDE "openexr/include")
950                         set(OPENEXR_INCLUDE_DIRS
951                                 ${OPENEXR_INCUDE}
952                                 ${OPENEXR_INCUDE}/IlmImf
953                                 ${OPENEXR_INCUDE}/Iex
954                                 ${OPENEXR_INCUDE}/Imath
955                         )
956                         unset(OPENEXR_INCUDE)
957                         unset(OPENEXR_LIBPATH)
958                 endif()
959
960                 if(WITH_IMAGE_TIFF)
961                         set(TIFF_LIBRARY ${LIBDIR}/tiff/lib/libtiff.lib)
962                         set(TIFF_INCLUDE_DIR ${LIBDIR}/tiff/include)
963                 endif()
964
965                 if(WITH_JACK)
966                         set(JACK_INCLUDE_DIRS
967                                 ${LIBDIR}/jack/include/jack
968                                 ${LIBDIR}/jack/include
969                         )
970                         set(JACK_LIBRARIES ${LIBDIR}/jack/lib/libjack.lib)
971                 endif()
972
973                 if(WITH_PYTHON)
974                         # normally cached but not since we include them with blender
975                         set(PYTHON_VERSION 3.2) # CACHE STRING)
976                         set_lib_path(PYTHON_INCLUDE_DIR "python/include/python${PYTHON_VERSION}")
977                         set_lib_path(PYTHON_LIBRARY "python/lib/python32.lib") #CACHE FILEPATH)
978                         
979                         # uncached vars
980                         set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
981                         set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
982                 endif()
983
984                 if(WITH_BOOST)
985                         set(BOOST ${LIBDIR}/boost)
986                         set(BOOST_INCLUDE_DIR ${BOOST}/include)
987                         if(MSVC10)
988                                 set(BOOST_POSTFIX "vc100-mt-s-1_47.lib")
989                                 set(BOOST_DEBUG_POSTFIX "vc100-mt-sgd-1_47.lib")
990                         else()
991                                 set(BOOST_POSTFIX "vc90-mt-s-1_47.lib")
992                                 set(BOOST_DEBUG_POSTFIX "vc90-mt-sgd-1_47.lib")                                 
993                         endif()
994                         set(BOOST_LIBRARIES
995                                 optimized libboost_date_time-${BOOST_POSTFIX} optimized libboost_filesystem-${BOOST_POSTFIX}
996                                 optimized libboost_regex-${BOOST_POSTFIX} optimized libboost_system-${BOOST_POSTFIX} optimized libboost_thread-${BOOST_POSTFIX}
997                                 debug libboost_date_time-${BOOST_DEBUG_POSTFIX} debug libboost_filesystem-${BOOST_DEBUG_POSTFIX}
998                                 debug libboost_regex-${BOOST_DEBUG_POSTFIX} debug libboost_system-${BOOST_DEBUG_POSTFIX} debug libboost_thread-${BOOST_DEBUG_POSTFIX})
999                         if(MSVC10)
1000                                 set(BOOST_LIBPATH ${BOOST}/lib/vc_10)
1001                         else()
1002                                 set(BOOST_LIBPATH ${BOOST}/lib)
1003                         endif()
1004                         set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
1005                 endif()
1006                         
1007                 if(WITH_OPENIMAGEIO)
1008                         set(OPENIMAGEIO ${LIBDIR}/openimageio)
1009                         set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
1010                         set(OPENIMAGEIO_LIBRARIES OpenImageIO)
1011                         set_lib_path(OPENIMAGEIO_LIBPATH "openimageio/lib")
1012                         set(OPENIMAGEIO_DEFINITIONS)
1013                 endif()
1014
1015                 set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib")
1016
1017                 # MSVC only, Mingw doesnt need
1018                 if(CMAKE_CL_64)
1019                         set(PLATFORM_LINKFLAGS "/MACHINE:X64 /OPT:NOREF ${PLATFORM_LINKFLAGS}")
1020                 else()
1021                         set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}")
1022                 endif()
1023
1024                 set(PLATFORM_LINKFLAGS_DEBUG "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
1025
1026                 # used in many places so include globally, like OpenGL
1027                 blender_include_dirs("${PTHREADS_INCLUDE_DIRS}")
1028
1029         elseif(CMAKE_COMPILER_IS_GNUCC)
1030         # keep GCC specific stuff here          
1031                 set(PLATFORM_LINKLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi")
1032                 set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
1033
1034                 if(WITH_MINGW64)
1035                         #We need to take care though not to have these on debug builds because they may play funky with gdb
1036                         if(CMAKE_BUILD_TYPE MATCHES "Release")
1037                                 set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmmx -ftree-vectorize")
1038                         endif()
1039                         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
1040                         set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -lpthread")
1041                         
1042                         add_definitions(-DFREE_WINDOWS64 -DMS_WIN64)
1043                 endif()
1044
1045                 add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
1046
1047
1048                 add_definitions(-DFREE_WINDOWS)
1049
1050                 if(WITH_INTERNATIONAL)
1051                         set(GETTEXT ${LIBDIR}/gettext)
1052                         set(GETTEXT_INCLUDE_DIRS ${GETTEXT}/include)
1053                         set(GETTEXT_LIBPATH ${GETTEXT}/lib)
1054                         set(GETTEXT_LIBRARIES intl)
1055                 endif()
1056                 
1057                 set(PNG "${LIBDIR}/png")
1058                 set(PNG_INCLUDE_DIR "${PNG}/include")
1059                 set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
1060
1061                 if(WITH_MINGW64)
1062                         set(JPEG_LIBRARIES jpeg)
1063                 else()
1064                         set(JPEG_LIBRARIES libjpeg)
1065                 endif()
1066                 set(PNG_LIBRARIES png)
1067
1068                 set(ZLIB ${LIBDIR}/zlib)
1069                 set(ZLIB_INCLUDE_DIRS ${ZLIB}/include)
1070                 set(ZLIB_LIBPATH ${ZLIB}/lib)
1071                 set(ZLIB_LIBRARIES z)
1072
1073                 #comes with own pthread library
1074                 if(NOT WITH_MINGW64)
1075                         set(PTHREADS ${LIBDIR}/pthreads)
1076                         set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include)
1077                         set(PTHREADS_LIBPATH ${PTHREADS}/lib)
1078                         set(PTHREADS_LIBRARIES pthreadGC2)
1079                 endif()
1080                 
1081                 set(FREETYPE ${LIBDIR}/freetype)
1082                 set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
1083                 set(FREETYPE_LIBPATH ${FREETYPE}/lib)
1084                 set(FREETYPE_LIBRARY freetype)
1085
1086                 if(WITH_FFTW3)
1087                         set(FFTW3 ${LIBDIR}/fftw3)
1088                         set(FFTW3_LIBRARIES fftw3)
1089                         set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
1090                         set(FFTW3_LIBPATH ${FFTW3}/lib)
1091                 endif()
1092
1093                 if(WITH_OPENCOLLADA)
1094                         set(OPENCOLLADA ${LIBDIR}/opencollada)
1095                         set(OPENCOLLADA_INCLUDE_DIRS
1096                                 ${LIBDIR}/opencollada/include/COLLADAStreamWriter/include
1097                                 ${LIBDIR}/opencollada/include/COLLADABaseUtils/include
1098                                 ${LIBDIR}/opencollada/include/COLLADAFramework/include
1099                                 ${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader/include
1100                                 ${LIBDIR}/opencollada/include/GeneratedSaxParser/include
1101                         )
1102                         set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib ${OPENCOLLADA}/lib)
1103                         if(WITH_MINGW64)
1104                                 set(OPENCOLLADA_LIBRARIES OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre buffer ftoa xml)
1105                         else()
1106                                 set(OPENCOLLADA_LIBRARIES OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa)
1107                         endif()
1108                         set(PCRE_LIBRARIES pcre)
1109                 endif()
1110
1111                 if(WITH_CODEC_FFMPEG)
1112                         set(FFMPEG ${LIBDIR}/ffmpeg)
1113                         set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
1114                         if(WITH_MINGW64)
1115                                 set(FFMPEG_LIBRARIES avcodec.dll avformat.dll avdevice.dll avutil.dll swscale.dll swresample.dll)
1116                         else()
1117                                 set(FFMPEG_LIBRARIES avcodec-53 avformat-53 avdevice-53 avutil-51 swscale-2)
1118                         endif()
1119                         set(FFMPEG_LIBPATH ${FFMPEG}/lib)
1120                 endif()
1121
1122                 if(WITH_IMAGE_OPENEXR)
1123                         set(OPENEXR ${LIBDIR}/openexr)
1124                         set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
1125                         set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread Iex)
1126                         set(OPENEXR_LIBPATH ${OPENEXR}/lib)
1127                 endif()
1128
1129                 if(WITH_IMAGE_TIFF)
1130                         set(TIFF ${LIBDIR}/tiff)
1131                         set(TIFF_LIBRARY tiff)
1132                         set(TIFF_INCLUDE_DIR ${TIFF}/include)
1133                         set(TIFF_LIBPATH ${TIFF}/lib)
1134                 endif()
1135
1136                 if(WITH_JACK)
1137                         set(JACK ${LIBDIR}/jack)
1138                         set(JACK_INCLUDE_DIRS ${JACK}/include/jack ${JACK}/include)
1139                         set(JACK_LIBRARIES jack)
1140                         set(JACK_LIBPATH ${JACK}/lib)
1141
1142                         # TODO, gives linking errors, force off
1143                         set(WITH_JACK OFF)
1144                 endif()
1145
1146                 if(WITH_PYTHON)
1147                         # normally cached but not since we include them with blender
1148                         set(PYTHON_VERSION 3.2) #  CACHE STRING)
1149                         set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")  # CACHE PATH)
1150                         set(PYTHON_LIBRARY "${LIBDIR}/python/lib/python32mw.lib")  # CACHE FILEPATH)
1151
1152                         # uncached vars
1153                         set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
1154                         set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
1155                 endif()
1156
1157                 if(WITH_BOOST)
1158                         set(BOOST ${LIBDIR}/boost)
1159                         set(BOOST_INCLUDE_DIR ${BOOST}/include)
1160                         if(WITH_MINGW64)
1161                                 set(BOOST_POSTFIX "mgw47-mt-s-1_49")
1162                                 set(BOOST_DEBUG_POSTFIX "mgw47-mt-sd-1_49")
1163                         else()
1164                                 set(BOOST_POSTFIX "mgw46-mt-s-1_47")
1165                                 set(BOOST_DEBUG_POSTFIX "mgw46-mt-sd-1_47")
1166                         endif()         
1167                         set(BOOST_LIBRARIES
1168                                 optimized boost_date_time-${BOOST_POSTFIX} boost_filesystem-${BOOST_POSTFIX}
1169                                 boost_regex-${BOOST_POSTFIX} boost_system-${BOOST_POSTFIX} boost_thread-${BOOST_POSTFIX}
1170                                 debug boost_date_time-${BOOST_DEBUG_POSTFIX} boost_filesystem-${BOOST_DEBUG_POSTFIX}
1171                                 boost_regex-${BOOST_DEBUG_POSTFIX} boost_system-${BOOST_DEBUG_POSTFIX} boost_thread-${BOOST_DEBUG_POSTFIX})
1172                         set(BOOST_LIBPATH ${BOOST}/lib)
1173                         set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB ")
1174                 endif()
1175                         
1176                 if(WITH_OPENIMAGEIO)
1177                         set(OPENIMAGEIO ${LIBDIR}/openimageio)
1178                         set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
1179                         set(OPENIMAGEIO_LIBRARIES OpenImageIO)
1180                         set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
1181                         set(OPENIMAGEIO_DEFINITIONS)
1182                 endif()
1183                 
1184                 set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152")
1185
1186                 ## DISABLE - causes linking errors 
1187                 ## for re-distrobution, so users dont need mingw installed
1188                 # set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-libgcc -static-libstdc++")
1189
1190         endif()
1191
1192 elseif(APPLE)
1193
1194         if(${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.5" OR ${CMAKE_OSX_DEPLOYMENT_TARGET} STRGREATER "10.5")
1195                 set(WITH_LIBS10.5 ON CACHE BOOL "Use 10.5 libs" FORCE) # valid also for 10.6/10.7
1196         endif()
1197
1198         if(${XCODE_VERSION} VERSION_LESS 4.3)
1199                 set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE)  # use guaranteed existing sdk
1200         else()
1201                 # note: i don't use xcode-select path on purpose, cause also /Applications/Xcode.app would be allowed
1202                 # absolute pathes are more foolproof here !
1203                 set(OSX_SYSROOT_PREFIX /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform)
1204                 set(OSX_DEVELOPER_PREFIX /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk) # use guaranteed existing sdk
1205                 set(CMAKE_OSX_SYSROOT ${OSX_SYSROOT_PREFIX}/${OSX_DEVELOPER_PREFIX} CACHE PATH "" FORCE)
1206         endif() 
1207         
1208         if(WITH_LIBS10.5)
1209                 set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
1210         else()
1211                 if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
1212                         set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.x.i386)
1213                 else()
1214                         set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.0.0-powerpc)
1215                 endif()
1216         endif()
1217
1218
1219         if(WITH_OPENAL)
1220                 find_package(OpenAL)
1221                 if(OPENAL_FOUND)
1222                         set(WITH_OPENAL ON)
1223                         set(OPENAL_INCLUDE_DIR "${LIBDIR}/openal/include")
1224                 else()
1225                         set(WITH_OPENAL OFF)
1226                 endif()
1227         endif()
1228
1229         if(WITH_JACK)
1230                 set(JACK /usr)
1231                 set(JACK_INCLUDE_DIRS ${JACK}/include/jack)
1232                 set(JACK_LIBRARIES jack)
1233                 set(JACK_LIBPATH ${JACK}/lib)
1234         endif()
1235
1236         if(WITH_CODEC_SNDFILE)
1237                 set(SNDFILE ${LIBDIR}/sndfile)
1238                 set(SNDFILE_INCLUDE_DIRS ${SNDFILE}/include)
1239                 set(SNDFILE_LIBRARIES sndfile FLAC ogg vorbis vorbisenc)
1240                 set(SNDFILE_LIBPATH ${SNDFILE}/lib ${FFMPEG}/lib)  # TODO, deprecate
1241         endif()
1242
1243         if(WITH_PYTHON)
1244                 if(NOT WITH_PYTHON_MODULE)
1245                         # we use precompiled libraries for py 3.2 and up by default
1246
1247                         # normally cached but not since we include them with blender
1248                         set(PYTHON_VERSION 3.2)
1249                         set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")
1250                         # set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet
1251                         set(PYTHON_LIBRARY python${PYTHON_VERSION})
1252                         set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
1253                         # set(PYTHON_LINKFLAGS "-u _PyMac_Error")  # won't  build with this enabled
1254                 else()
1255                         # module must be compiled against Python framework
1256
1257                         # normally cached but not since we include them with blender
1258                         set(PYTHON_VERSION 3.2)
1259                         set(PYTHON_INCLUDE_DIR "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/include/python${PYTHON_VERSION}m")
1260                         set(PYTHON_BINARY "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/bin/python${PYTHON_VERSION}")
1261                         #set(PYTHON_LIBRARY python${PYTHON_VERSION})
1262                         set(PYTHON_LIBPATH "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config-3.2m")
1263                         #set(PYTHON_LINKFLAGS "-u _PyMac_Error -framework Python")  # won't  build with this enabled
1264                 endif()
1265                 
1266                 # uncached vars
1267                 set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
1268                 set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
1269         endif()
1270
1271         if(WITH_INTERNATIONAL)
1272                 set(GETTEXT ${LIBDIR}/gettext)
1273                 set(GETTEXT_INCLUDE_DIRS "${GETTEXT}/include")
1274                 set(GETTEXT_LIBRARIES intl iconv)
1275                 set(GETTEXT_LIBPATH ${GETTEXT}/lib)
1276         endif()
1277
1278         if(WITH_FFTW3)
1279                 set(FFTW3 ${LIBDIR}/fftw3)
1280                 set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
1281                 set(FFTW3_LIBRARIES fftw3)
1282                 set(FFTW3_LIBPATH ${FFTW3}/lib)
1283         endif()
1284
1285         set(PNG_LIBRARIES png)
1286         set(JPEG_LIBRARIES jpeg)
1287
1288         set(ZLIB /usr)
1289         set(ZLIB_INCLUDE_DIRS "${ZLIB}/include")
1290         set(ZLIB_LIBRARIES z bz2)
1291
1292         set(FREETYPE ${LIBDIR}/freetype)
1293         set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
1294         set(FREETYPE_LIBPATH ${FREETYPE}/lib)
1295         set(FREETYPE_LIBRARY freetype)
1296
1297         if(WITH_IMAGE_OPENEXR)
1298                 set(OPENEXR ${LIBDIR}/openexr)
1299                 set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
1300                 set(OPENEXR_LIBRARIES Iex Half IlmImf Imath IlmThread)
1301                 set(OPENEXR_LIBPATH ${OPENEXR}/lib)
1302         endif()
1303
1304         if(WITH_CODEC_FFMPEG)
1305                 set(FFMPEG ${LIBDIR}/ffmpeg)
1306                 set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
1307                 set(FFMPEG_LIBRARIES avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg)
1308                 set(FFMPEG_LIBPATH ${FFMPEG}/lib)
1309                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
1310         endif()
1311
1312         find_library(SYSTEMSTUBS_LIBRARY
1313                 NAMES
1314                 SystemStubs
1315                 PATHS
1316         )
1317         mark_as_advanced(SYSTEMSTUBS_LIBRARY)
1318         if(SYSTEMSTUBS_LIBRARY)
1319                 set(PLATFORM_LINKLIBS stdc++ SystemStubs)
1320         else()
1321                 set(PLATFORM_LINKLIBS stdc++)
1322         endif()
1323
1324         if(WITH_COCOA)
1325                 set(PLATFORM_CFLAGS "-pipe -funsigned-char -DGHOST_COCOA")
1326                 set(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio")
1327                 if(USE_QTKIT)
1328                         set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DUSE_QTKIT")
1329                         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QTKit")
1330                         if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
1331                                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
1332                                 #libSDL still needs 32bit carbon quicktime
1333                         endif()
1334                 elseif(WITH_CODEC_QUICKTIME)
1335                         set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
1336                 endif()
1337
1338                 # XXX - SOME MAC DEV PLEASE TEST WITH THE SDK INSTALLED!
1339                 # ALSO SHOULD BE MOVED INTO OWN MODULE WHEN FUNCTIONAL
1340                 if(WITH_INPUT_NDOF)
1341                         # This thread it *should* work and check the framework - campbell
1342                         # http://www.cmake.org/pipermail/cmake/2005-December/007740.html
1343                         find_library(3D_CONNEXION_CLIENT_LIBRARY
1344                                 NAMES 3DconnexionClient
1345                         )
1346                         if(NOT 3D_CONNEXION_CLIENT_LIBRARY)
1347                                 set(WITH_INPUT_NDOF OFF)
1348                         endif()
1349
1350                         if(WITH_INPUT_NDOF)
1351                                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -weak_framework 3DconnexionClient")
1352                         endif()
1353                 endif()
1354
1355         else()
1356                 set(PLATFORM_CFLAGS "-pipe -funsigned-char")
1357                 set(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
1358                 set(WITH_INPUT_NDOF OFF)  # unsupported
1359         endif()
1360         
1361         if(WITH_PYTHON_MODULE)
1362                 set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/python")# force cmake to link right framework
1363         endif()
1364         
1365         if(WITH_OPENCOLLADA)
1366                 set(OPENCOLLADA ${LIBDIR}/opencollada)
1367
1368                 set(OPENCOLLADA_INCLUDE_DIRS
1369                         ${LIBDIR}/opencollada/include/COLLADAStreamWriter
1370                         ${LIBDIR}/opencollada/include/COLLADABaseUtils
1371                         ${LIBDIR}/opencollada/include/COLLADAFramework
1372                         ${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader
1373                         ${LIBDIR}/opencollada/include/GeneratedSaxParser
1374                 )
1375
1376                 set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
1377                 set(OPENCOLLADA_LIBRARIES "OpenCOLLADASaxFrameworkLoader -lOpenCOLLADAFramework -lOpenCOLLADABaseUtils -lOpenCOLLADAStreamWriter -lMathMLSolver -lGeneratedSaxParser -lUTF -lxml2 -lbuffer -lftoa")
1378                 #pcre is bundled with openCollada
1379                 #set(PCRE ${LIBDIR}/pcre)
1380                 #set(PCRE_LIBPATH ${PCRE}/lib)
1381                 set(PCRE_LIBRARIES pcre)
1382                 #libxml2 is used
1383                 #set(EXPAT ${LIBDIR}/expat)
1384                 #set(EXPAT_LIBPATH ${EXPAT}/lib)
1385                 set(EXPAT_LIB)
1386         endif()
1387
1388         if(WITH_SDL)
1389                 set(SDL ${LIBDIR}/sdl)
1390                 set(SDL_INCLUDE_DIR ${SDL}/include)
1391                 set(SDL_LIBRARY SDL)
1392                 set(SDL_LIBPATH ${SDL}/lib)
1393         endif()
1394
1395         set(PNG "${LIBDIR}/png")
1396         set(PNG_INCLUDE_DIR "${PNG}/include")
1397         set(PNG_LIBPATH ${PNG}/lib)
1398
1399         set(JPEG "${LIBDIR}/jpeg")
1400         set(JPEG_INCLUDE_DIR "${JPEG}/include")
1401         set(JPEG_LIBPATH ${JPEG}/lib)
1402
1403         if(WITH_IMAGE_TIFF)
1404                 set(TIFF ${LIBDIR}/tiff)
1405                 set(TIFF_INCLUDE_DIR ${TIFF}/include)
1406                 set(TIFF_LIBRARY tiff)
1407                 set(TIFF_LIBPATH ${TIFF}/lib)
1408         endif()
1409
1410         if (WITH_INPUT_NDOF)
1411                 # linker needs "-weak_framework 3DconnexionClient"
1412         endif()
1413
1414         if(WITH_BOOST)
1415                 set(BOOST ${LIBDIR}/boost)
1416                 set(BOOST_INCLUDE_DIR ${BOOST}/include)
1417                 set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt)
1418                 set(BOOST_LIBPATH ${BOOST}/lib)
1419                 set(BOOST_DEFINITIONS)
1420         endif()
1421
1422         if(WITH_OPENIMAGEIO)
1423                 set(OPENIMAGEIO ${LIBDIR}/openimageio)
1424                 set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
1425                 set(OPENIMAGEIO_LIBRARIES OpenImageIO ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES})
1426                 set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib ${JPEG_LIBPATH} ${PNG_LIBPATH} ${TIFF_LIBPATH} ${OPENEXR_LIBPATH} ${ZLIB_LIBPATH})
1427                 set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
1428         endif()
1429
1430         set(EXETYPE MACOSX_BUNDLE)
1431
1432         set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
1433         set(CMAKE_CXX_FLAGS_DEBUG "-fno-strict-aliasing -g")
1434         if(CMAKE_OSX_ARCHITECTURES MATCHES "i386")
1435                 set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -fvariable-expansion-in-unroller")
1436                 set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -fvariable-expansion-in-unroller")
1437         elseif(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
1438                 set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller")
1439                 set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller")
1440         else()
1441                 set(CMAKE_C_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
1442                 set(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
1443         endif()
1444 endif()
1445
1446 #-----------------------------------------------------------------------------
1447 # Common.
1448
1449 if(APPLE OR WIN32)
1450         if(NOT EXISTS "${LIBDIR}/")
1451                 message(FATAL_ERROR "Apple and Windows require pre-compiled libs at: '${LIBDIR}'")
1452         endif()
1453 endif()
1454
1455 # See TEST_SSE_SUPPORT() for how this is defined.
1456
1457 if(WITH_RAYOPTIMIZATION)
1458         if(SUPPORT_SSE_BUILD)
1459                 set(PLATFORM_CFLAGS " ${COMPILER_SSE_FLAG} ${PLATFORM_CFLAGS}")
1460                 add_definitions(-D__SSE__ -D__MMX__)
1461         endif()
1462         if(SUPPORT_SSE2_BUILD)
1463                 set(PLATFORM_CFLAGS " ${COMPILER_SSE2_FLAG} ${PLATFORM_CFLAGS}")
1464                 add_definitions(-D__SSE2__)
1465                 if(NOT SUPPORT_SSE_BUILD) # dont double up
1466                         add_definitions(-D__MMX__)
1467                 endif()
1468         endif()
1469 endif()
1470
1471
1472 # set the endian define
1473 if(MSVC)
1474         # for some reason this fails on msvc
1475         add_definitions(-D__LITTLE_ENDIAN__)
1476 else()
1477         include(TestBigEndian)
1478         test_big_endian(_SYSTEM_BIG_ENDIAN)
1479         if(_SYSTEM_BIG_ENDIAN)
1480                 add_definitions(-D__BIG_ENDIAN__)
1481         else()
1482                 add_definitions(-D__LITTLE_ENDIAN__)
1483         endif()
1484         unset(_SYSTEM_BIG_ENDIAN)
1485 endif()
1486
1487
1488 if(WITH_IMAGE_OPENJPEG)
1489         if(UNIX AND NOT APPLE)
1490                 # dealt with above
1491         else()
1492                 set(OPENJPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/libopenjpeg")
1493         endif()
1494 endif()
1495
1496 if(WITH_IMAGE_REDCODE)
1497         set(REDCODE ${CMAKE_SOURCE_DIR}/extern)
1498         set(REDCODE_INC ${REDCODE})
1499 endif()
1500
1501 #-----------------------------------------------------------------------------
1502 # Blender WebPlugin
1503
1504 if(WITH_WEBPLUGIN)
1505         set(GECKO_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
1506         set(WEBPLUGIN_SANDBOX_MODE "apparmor" CACHE STRING "WEB Plugin sandbox mode, can be apparmor, privsep, none")
1507
1508         set(WITH_PLAYER ON)
1509 endif()
1510
1511
1512 #-----------------------------------------------------------------------------
1513 # Configure OpenGL.
1514 find_package(OpenGL)
1515 blender_include_dirs_sys("${OPENGL_INCLUDE_DIR}")
1516 # unset(OPENGL_LIBRARIES CACHE) # not compat with older cmake
1517 # unset(OPENGL_xmesa_INCLUDE_DIR CACHE) # not compat with older cmake
1518
1519 #-----------------------------------------------------------------------------
1520 # Configure OpenMP.
1521 if(WITH_OPENMP)
1522         find_package(OpenMP)
1523         if(OPENMP_FOUND)
1524                 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
1525                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
1526
1527                 if(APPLE AND ${CMAKE_GENERATOR} MATCHES "Xcode")
1528                         set(CMAKE_XCODE_ATTRIBUTE_ENABLE_OPENMP_SUPPORT "YES")
1529                 endif()
1530         else()
1531                 set(WITH_OPENMP OFF)
1532         endif()
1533
1534         mark_as_advanced(
1535                 OpenMP_C_FLAGS
1536                 OpenMP_CXX_FLAGS
1537         )
1538 endif()
1539
1540 #-----------------------------------------------------------------------------
1541 # Configure GLEW
1542
1543 if(WITH_BUILTIN_GLEW)
1544         # set(GLEW_LIBRARY "")  # unused
1545         set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include")
1546 else()
1547         find_package(GLEW)
1548
1549         if(NOT GLEW_FOUND)
1550                 message(FATAL_ERROR "GLEW is required to build blender, install it or use WITH_BUILTIN_GLEW")
1551         endif()
1552
1553         mark_as_advanced(
1554                 GLEW_LIBRARY
1555                 GLEW_INCLUDE_PATH
1556         )
1557 endif()
1558
1559 #-----------------------------------------------------------------------------
1560 # Configure Python.
1561
1562 if(WITH_PYTHON_MODULE)
1563         add_definitions(-DPy_ENABLE_SHARED)
1564 endif()
1565
1566 #-----------------------------------------------------------------------------
1567 # Extra compile flags
1568
1569 if(CMAKE_COMPILER_IS_GNUCC)
1570
1571         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
1572         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_CAST_ALIGN -Wcast-align)
1573         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_DECLARATION_AFTER_STATEMENT -Werror=declaration-after-statement)
1574         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
1575         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_RETURN_TYPE -Werror=return-type)
1576         # system headers sometimes do this, disable for now, was: -Werror=strict-prototypes
1577         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_STRICT_PROTOTYPES -Wstrict-prototypes)
1578         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
1579         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
1580         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith)
1581         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
1582         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_WRITE_STRINGS -Wwrite-strings)
1583
1584         # # this causes too many warnings, disable
1585         # ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNDEFINED -Wundef)
1586
1587         # disable because it gives warnings for printf() & friends.
1588         # ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_DOUBLE_PROMOTION -Wdouble-promotion -Wno-error=double-promotion)
1589
1590         if(NOT APPLE)
1591                 ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
1592         endif()
1593
1594         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
1595         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
1596         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
1597
1598         # # this causes too many warnings, disable
1599         # ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEFINED -Wundef)
1600
1601         # flags to undo strict flags
1602         ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
1603         ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER        -Wno-unused-parameter)
1604
1605         if(NOT APPLE)
1606                 ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
1607         endif()
1608
1609 elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
1610
1611         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
1612         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith)
1613         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
1614
1615         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
1616         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
1617         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
1618
1619         # disable numbered, false positives
1620         set(C_WARNINGS "${C_WARNINGS} -wd188,186,144,913,556")
1621         set(CXX_WARNINGS "${CXX_WARNINGS} -wd188,186,144,913,556")
1622
1623 endif()
1624
1625 # MSVC2010 fails to links C++ libs right
1626 if(MSVC10)
1627         if(WITH_IMAGE_OPENEXR)
1628                 message(WARNING "MSVC 2010 does not support OpenEXR, disabling WITH_IMAGE_OPENEXR. To enable support use Use MSVC 2008")
1629         endif()
1630         if(WITH_OPENCOLLADA)
1631                 message(WARNING "MSVC 2010 does not support OpenCollada, disabling WITH_OPENCOLLADA. To enable support use Use MSVC 2008")
1632         endif()
1633 endif()
1634
1635 # ensure python header is found since detection can fail, this could happen
1636 # with _any_ library but since we used a fixed python version this tends to
1637 # be most problematic.
1638 if(WITH_PYTHON)
1639         if(NOT EXISTS "${PYTHON_INCLUDE_DIR}/Python.h")
1640                 message(FATAL_ERROR "Missing: \"${PYTHON_INCLUDE_DIR}/Python.h\",\n"
1641                                                         "Set the cache entry 'PYTHON_INCLUDE_DIR' to point "
1642                                                         "to a valid python include path. Containing "
1643                                                         "Python.h for python version \"${PYTHON_VERSION}\"")
1644         endif()
1645
1646         if(WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY)
1647                 # set but invalid
1648                 if(NOT ${PYTHON_NUMPY_PATH} STREQUAL "")
1649                         if(NOT EXISTS "${PYTHON_NUMPY_PATH}/numpy")
1650                                 message(WARNING "PYTHON_NUMPY_PATH is invalid, numpy not found in '${PYTHON_NUMPY_PATH}' "
1651                                                 "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python")
1652                                 set(WITH_PYTHON_INSTALL_NUMPY OFF)
1653                         endif()
1654                 # not set, so initialize
1655                 else()
1656                         string(REPLACE "." ";" _PY_VER_SPLIT "${PYTHON_VERSION}")
1657                         list(GET _PY_VER_SPLIT 0 _PY_VER_MAJOR)
1658
1659                         # re-cache
1660                         unset(PYTHON_NUMPY_PATH CACHE)
1661                         find_path(PYTHON_NUMPY_PATH
1662                           NAMES
1663                             numpy
1664                           HINTS
1665                             "${PYTHON_LIBPATH}/python${PYTHON_VERSION}/"
1666                             "${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/"
1667                           PATH_SUFFIXES
1668                             site-packages
1669                             dist-packages
1670                            NO_DEFAULT_PATH
1671                         )
1672
1673                         if(NOT EXISTS "${PYTHON_NUMPY_PATH}")
1674                                 message(WARNING "'numpy' path could not be found in:\n"
1675                                                 "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/numpy', "
1676                                                 "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/site-packages/numpy', "
1677                                                 "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/dist-packages/numpy', "
1678                                                 "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/dist-packages/numpy', "
1679                                                 "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python")
1680                                 set(WITH_PYTHON_INSTALL_NUMPY OFF)
1681                         else()
1682                                 message(STATUS "numpy found at '${PYTHON_NUMPY_PATH}'")
1683                         endif()
1684
1685                         unset(_PY_VER_SPLIT)
1686                         unset(_PY_VER_MAJOR)
1687                 endif()
1688         endif()
1689 endif()
1690
1691
1692 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ${C_WARNINGS}")
1693 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ${CXX_WARNINGS}")
1694
1695 #-------------------------------------------------------------------------------
1696 # Global Defines
1697
1698 # better not set includes here but this debugging option is off by default.
1699 if(WITH_CXX_GUARDEDALLOC)
1700         include_directories(${CMAKE_SOURCE_DIR}/intern/guardedalloc)
1701 endif()
1702
1703 if(WITH_ASSERT_ABORT)
1704         add_definitions(-DWITH_ASSERT_ABORT)
1705 endif()
1706
1707 # message(STATUS "Using CFLAGS: ${CMAKE_C_FLAGS}")
1708 # message(STATUS "Using CXXFLAGS: ${CMAKE_CXX_FLAGS}")
1709
1710 #-----------------------------------------------------------------------------
1711 # Libraries
1712
1713 add_subdirectory(source)
1714 add_subdirectory(intern)
1715 add_subdirectory(extern)
1716
1717
1718 #-----------------------------------------------------------------------------
1719 # Blender Application
1720 if(WITH_BLENDER)
1721         add_subdirectory(source/creator)
1722 endif()
1723
1724
1725 #-----------------------------------------------------------------------------
1726 # Blender Player
1727 if(WITH_PLAYER)
1728         add_subdirectory(source/blenderplayer)
1729 endif()
1730
1731 #-----------------------------------------------------------------------------
1732 # CPack for generating packages
1733 include(build_files/cmake/packaging.cmake)
1734
1735
1736 #-----------------------------------------------------------------------------
1737 # Print Final Configuration
1738
1739 if(FIRST_RUN)
1740         set(_config_msg "\n* Blender Configuration *")
1741         macro(info_cfg_option
1742                 _setting)
1743                 set(_msg "   * ${_setting}")
1744                 string(LENGTH "${_msg}" _len)
1745                 while("32" GREATER "${_len}")
1746                         set(_msg "${_msg} ")
1747                          math(EXPR _len "${_len} + 1")
1748                 endwhile()
1749
1750                 set(_config_msg "${_config_msg}\n${_msg}${${_setting}}")
1751         endmacro()
1752
1753         macro(info_cfg_text
1754                 _text)
1755                 set(_config_msg "${_config_msg}\n\n  ${_text}")
1756
1757
1758         endmacro()
1759
1760         info_cfg_text("Build Options:")
1761         info_cfg_option(WITH_GAMEENGINE)
1762         info_cfg_option(WITH_PLAYER)
1763         info_cfg_option(WITH_BULLET)
1764         info_cfg_option(WITH_IK_ITASC)
1765         info_cfg_option(WITH_OPENCOLLADA)
1766         info_cfg_option(WITH_FFTW3)
1767         info_cfg_option(WITH_INTERNATIONAL)
1768         info_cfg_option(WITH_INPUT_NDOF)
1769         info_cfg_option(WITH_CYCLES)
1770
1771         info_cfg_text("Compiler Options:")
1772         info_cfg_option(WITH_BUILDINFO)
1773         info_cfg_option(WITH_OPENMP)
1774         info_cfg_option(WITH_RAYOPTIMIZATION)
1775
1776         info_cfg_text("System Options:")
1777         info_cfg_option(WITH_INSTALL_PORTABLE)
1778         info_cfg_option(WITH_X11_XF86VMODE)
1779         info_cfg_option(WITH_X11_XINPUT)
1780         info_cfg_option(WITH_BUILTIN_GLEW)
1781         info_cfg_option(WITH_MEM_JEMALLOC)
1782
1783         info_cfg_text("Image Formats:")
1784         info_cfg_option(WITH_IMAGE_CINEON)
1785         info_cfg_option(WITH_IMAGE_DDS)
1786         info_cfg_option(WITH_IMAGE_HDR)
1787         info_cfg_option(WITH_IMAGE_OPENEXR)
1788         info_cfg_option(WITH_IMAGE_OPENJPEG)
1789         info_cfg_option(WITH_IMAGE_REDCODE)
1790         info_cfg_option(WITH_IMAGE_TIFF)
1791
1792         info_cfg_text("Audio:")
1793         info_cfg_option(WITH_OPENAL)
1794         info_cfg_option(WITH_SDL)
1795         info_cfg_option(WITH_JACK)
1796         info_cfg_option(WITH_CODEC_FFMPEG)
1797         info_cfg_option(WITH_CODEC_SNDFILE)
1798
1799         info_cfg_text("Compression:")
1800         info_cfg_option(WITH_LZMA)
1801         info_cfg_option(WITH_LZO)
1802
1803         info_cfg_text("Python:")
1804         info_cfg_option(WITH_PYTHON_INSTALL)
1805         info_cfg_option(WITH_PYTHON_INSTALL_NUMPY)
1806         info_cfg_option(WITH_PYTHON_MODULE)
1807         info_cfg_option(WITH_PYTHON_SAFETY)
1808
1809         info_cfg_text("Modifiers:")
1810         info_cfg_option(WITH_MOD_BOOLEAN)
1811         info_cfg_option(WITH_MOD_REMESH)
1812         info_cfg_option(WITH_MOD_DECIMATE)
1813         info_cfg_option(WITH_MOD_FLUID)
1814         info_cfg_option(WITH_MOD_OCEANSIM)
1815
1816         info_cfg_text("")
1817
1818         message("${_config_msg}")
1819 endif()