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