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