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