1 # $Id: CMakeLists.txt 10719 2007-05-15 21:24:19Z hos $
2 # ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
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. The Blender
8 # Foundation also sells licenses for use in proprietary software under
9 # the Blender License. See http://www.blender.org/BL/ for information
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software Foundation,
19 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 # The Original Code is Copyright (C) 2006, Blender Foundation
22 # All rights reserved.
24 # The Original Code is: all of this file.
26 # Contributor(s): Jacques Beaurain.
28 # ***** END GPL/BL DUAL LICENSE BLOCK *****
30 #-----------------------------------------------------------------------------
31 # We don't allow in-source builds. This causes no end of troubles because
32 # all out-of-source builds will use the CMakeCache.txt file there and even
33 # build the libs and objects in it. It will also conflict with the current
34 # Makefile system for Blender
36 IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
37 MESSAGE(FATAL_ERROR "CMake generation for blender is not allowed within the source directory!
38 Remove the CMakeCache.txt file and try again from another folder, e.g.:
44 cmake -G \"Unix Makefiles\" ../blender
46 ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
48 CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
51 #-----------------------------------------------------------------------------
52 # Redirect output files
54 SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
55 SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
57 #-----------------------------------------------------------------------------
58 # Set default config options
59 OPTION(WITH_PLAYER "Build Player" OFF)
60 OPTION(WITH_GAMEENGINE "Enable Game Engine" ON)
61 OPTION(WITH_BULLET "Enable Bullet (Physics Engine)" ON)
62 OPTION(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
63 OPTION(WITH_VERSE "Enable Verse (http://verse.blender.org)" OFF)
64 OPTION(WITH_ELBEEM "Enable Elbeem (Fluid Simulation)" ON)
65 OPTION(WITH_QUICKTIME "Enable Quicktime Support" OFF)
66 OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" OFF)
67 OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
68 OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
69 OPTION(YESIAMSTUPID "Enable execution on 64-bit platforms" OFF)
71 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
72 MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
73 ENDIF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
75 # For alternate Python locations the commandline can be used to override detected/default cache settings, e.g:
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
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
81 # When changing any of this remember to update the notes in doc/blender-cmake.txt
83 #-----------------------------------------------------------------------------
85 INCLUDE(CMake/macros.cmake)
87 #-----------------------------------------------------------------------------
91 INCLUDE(${CMAKE_ROOT}/Modules/FindOpenAL.cmake)
94 SET(OPENAL_LIB ${OPENAL_LIBRARY})
95 SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
100 FIND_LIBRARY(ALUT_LIBRARY
111 SET(OPENAL_LIB ${OPENAL_LIB} ${ALUT_LIBRARY})
114 FIND_LIBRARY(INTL_LIBRARY
124 FIND_LIBRARY(ICONV_LIBRARY
134 IF(INTL_LIBRARY AND ICONV_LIBRARY)
135 SET(GETTEXT_LIB ${INTL_LIBRARY} ${ICONV_LIBRARY})
136 ENDIF(INTL_LIBRARY AND ICONV_LIBRARY)
138 FIND_PATH(FREETYPE_INC
141 /usr/local/include/freetype2
142 /usr/include/freetype2
143 /sw/include/freetype2
144 /opt/local/include/freetype2
145 /opt/csw/include/freetype2
146 /opt/include/freetype2
148 SET(FREETYPE_LIB freetype)
150 INCLUDE(${CMAKE_ROOT}/Modules/FindPythonLibs.cmake)
151 SET(PYTHON_INC "${PYTHON_INCLUDE_PATH}" CACHE STRING "")
152 SET(PYTHON_LIB "${PYTHON_LIBRARIES}" CACHE STRING "")
153 INCLUDE(${CMAKE_ROOT}/Modules/FindPythonInterp.cmake)
154 SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
155 SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic")
157 INCLUDE(${CMAKE_ROOT}/Modules/FindSDL.cmake)
158 SET(SDL_INC ${SDL_INCLUDE_DIR})
159 SET(SDL_LIB ${SDL_LIBRARY})
161 FIND_PATH(OPENEXR_INC
164 /usr/local/include/OpenEXR
167 /opt/local/include/OpenEXR
168 /opt/csw/include/OpenEXR
171 SET(OPENEXR_LIB Half IlmImf Iex Imath)
174 SET(FFMPEG_INC ${FFMPEG}/include)
175 SET(FFMPEG_LIB avformat avcodec avutil)
176 SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
184 SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++")
186 SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -DXP_UNIX -Wno-char-subscripts")
188 SET(PLATFORM_LINKFLAGS "-pthread")
190 INCLUDE_DIRECTORIES(/usr/include /usr/local/include)
194 INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
196 SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
198 SET(PYTHON ${LIBDIR}/python)
199 SET(PYTHON_VERSION 2.5)
200 SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}")
201 SET(PYTHON_BINARY python)
202 SET(PYTHON_LIB python25)
203 SET(PYTHON_LIBPATH ${PYTHON}/lib)
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)
211 SET(PNG_LIB libpng_st)
212 SET(JPEG_LIB libjpeg)
214 SET(ZLIB ${LIBDIR}/zlib)
215 SET(ZLIB_INC ${ZLIB}/include)
217 SET(ZLIB_LIBPATH ${ZLIB}/lib)
219 SET(PTHREADS ${LIBDIR}/pthreads)
220 SET(PTHREADS_INC ${PTHREADS}/include)
221 SET(PTHREADS_LIB pthreadVC2)
222 SET(PTHREADS_LIBPATH ${PTHREADS}/lib)
224 SET(ICONV ${LIBDIR}/iconv)
225 SET(ICONV_INC ${ICONV}/include)
227 SET(ICONV_LIBPATH ${ICONV}/lib)
229 SET(GETTEXT ${LIBDIR}/gettext)
230 SET(GETTEXT_INC ${GETTEXT}/include)
231 SET(GETTEXT_LIB gnu_gettext)
232 SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
234 SET(FREETYPE ${LIBDIR}/freetype)
235 SET(FREETYPE_INC ${FREETYPE}/include ${FREETYPE}/include/freetype2)
236 SET(FREETYPE_LIBPATH ${FREETYPE}/lib)
237 SET(FREETYPE_LIB freetype2ST)
239 SET(OPENEXR ${LIBDIR}/openexr)
240 SET(OPENEXR_INC ${OPENEXR}/include ${OPENEXR}/include/IlmImf ${OPENEXR}/include/Iex ${OPENEXR}/include/Imath)
241 SET(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
242 SET(OPENEXR_LIBPATH ${OPENEXR}/lib_msvc)
244 SET(QUICKTIME ${LIBDIR}/QTDevWin)
245 SET(QUICKTIME_INC ${QUICKTIME}/CIncludes)
246 SET(QUICKTIME_LIB qtmlClient)
247 SET(QUICKTIME_LIBPATH ${QUICKTIME}/Libraries)
249 SET(FFMPEG ${LIBDIR}/ffmpeg)
250 SET(FFMPEG_INC ${FFMPEG}/include)
251 SET(FFMPEG_LIB avcodec-51 avformat-51 avutil-49)
252 SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
254 SET(LLIBS kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid ws2_32 vfw32 winmm)
256 SET(LLIBS ${LLIBS} dxguid)
259 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)
260 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)
261 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)
262 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)
263 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)
264 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)
265 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)
266 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)
268 SET(SDL ${LIBDIR}/sdl)
269 SET(SDL_INC ${SDL}/include)
271 SET(SDL_LIBPATH ${SDL}/lib)
273 SET(PNG "${LIBDIR}/png")
274 SET(PNG_INC "${PNG}/include")
275 SET(PNG_LIBPATH ${PNG}/lib)
277 SET(JPEG "${LIBDIR}/jpeg")
278 SET(JPEG_INC "${JPEG}/include")
279 SET(JPEG_LIBPATH ${JPEG}/lib)
281 SET(TIFF ${LIBDIR}/tiff)
282 SET(TIFF_INC ${TIFF}/include)
284 SET(WINTAB_INC ${LIBDIR}/wintab/include)
286 SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib")
287 SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib ")
291 IF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
292 SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.x.i386)
293 ELSE(CMAKE_OSX_ARCHITECTURES MATCHES i386)
294 SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-6.1-powerpc)
295 ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
297 INCLUDE(${CMAKE_ROOT}/Modules/FindOpenAL.cmake)
300 SET(OPENAL_LIB ${OPENAL_LIBRARY})
301 SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
306 SET(PYTHON /System/Library/Frameworks/Python.framework/Versions/)
307 SET(PYTHON_VERSION 2.3)
308 SET(PYTHON_INC "${PYTHON}${PYTHON_VERSION}/include/python${PYTHON_VERSION}" CACHE STRING "")
309 SET(PYTHON_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION} CACHE STRING "")
311 SET(PYTHON_LIBPATH ${PYTHON}${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config CACHE STRING "")
312 SET(PYTHON_LINKFLAGS "-u __dummy -u _PyMac_Error -framework System -framework Python")
314 SET(GETTEXT ${LIBDIR}/gettext)
315 SET(GETTEXT_INC "${GETTEXT}/include")
316 SET(GETTEXT_LIB intl iconv)
317 SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
323 SET(ZLIB_INC "${ZLIB}/include")
326 SET(FREETYPE ${LIBDIR}/freetype)
327 SET(FREETYPE_INC ${FREETYPE}/include ${FREETYPE}/include/freetype2)
328 SET(FREETYPE_LIBPATH ${FREETYPE}/lib)
329 SET(FREETYPE_LIB freetype)
331 SET(OPENEXR ${LIBDIR}/openexr)
332 SET(OPENEXR_INC ${OPENEXR}/include/OpenEXR ${OPENEXR}/include)
333 IF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
334 SET(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
335 ELSE(CMAKE_OSX_ARCHITECTURES MATCHES i386)
336 SET(OPENEXR_LIB Iex Half IlmImf Imath)
337 ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
338 SET(OPENEXR_LIBPATH ${OPENEXR}/lib)
340 SET(LLIBS stdc++ SystemStubs)
342 SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
343 SET(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
345 SET(SDL ${LIBDIR}/sdl)
346 SET(SDL_INC ${SDL}/include)
348 SET(SDL_LIBPATH ${SDL}/lib)
350 SET(PNG "${LIBDIR}/png")
351 SET(PNG_INC "${PNG}/include")
352 SET(PNG_LIBPATH ${PNG}/lib)
354 SET(JPEG "${LIBDIR}/jpeg")
355 SET(JPEG_INC "${JPEG}/include")
356 SET(JPEG_LIBPATH ${JPEG}/lib)
358 SET(TIFF ${LIBDIR}/tiff)
359 SET(TIFF_INC ${TIFF}/include)
361 SET(EXETYPE MACOSX_BUNDLE)
364 #-----------------------------------------------------------------------------
366 SET(VERSE_INC ${CMAKE_SOURCE_DIR}/extern/verse/dist)
368 SET(FTGL ${CMAKE_SOURCE_DIR}/extern/bFTGL)
369 SET(FTGL_INC ${FTGL}/include)
370 SET(FTGL_LIB extern_ftgl)
373 #-----------------------------------------------------------------------------
375 INCLUDE(${CMAKE_ROOT}/Modules/FindOpenGL.cmake)
376 INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
377 #-----------------------------------------------------------------------------
378 # Extra compile flags
380 SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DGAMEBLENDER ")
381 ENDIF(WITH_GAMEENGINE)
382 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ")
383 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ")
385 #-----------------------------------------------------------------------------
387 FILE(WRITE ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt "")
395 #-----------------------------------------------------------------------------
396 # Blender Application
397 SUBDIRS(source/creator)
399 #-----------------------------------------------------------------------------
402 SUBDIRS(blenderplayer)