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