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