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