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