Smoke: decoupling of wavelet #2, new noise strength option on gui, fftw3 option in...
[blender.git] / CMakeLists.txt
1 # $Id$
2 # ***** BEGIN GPL LICENSE BLOCK *****
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software Foundation,
16 # Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17 #
18 # The Original Code is Copyright (C) 2006, Blender Foundation
19 # All rights reserved.
20 #
21 # The Original Code is: all of this file.
22 #
23 # Contributor(s): Jacques Beaurain.
24 #
25 # ***** END GPL LICENSE BLOCK *****
26
27 #-----------------------------------------------------------------------------
28 # We don't allow in-source builds. This causes no end of troubles because 
29 # all out-of-source builds will use the CMakeCache.txt file there and even 
30 # build the libs and objects in it. It will also conflict with the current 
31 # Makefile system for Blender
32
33 IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
34 MESSAGE(FATAL_ERROR "CMake generation for blender is not allowed within the source directory! 
35 Remove the CMakeCache.txt file and try again from another folder, e.g.: 
36
37    rm CMakeCache.txt 
38    cd ..
39    mkdir cmake-make 
40    cd cmake-make
41    cmake -G \"Unix Makefiles\" ../blender
42 ")
43 ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
44
45 CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
46 PROJECT(Blender)
47
48 #-----------------------------------------------------------------------------
49 # Redirect output files
50
51 SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
52 SET(LIBRARY_OUTPUT_PATH  ${CMAKE_BINARY_DIR}/lib)
53
54 #-----------------------------------------------------------------------------
55 # Set default config options
56 OPTION(WITH_PLAYER              "Build Player"                                          OFF)
57 OPTION(WITH_GAMEENGINE          "Enable Game Engine"                                    ON)
58 OPTION(WITH_BULLET              "Enable Bullet (Physics Engine)"                        ON)
59 OPTION(WITH_INTERNATIONAL       "Enable I18N   (International fonts and text)"          ON)
60 OPTION(WITH_ELBEEM              "Enable Elbeem (Fluid Simulation)"                      ON)
61 OPTION(WITH_QUICKTIME           "Enable Quicktime Support"                              OFF)
62 OPTION(WITH_OPENEXR             "Enable OpenEXR Support (http://www.openexr.com)"       ON)
63 OPTION(WITH_DDS                 "Enable DDS Support"                                    ON)
64 OPTION(WITH_FFMPEG              "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)"   OFF)
65 OPTION(WITH_PYTHON              "Enable Embedded Python API"                            ON)
66 OPTION(WITH_SDL                 "Enable SDL for sound and joystick support"                             ON)
67 OPTION(WITH_OPENJPEG            "Enable OpenJpeg Support (http://www.openjpeg.org/)"    OFF)
68 OPTION(WITH_OPENAL              "Enable OpenAL Support (http://www.openal.org)"         ON)
69 OPTION(WITH_OPENMP              "Enable OpenMP (has to be supported by the compiler)"   OFF)
70 OPTION(WITH_WEBPLUGIN           "Enable Web Plugin (Unix only)"                         OFF)
71 OPTION(WITH_FFTW3               "Enable FFTW3 support"                          OFF)
72
73 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
74   MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
75 ENDIF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
76
77 # For alternate Python locations the commandline can be used to override detected/default cache settings, e.g:
78 # On Unix: 
79 #   cmake -D PYTHON_LIB=/usr/local/lib/python2.3/config/libpython2.3.so -D PYTHON_INC=/usr/local/include/python2.3 -D PYTHON_BINARY=/usr/local/bin/python2.3 -G "Unix Makefiles" ../blender
80 # On Macs: 
81 #   cmake -D PYTHON_INC=/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -D PYTHON_LIBPATH=/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/config -D PYTHON_BINARY=/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5 -G Xcode ../blender
82 #
83 # When changing any of this remember to update the notes in doc/blender-cmake.txt
84
85 #-----------------------------------------------------------------------------
86 # Load some macros.
87 INCLUDE(CMake/macros.cmake)
88
89 #-----------------------------------------------------------------------------
90 #Platform specifics
91
92 IF(UNIX AND NOT APPLE)
93   IF(WITH_OPENAL)
94     FIND_PACKAGE(OpenAL)
95     IF(OPENAL_FOUND)
96       SET(WITH_OPENAL ON)
97       SET(OPENAL_LIB ${OPENAL_LIBRARY})
98       SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
99     ELSE(OPENAL_FOUND)
100       SET(WITH_OPENAL OFF)
101     ENDIF(OPENAL_FOUND)
102   ENDIF(WITH_OPENAL)
103
104   FIND_LIBRARY(INTL_LIBRARY
105     NAMES intl
106     PATHS
107     /sw/lib
108   )
109   FIND_LIBRARY(ICONV_LIBRARY
110     NAMES iconv
111     PATHS
112     /sw/lib
113   )
114   IF(INTL_LIBRARY AND ICONV_LIBRARY)
115     SET(GETTEXT_LIB ${INTL_LIBRARY} ${ICONV_LIBRARY})
116   ENDIF(INTL_LIBRARY AND ICONV_LIBRARY)
117   
118   FIND_PATH(FREETYPE_INC
119     freetype
120     PATHS
121     /usr/local/include/freetype2
122     /usr/include/freetype2
123     /sw/include/freetype2
124     /opt/local/include/freetype2
125     /opt/csw/include/freetype2
126     /opt/include/freetype2
127     NO_DEFAULT_PATH
128   )
129   SET(FREETYPE_LIB freetype)
130
131   FIND_PACKAGE(PythonLibs)
132   SET(PYTHON_INC "${PYTHON_INCLUDE_PATH}" CACHE STRING "")
133   SET(PYTHON_LIB "${PYTHON_LIBRARIES}" CACHE STRING "")
134   FIND_PACKAGE(PythonInterp)
135   SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
136   SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic")
137
138   IF(WITH_SDL)
139     FIND_PACKAGE(SDL)
140     SET(SDL_INC ${SDL_INCLUDE_DIR})
141     SET(SDL_LIB ${SDL_LIBRARY})
142   ENDIF(WITH_SDL)
143
144   FIND_PATH(OPENEXR_INC
145     ImfXdr.h
146     PATHS
147     /usr/local/include/OpenEXR
148     /usr/include/OpenEXR
149     /sw/include/OpenEXR
150     /opt/local/include/OpenEXR
151     /opt/csw/include/OpenEXR
152     /opt/include/OpenEXR
153   )
154   SET(OPENEXR_LIB Half IlmImf Iex Imath)
155
156   SET(FFMPEG /usr)
157   SET(FFMPEG_INC ${FFMPEG}/include)
158   SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale)
159   SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
160   
161   IF(WITH_FFTW3)
162           SET(FFTW3 /usr)
163           SET(FFTW3_INC ${FFTW3}/include)
164           SET(FFTW3_LIB fftw3)
165           SET(FFTW3_LIBPATH ${FFTW3}/lib)
166   ENDIF(WITH_FFTW3)
167
168   FIND_PACKAGE(JPEG REQUIRED)
169
170   FIND_PACKAGE(PNG REQUIRED)
171
172   FIND_PACKAGE(ZLIB REQUIRED)
173
174   SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++ -lX11 -ldl")
175
176   IF(WITH_OPENMP)
177     SET(LLIBS "${LLIBS} -lgomp")
178     SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
179     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
180   ENDIF(WITH_OPENMP)
181
182
183   SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -DXP_UNIX -Wno-char-subscripts")
184
185   SET(PLATFORM_LINKFLAGS "-pthread")
186
187   # Better warnings
188   SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wnested-externs -Wdeclaration-after-statement")
189
190   INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
191 ENDIF(UNIX AND NOT APPLE)
192
193 IF(WIN32)
194
195   # this file is included anyway when building under Windows with cl.exe
196   #  INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
197   
198   SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
199
200   # Setup 64bit and 64bit windows systems
201   IF(CMAKE_CL_64)
202     message("64 bit compiler detected.")
203     SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64)
204   ENDIF(CMAKE_CL_64)
205
206   SET(PYTHON ${LIBDIR}/python)
207   SET(PYTHON_VERSION 2.6)
208   SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}")
209   SET(PYTHON_BINARY python)
210   SET(PYTHON_LIB python26)
211   SET(PYTHON_LIBPATH ${PYTHON}/lib)
212
213   IF(CMAKE_CL_64)
214     SET(WITH_OPENAL OFF)
215   ELSE(CMAKE_CL_64)
216     #SET(WITH_OPENAL ON)
217     SET(OPENAL ${LIBDIR}/openal)
218     SET(OPENAL_INC ${OPENAL}/include ${OPENAL}/include/AL)
219     SET(OPENAL_LIB openal_static)
220     SET(OPENAL_LIBPATH ${OPENAL}/lib)
221   ENDIF(CMAKE_CL_64)
222
223   IF(CMAKE_CL_64)
224         SET(PNG_LIBRARIES libpng)
225   ELSE(CMAKE_CL_64)
226     SET(PNG_LIBRARIES libpng_st)
227   ENDIF(CMAKE_CL_64)
228   SET(JPEG_LIBRARY libjpeg)
229
230   SET(ZLIB ${LIBDIR}/zlib)
231   SET(ZLIB_INC ${ZLIB}/include)
232   SET(ZLIB_LIBRARIES zlib)
233   SET(ZLIB_LIBPATH ${ZLIB}/lib)
234   
235   SET(PTHREADS ${LIBDIR}/pthreads)
236   SET(PTHREADS_INC ${PTHREADS}/include)
237   SET(PTHREADS_LIB pthreadVC2)
238   SET(PTHREADS_LIBPATH ${PTHREADS}/lib)
239   
240   SET(ICONV ${LIBDIR}/iconv)
241   SET(ICONV_INC ${ICONV}/include)
242   SET(ICONV_LIB iconv)
243   SET(ICONV_LIBPATH ${ICONV}/lib)
244   
245   IF(WITH_FFTW3)
246           SET(FFTW3 ${LIBDIR}/fftw3)
247           SET(FFTW3_INC ${FFTW3}/include)
248           SET(FFTW3_LIB libfftw)
249           SET(FFTW3_LIBPATH ${FFTW3}/lib)
250   ENDIF(WITH_FFTW3)
251   
252   SET(GETTEXT ${LIBDIR}/gettext)
253   SET(GETTEXT_INC ${GETTEXT}/include)
254   IF(CMAKE_CL_64)
255         SET(GETTEXT_LIB gettextlib)
256   ELSE(CMAKE_CL_64)
257         SET(GETTEXT_LIB gnu_gettext)
258   ENDIF(CMAKE_CL_64)
259   SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
260
261   SET(FREETYPE ${LIBDIR}/freetype)
262   SET(FREETYPE_INC ${FREETYPE}/include ${FREETYPE}/include/freetype2)
263   SET(FREETYPE_LIBPATH ${FREETYPE}/lib)
264   SET(FREETYPE_LIB freetype2ST)
265   
266   SET(OPENEXR ${LIBDIR}/openexr)
267   SET(OPENEXR_INC ${OPENEXR}/include ${OPENEXR}/include/IlmImf ${OPENEXR}/include/Iex ${OPENEXR}/include/Imath)
268   SET(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
269   IF (MSVC80)
270   SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2005)
271   ELSE (MSVC80)
272   SET(OPENEXR_LIBPATH ${OPENEXR}/lib_msvc)
273   ENDIF(MSVC80)
274   IF (MSVC90)
275   SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2008)
276   ENDIF(MSVC90)
277
278   
279   SET(QUICKTIME ${LIBDIR}/QTDevWin)
280   SET(QUICKTIME_INC ${QUICKTIME}/CIncludes)
281   SET(QUICKTIME_LIB qtmlClient)
282   SET(QUICKTIME_LIBPATH ${QUICKTIME}/Libraries)
283
284   SET(FFMPEG ${LIBDIR}/ffmpeg)
285   SET(FFMPEG_INC ${FFMPEG}/include)
286   SET(FFMPEG_LIB avcodec-52 avformat-52 avdevice-52 avutil-50 swscale-0)
287   SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
288
289   IF(CMAKE_CL_64)
290   SET(LLIBS kernel32 user32 vfw32 winmm ws2_32 )
291   ELSE(CMAKE_CL_64)
292   SET(LLIBS kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid ws2_32 vfw32 winmm)
293   ENDIF(CMAKE_CL_64)
294   
295   IF(WITH_OPENAL)
296     SET(LLIBS ${LLIBS} dxguid)
297   ENDIF(WITH_OPENAL)
298
299   SET(CMAKE_CXX_FLAGS_DEBUG "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
300   SET(CMAKE_CXX_FLAGS_RELEASE "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob2 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
301   SET(CMAKE_CXX_FLAGS_MINSIZEREL "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
302   SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
303   SET(CMAKE_C_FLAGS_DEBUG "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
304   SET(CMAKE_C_FLAGS_RELEASE "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob2 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
305   SET(CMAKE_C_FLAGS_MINSIZEREL "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
306   SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
307
308   IF(WITH_OPENMP)
309     SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /openmp ")
310     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp ")
311   ENDIF(WITH_OPENMP)
312
313   SET(SDL ${LIBDIR}/sdl)
314   SET(SDL_INC ${SDL}/include)
315   SET(SDL_LIB SDL)
316   SET(SDL_LIBPATH ${SDL}/lib)
317
318   SET(PNG "${LIBDIR}/png")
319   SET(PNG_INC "${PNG}/include")
320   SET(PNG_LIBPATH ${PNG}/lib)
321
322   SET(JPEG "${LIBDIR}/jpeg")
323   SET(JPEG_INC "${JPEG}/include")
324   SET(JPEG_LIBPATH ${JPEG}/lib)
325
326   SET(TIFF ${LIBDIR}/tiff)
327   SET(TIFF_INC ${TIFF}/include)
328   
329   SET(WINTAB_INC ${LIBDIR}/wintab/include) 
330
331   IF(CMAKE_CL_64)
332   SET(PLATFORM_LINKFLAGS "/MANIFEST:NO /MANIFESTUAC:NO /MACHINE:X64 /NODEFAULTLIB:libc.lib;MSVCRT.lib ")
333   ELSE(CMAKE_CL_64)
334   SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib ")
335   ENDIF(CMAKE_CL_64)
336   SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ")
337 ENDIF(WIN32)
338
339 IF(APPLE)
340   IF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
341     SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.x.i386)
342   ELSE(CMAKE_OSX_ARCHITECTURES MATCHES i386)
343     SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-6.1-powerpc)
344   ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
345
346   IF(WITH_OPENAL)
347     FIND_PACKAGE(OpenAL)
348     IF(OPENAL_FOUND)
349       SET(WITH_OPENAL ON)
350       SET(OPENAL_LIB ${OPENAL_LIBRARY})
351       SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
352     ELSE(OPENAL_FOUND)
353       SET(WITH_OPENAL OFF)
354     ENDIF(OPENAL_FOUND)
355   ENDIF(WITH_OPENAL)
356
357
358   SET(PYTHON_VERSION 3.1)
359
360   IF(PYTHON_VERSION MATCHES 3.1)
361     # we use precompiled libraries for py 3.1 and up by default
362
363     SET(PYTHON ${LIBDIR}/python)
364     SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "")
365     SET(PYTHON_BINARY "${PYTHON}/bin/python${PYTHON_VERSION}" CACHE STRING "")
366     SET(PYTHON_LIB python${PYTHON_VERSION})
367     SET(PYTHON_LIBPATH "${PYTHON}/lib/python${PYTHON_VERSION}" CACHE STRING "")
368     #    SET(PYTHON_LINKFLAGS "-u _PyMac_Error")  # won't  build with this enabled
369   ELSE(PYTHON_VERSION MATCHES 3.1)
370     # otherwise, use custom system framework
371
372     SET(PYTHON /System/Library/Frameworks/Python.framework/Versions/)
373     SET(PYTHON_VERSION 2.5)
374     SET(PYTHON_INC "${PYTHON}${PYTHON_VERSION}/include/python${PYTHON_VERSION}" CACHE STRING "")
375     SET(PYTHON_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION} CACHE STRING "")
376     SET(PYTHON_LIB "")
377     SET(PYTHON_LIBPATH ${PYTHON}${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config CACHE STRING "")
378     SET(PYTHON_LINKFLAGS "-u _PyMac_Error -framework System -framework Python")
379   ENDIF(PYTHON_VERSION MATCHES 3.1)
380
381   SET(GETTEXT ${LIBDIR}/gettext)
382   SET(GETTEXT_INC "${GETTEXT}/include")
383   SET(GETTEXT_LIB intl iconv)
384   SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
385   
386   IF(WITH_FFTW3)
387     SET(FFTW3 ${LIBDIR}/fftw3)
388         SET(FFTW3_INC ${FFTW3}/include)
389         SET(FFTW3_LIB libfftw)
390         SET(FFTW3_LIBPATH ${FFTW3}/lib)
391   ENDIF(WITH_FFTW3)
392
393   SET(PNG_LIBRARIES png)
394   SET(JPEG_LIBRARY jpeg)
395
396   SET(ZLIB /usr)
397   SET(ZLIB_INC "${ZLIB}/include")
398   SET(ZLIB_LIBRARIES z)
399
400   SET(FREETYPE ${LIBDIR}/freetype)
401   SET(FREETYPE_INC ${FREETYPE}/include ${FREETYPE}/include/freetype2)
402   SET(FREETYPE_LIBPATH ${FREETYPE}/lib)
403   SET(FREETYPE_LIB freetype)
404
405   SET(OPENEXR ${LIBDIR}/openexr)
406   SET(OPENEXR_INC ${OPENEXR}/include/OpenEXR ${OPENEXR}/include)
407   SET(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
408   SET(OPENEXR_LIBPATH ${OPENEXR}/lib)
409
410   SET(LLIBS stdc++ SystemStubs)
411
412   SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
413   SET(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
414
415   IF(WITH_OPENMP)
416     SET(LLIBS "${LLIBS} -lgomp ")
417     SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp ")
418     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp ")
419   ENDIF(WITH_OPENMP)
420
421   SET(SDL ${LIBDIR}/sdl)
422   SET(SDL_INC ${SDL}/include)
423   SET(SDL_LIB SDL)
424   SET(SDL_LIBPATH ${SDL}/lib)
425
426   SET(PNG "${LIBDIR}/png")
427   SET(PNG_INC "${PNG}/include")
428   SET(PNG_LIBPATH ${PNG}/lib)
429
430   SET(JPEG "${LIBDIR}/jpeg")
431   SET(JPEG_INC "${JPEG}/include")
432   SET(JPEG_LIBPATH ${JPEG}/lib)
433
434   SET(TIFF ${LIBDIR}/tiff)
435   SET(TIFF_INC ${TIFF}/include)
436
437   SET(EXETYPE MACOSX_BUNDLE)
438 ENDIF(APPLE)
439
440 IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
441   SET(BINRELOC ${CMAKE_SOURCE_DIR}/extern/binreloc)
442   SET(BINRELOC_INC ${BINRELOC}/include)
443 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
444
445 #-----------------------------------------------------------------------------
446 # Common.
447
448 set(OPENJPEG ${CMAKE_SOURCE_DIR}/extern/libopenjpeg)
449 set(OPENJPEG_INC ${OPENJPEG})
450 set(OPENJPEG_LIb extern_libopenjpeg)
451
452 #-----------------------------------------------------------------------------
453 # Blender WebPlugin
454
455 IF(WITH_WEBPLUGIN) 
456   SET(GECKO_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
457   SET(WEBPLUGIN_SANDBOX_MODE "apparmor" CACHE STRING "WEB Plugin sandbox mode, can be apparmor, privsep, none")
458
459   SET(WITH_PLAYER ON)
460 ENDIF(WITH_WEBPLUGIN)
461
462
463 #-----------------------------------------------------------------------------
464 # Configure OpenGL.
465 FIND_PACKAGE(OpenGL)
466 INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
467 #-----------------------------------------------------------------------------
468 # Extra compile flags
469 IF(WITH_GAMEENGINE)
470   SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DGAMEBLENDER ")
471 ENDIF(WITH_GAMEENGINE)
472 IF(WITH_BULLET)
473   SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DWITH_BULLET ")
474 ENDIF(WITH_BULLET)
475 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ${C_WARNINGS}")
476 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ")
477
478 #-----------------------------------------------------------------------------
479 # Libraries
480 FILE(WRITE ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt "")
481 ADD_SUBDIRECTORY(intern)
482 ADD_SUBDIRECTORY(extern)
483 ADD_SUBDIRECTORY(source)
484
485
486 #-----------------------------------------------------------------------------
487 # Blender Application
488 ADD_SUBDIRECTORY(source/creator)
489
490
491 #-----------------------------------------------------------------------------
492 # Blender Player
493 IF(WITH_PLAYER)
494   ADD_SUBDIRECTORY(blenderplayer)
495 ENDIF(WITH_PLAYER)