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