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