smoke: another fftw3 error fixed
[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
72 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
73   MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
74 ENDIF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
75
76 # For alternate Python locations the commandline can be used to override detected/default cache settings, e.g:
77 # On Unix: 
78 #   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
79 # On Macs: 
80 #   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
81 #
82 # When changing any of this remember to update the notes in doc/blender-cmake.txt
83
84 #-----------------------------------------------------------------------------
85 # Load some macros.
86 INCLUDE(CMake/macros.cmake)
87
88 #-----------------------------------------------------------------------------
89 #Platform specifics
90
91 IF(UNIX AND NOT APPLE)
92   IF(WITH_OPENAL)
93     FIND_PACKAGE(OpenAL)
94     IF(OPENAL_FOUND)
95       SET(WITH_OPENAL ON)
96       SET(OPENAL_LIB ${OPENAL_LIBRARY})
97       SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
98     ELSE(OPENAL_FOUND)
99       SET(WITH_OPENAL OFF)
100     ENDIF(OPENAL_FOUND)
101   ENDIF(WITH_OPENAL)
102
103   FIND_LIBRARY(INTL_LIBRARY
104     NAMES intl
105     PATHS
106     /sw/lib
107   )
108   FIND_LIBRARY(ICONV_LIBRARY
109     NAMES iconv
110     PATHS
111     /sw/lib
112   )
113   IF(INTL_LIBRARY AND ICONV_LIBRARY)
114     SET(GETTEXT_LIB ${INTL_LIBRARY} ${ICONV_LIBRARY})
115   ENDIF(INTL_LIBRARY AND ICONV_LIBRARY)
116   
117   FIND_PATH(FREETYPE_INC
118     freetype
119     PATHS
120     /usr/local/include/freetype2
121     /usr/include/freetype2
122     /sw/include/freetype2
123     /opt/local/include/freetype2
124     /opt/csw/include/freetype2
125     /opt/include/freetype2
126     NO_DEFAULT_PATH
127   )
128   SET(FREETYPE_LIB freetype)
129
130   FIND_PACKAGE(PythonLibs)
131   SET(PYTHON_INC "${PYTHON_INCLUDE_PATH}" CACHE STRING "")
132   SET(PYTHON_LIB "${PYTHON_LIBRARIES}" CACHE STRING "")
133   FIND_PACKAGE(PythonInterp)
134   SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
135   SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic")
136
137   IF(WITH_SDL)
138     FIND_PACKAGE(SDL)
139     SET(SDL_INC ${SDL_INCLUDE_DIR})
140     SET(SDL_LIB ${SDL_LIBRARY})
141   ENDIF(WITH_SDL)
142
143   FIND_PATH(OPENEXR_INC
144     ImfXdr.h
145     PATHS
146     /usr/local/include/OpenEXR
147     /usr/include/OpenEXR
148     /sw/include/OpenEXR
149     /opt/local/include/OpenEXR
150     /opt/csw/include/OpenEXR
151     /opt/include/OpenEXR
152   )
153   SET(OPENEXR_LIB Half IlmImf Iex Imath)
154
155   SET(FFMPEG /usr)
156   SET(FFMPEG_INC ${FFMPEG}/include)
157   SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale)
158   SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
159
160   FIND_PACKAGE(JPEG REQUIRED)
161
162   FIND_PACKAGE(PNG REQUIRED)
163
164   FIND_PACKAGE(ZLIB REQUIRED)
165
166   SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++ -lX11 -ldl")
167
168   IF(WITH_OPENMP)
169     SET(LLIBS "${LLIBS} -lgomp")
170     SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
171     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
172   ENDIF(WITH_OPENMP)
173
174
175   SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -DXP_UNIX -Wno-char-subscripts")
176
177   SET(PLATFORM_LINKFLAGS "-pthread")
178
179   # Better warnings
180   SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wnested-externs -Wdeclaration-after-statement")
181
182   INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
183 ENDIF(UNIX AND NOT APPLE)
184
185 IF(WIN32)
186
187   # this file is included anyway when building under Windows with cl.exe
188   #  INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
189   
190   SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
191
192   # Setup 64bit and 64bit windows systems
193   IF(CMAKE_CL_64)
194     message("64 bit compiler detected.")
195     SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64)
196   ENDIF(CMAKE_CL_64)
197
198   SET(PYTHON ${LIBDIR}/python)
199   SET(PYTHON_VERSION 2.6)
200   SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}")
201   SET(PYTHON_BINARY python)
202   SET(PYTHON_LIB python26)
203   SET(PYTHON_LIBPATH ${PYTHON}/lib)
204
205   IF(CMAKE_CL_64)
206     SET(WITH_OPENAL OFF)
207   ELSE(CMAKE_CL_64)
208     #SET(WITH_OPENAL ON)
209     SET(OPENAL ${LIBDIR}/openal)
210     SET(OPENAL_INC ${OPENAL}/include ${OPENAL}/include/AL)
211     SET(OPENAL_LIB openal_static)
212     SET(OPENAL_LIBPATH ${OPENAL}/lib)
213   ENDIF(CMAKE_CL_64)
214
215   IF(CMAKE_CL_64)
216         SET(PNG_LIBRARIES libpng)
217   ELSE(CMAKE_CL_64)
218     SET(PNG_LIBRARIES libpng_st)
219   ENDIF(CMAKE_CL_64)
220   SET(JPEG_LIBRARY libjpeg)
221
222   SET(ZLIB ${LIBDIR}/zlib)
223   SET(ZLIB_INC ${ZLIB}/include)
224   SET(ZLIB_LIBRARIES zlib)
225   SET(ZLIB_LIBPATH ${ZLIB}/lib)
226   
227   SET(PTHREADS ${LIBDIR}/pthreads)
228   SET(PTHREADS_INC ${PTHREADS}/include)
229   SET(PTHREADS_LIB pthreadVC2)
230   SET(PTHREADS_LIBPATH ${PTHREADS}/lib)
231   
232   SET(ICONV ${LIBDIR}/iconv)
233   SET(ICONV_INC ${ICONV}/include)
234   SET(ICONV_LIB iconv)
235   SET(ICONV_LIBPATH ${ICONV}/lib)
236   
237   SET(GETTEXT ${LIBDIR}/gettext)
238   SET(GETTEXT_INC ${GETTEXT}/include)
239   IF(CMAKE_CL_64)
240         SET(GETTEXT_LIB gettextlib)
241   ELSE(CMAKE_CL_64)
242         SET(GETTEXT_LIB gnu_gettext)
243   ENDIF(CMAKE_CL_64)
244   SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
245
246   SET(FREETYPE ${LIBDIR}/freetype)
247   SET(FREETYPE_INC ${FREETYPE}/include ${FREETYPE}/include/freetype2)
248   SET(FREETYPE_LIBPATH ${FREETYPE}/lib)
249   SET(FREETYPE_LIB freetype2ST)
250   
251   SET(OPENEXR ${LIBDIR}/openexr)
252   SET(OPENEXR_INC ${OPENEXR}/include ${OPENEXR}/include/IlmImf ${OPENEXR}/include/Iex ${OPENEXR}/include/Imath)
253   SET(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
254   IF (MSVC80)
255   SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2005)
256   ELSE (MSVC80)
257   SET(OPENEXR_LIBPATH ${OPENEXR}/lib_msvc)
258   ENDIF(MSVC80)
259   IF (MSVC90)
260   SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2008)
261   ENDIF(MSVC90)
262
263   
264   SET(QUICKTIME ${LIBDIR}/QTDevWin)
265   SET(QUICKTIME_INC ${QUICKTIME}/CIncludes)
266   SET(QUICKTIME_LIB qtmlClient)
267   SET(QUICKTIME_LIBPATH ${QUICKTIME}/Libraries)
268
269   SET(FFMPEG ${LIBDIR}/ffmpeg)
270   SET(FFMPEG_INC ${FFMPEG}/include)
271   SET(FFMPEG_LIB avcodec-52 avformat-52 avdevice-52 avutil-50 swscale-0)
272   SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
273
274   IF(CMAKE_CL_64)
275   SET(LLIBS kernel32 user32 vfw32 winmm ws2_32 )
276   ELSE(CMAKE_CL_64)
277   SET(LLIBS kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid ws2_32 vfw32 winmm)
278   ENDIF(CMAKE_CL_64)
279   
280   IF(WITH_OPENAL)
281     SET(LLIBS ${LLIBS} dxguid)
282   ENDIF(WITH_OPENAL)
283
284   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)
285   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)
286   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)
287   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)
288   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)
289   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)
290   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)
291   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)
292
293   IF(WITH_OPENMP)
294     SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /openmp ")
295     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp ")
296   ENDIF(WITH_OPENMP)
297
298   SET(SDL ${LIBDIR}/sdl)
299   SET(SDL_INC ${SDL}/include)
300   SET(SDL_LIB SDL)
301   SET(SDL_LIBPATH ${SDL}/lib)
302
303   SET(PNG "${LIBDIR}/png")
304   SET(PNG_INC "${PNG}/include")
305   SET(PNG_LIBPATH ${PNG}/lib)
306
307   SET(JPEG "${LIBDIR}/jpeg")
308   SET(JPEG_INC "${JPEG}/include")
309   SET(JPEG_LIBPATH ${JPEG}/lib)
310
311   SET(TIFF ${LIBDIR}/tiff)
312   SET(TIFF_INC ${TIFF}/include)
313   
314   SET(WINTAB_INC ${LIBDIR}/wintab/include) 
315
316   IF(CMAKE_CL_64)
317   SET(PLATFORM_LINKFLAGS "/MANIFEST:NO /MANIFESTUAC:NO /MACHINE:X64 /NODEFAULTLIB:libc.lib;MSVCRT.lib ")
318   ELSE(CMAKE_CL_64)
319   SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib ")
320   ENDIF(CMAKE_CL_64)
321   SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ")
322 ENDIF(WIN32)
323
324 IF(APPLE)
325   IF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
326     SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.x.i386)
327   ELSE(CMAKE_OSX_ARCHITECTURES MATCHES i386)
328     SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-6.1-powerpc)
329   ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
330
331   IF(WITH_OPENAL)
332     FIND_PACKAGE(OpenAL)
333     IF(OPENAL_FOUND)
334       SET(WITH_OPENAL ON)
335       SET(OPENAL_LIB ${OPENAL_LIBRARY})
336       SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
337     ELSE(OPENAL_FOUND)
338       SET(WITH_OPENAL OFF)
339     ENDIF(OPENAL_FOUND)
340   ENDIF(WITH_OPENAL)
341
342
343   SET(PYTHON_VERSION 3.1)
344
345   IF(PYTHON_VERSION MATCHES 3.1)
346     # we use precompiled libraries for py 3.1 and up by default
347
348     SET(PYTHON ${LIBDIR}/python)
349     SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "")
350     SET(PYTHON_BINARY "${PYTHON}/bin/python${PYTHON_VERSION}" CACHE STRING "")
351     SET(PYTHON_LIB python${PYTHON_VERSION})
352     SET(PYTHON_LIBPATH "${PYTHON}/lib/python${PYTHON_VERSION}" CACHE STRING "")
353     #    SET(PYTHON_LINKFLAGS "-u _PyMac_Error")  # won't  build with this enabled
354   ELSE(PYTHON_VERSION MATCHES 3.1)
355     # otherwise, use custom system framework
356
357     SET(PYTHON /System/Library/Frameworks/Python.framework/Versions/)
358     SET(PYTHON_VERSION 2.5)
359     SET(PYTHON_INC "${PYTHON}${PYTHON_VERSION}/include/python${PYTHON_VERSION}" CACHE STRING "")
360     SET(PYTHON_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION} CACHE STRING "")
361     SET(PYTHON_LIB "")
362     SET(PYTHON_LIBPATH ${PYTHON}${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config CACHE STRING "")
363     SET(PYTHON_LINKFLAGS "-u _PyMac_Error -framework System -framework Python")
364   ENDIF(PYTHON_VERSION MATCHES 3.1)
365
366   SET(GETTEXT ${LIBDIR}/gettext)
367   SET(GETTEXT_INC "${GETTEXT}/include")
368   SET(GETTEXT_LIB intl iconv)
369   SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
370
371   SET(PNG_LIBRARIES png)
372   SET(JPEG_LIBRARY jpeg)
373
374   SET(ZLIB /usr)
375   SET(ZLIB_INC "${ZLIB}/include")
376   SET(ZLIB_LIBRARIES z)
377
378   SET(FREETYPE ${LIBDIR}/freetype)
379   SET(FREETYPE_INC ${FREETYPE}/include ${FREETYPE}/include/freetype2)
380   SET(FREETYPE_LIBPATH ${FREETYPE}/lib)
381   SET(FREETYPE_LIB freetype)
382
383   SET(OPENEXR ${LIBDIR}/openexr)
384   SET(OPENEXR_INC ${OPENEXR}/include/OpenEXR ${OPENEXR}/include)
385   IF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
386     SET(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
387   ELSE(CMAKE_OSX_ARCHITECTURES MATCHES i386)
388     SET(OPENEXR_LIB Iex Half IlmImf Imath)
389   ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
390   SET(OPENEXR_LIBPATH ${OPENEXR}/lib)
391
392   SET(LLIBS stdc++ SystemStubs)
393
394   SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
395   SET(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
396
397   IF(WITH_OPENMP)
398     SET(LLIBS "${LLIBS} -lgomp ")
399     SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp ")
400     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp ")
401   ENDIF(WITH_OPENMP)
402
403   SET(SDL ${LIBDIR}/sdl)
404   SET(SDL_INC ${SDL}/include)
405   SET(SDL_LIB SDL)
406   SET(SDL_LIBPATH ${SDL}/lib)
407
408   SET(PNG "${LIBDIR}/png")
409   SET(PNG_INC "${PNG}/include")
410   SET(PNG_LIBPATH ${PNG}/lib)
411
412   SET(JPEG "${LIBDIR}/jpeg")
413   SET(JPEG_INC "${JPEG}/include")
414   SET(JPEG_LIBPATH ${JPEG}/lib)
415
416   SET(TIFF ${LIBDIR}/tiff)
417   SET(TIFF_INC ${TIFF}/include)
418
419   SET(EXETYPE MACOSX_BUNDLE)
420 ENDIF(APPLE)
421
422 IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
423   SET(BINRELOC ${CMAKE_SOURCE_DIR}/extern/binreloc)
424   SET(BINRELOC_INC ${BINRELOC}/include)
425 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
426
427 #-----------------------------------------------------------------------------
428 # Common.
429
430 set(OPENJPEG ${CMAKE_SOURCE_DIR}/extern/libopenjpeg)
431 set(OPENJPEG_INC ${OPENJPEG})
432 set(OPENJPEG_LIb extern_libopenjpeg)
433
434 #-----------------------------------------------------------------------------
435 # Blender WebPlugin
436
437 IF(WITH_WEBPLUGIN) 
438   SET(GECKO_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
439   SET(WEBPLUGIN_SANDBOX_MODE "apparmor" CACHE STRING "WEB Plugin sandbox mode, can be apparmor, privsep, none")
440
441   SET(WITH_PLAYER ON)
442 ENDIF(WITH_WEBPLUGIN)
443
444
445 #-----------------------------------------------------------------------------
446 # Configure OpenGL.
447 FIND_PACKAGE(OpenGL)
448 INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
449 #-----------------------------------------------------------------------------
450 # Extra compile flags
451 IF(WITH_GAMEENGINE)
452   SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DGAMEBLENDER ")
453 ENDIF(WITH_GAMEENGINE)
454 IF(WITH_BULLET)
455   SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DWITH_BULLET ")
456 ENDIF(WITH_BULLET)
457 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ${C_WARNINGS}")
458 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ")
459
460 #-----------------------------------------------------------------------------
461 # Libraries
462 FILE(WRITE ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt "")
463 ADD_SUBDIRECTORY(intern)
464 ADD_SUBDIRECTORY(extern)
465 ADD_SUBDIRECTORY(source)
466
467
468 #-----------------------------------------------------------------------------
469 # Blender Application
470 ADD_SUBDIRECTORY(source/creator)
471
472
473 #-----------------------------------------------------------------------------
474 # Blender Player
475 IF(WITH_PLAYER)
476   ADD_SUBDIRECTORY(blenderplayer)
477 ENDIF(WITH_PLAYER)