fixed soft body collision against concave triangle meshes.
[blender.git] / source / creator / 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 SETUP_LIBDIRS()
28
29 INCLUDE_DIRECTORIES(../../intern/guardedalloc
30   ../blender/blenlib
31   ../blender/blenkernel
32   ../blender/nodes
33   ../blender/include
34   ../blender/blenloader
35   ../blender/imbuf
36   ../blender/renderconverter
37   ../blender/render/extern/include
38   ../blender/python
39   ../blender/makesdna
40   ../blender/gpu
41   ../kernel/gen_messaging
42   ../kernel/gen_system
43   ../../extern/glew/include
44 )
45
46
47
48 IF(WITH_QUICKTIME)
49   ADD_DEFINITIONS(-DWITH_QUICKTIME)
50 ENDIF(WITH_QUICKTIME)
51
52 IF(LINUX)
53   ADD_DEFINITIONS(-DWITH_BINRELOC)
54   INCLUDE_DIRECTORIES(${BINRELOC_INC})
55 endif(LINUX)
56
57 MESSAGE(STATUS "Configuring blender")
58
59 ADD_CUSTOM_COMMAND(
60   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dna.c
61   COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna ${CMAKE_CURRENT_BINARY_DIR}/dna.c ${CMAKE_SOURCE_DIR}/source/blender/makesdna/
62   DEPENDS ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna
63 )
64
65 IF(WIN32)
66   ADD_EXECUTABLE(blender ${EXETYPE} creator.c ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../icons/winblender.rc)
67 ELSE(WIN32)
68   ADD_EXECUTABLE(blender ${EXETYPE} creator.c ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
69 ENDIF(WIN32)
70
71
72 # Post build steps for bundling/packaging.
73
74 SET(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
75
76
77 IF(UNIX)
78   ADD_CUSTOM_COMMAND(TARGET blender
79     POST_BUILD
80     MAIN_DEPENDENCY blender
81     #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/plugins ${TARGETDIR}/
82     #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/text/* ${TARGETDIR}/
83   )
84 ENDIF(UNIX)
85
86 IF(UNIX AND NOT APPLE)
87   ADD_CUSTOM_COMMAND(TARGET blender
88     POST_BUILD
89     MAIN_DEPENDENCY blender
90     COMMAND rm -Rf ${TARGETDIR}/.blender
91     COMMAND mkdir ${TARGETDIR}/.blender/
92     COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.bfont.ttf ${TARGETDIR}/.blender/
93     COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/.blender/
94     COMMAND cp -R ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/.blender/
95     COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/.blender/
96     COMMAND find ${TARGETDIR} -name CVS -prune -exec rm -rf {} "\;"
97   )
98 ENDIF(UNIX AND NOT APPLE)
99
100 IF(APPLE)
101   SET(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
102   SET(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist)
103   SET(TARGETINFO ${TARGETDIR}/blender.app/Contents/Info.plist)
104
105   ADD_CUSTOM_COMMAND(TARGET blender
106     POST_BUILD
107     MAIN_DEPENDENCY blender
108     COMMAND cp -R ${SOURCEINFO} ${TARGETDIR}/blender.app/Contents/
109     COMMAND cp -R ${SOURCEDIR}/Contents/PkgInfo ${TARGETDIR}/blender.app/Contents/
110     COMMAND cp -R ${SOURCEDIR}/Contents/Resources ${TARGETDIR}/blender.app/Contents/
111     COMMAND cat ${SOURCEINFO} | sed s/VERSION/`cat ${CMAKE_SOURCE_DIR}/release/VERSION`/ | sed s/DATE/`date +'%Y-%b-%d'`/ > ${TARGETINFO}
112     COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/.blender
113     COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
114     COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
115     COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
116     COMMAND cp -R ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/Resources/
117     COMMAND cp -R ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
118     COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/Resources/
119     COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
120     COMMAND find ${TARGETDIR}/blender.app -name CVS -prune -exec rm -rf {} "\;"
121     COMMAND find ${TARGETDIR}/blender.app -name CVS.sandboxinfo -prune -exec rm -rf {} "\;"
122     COMMAND find ${TARGETDIR}/blender.app -name .DS_Store -prune -exec rm -rf {} "\;"
123   )
124 ENDIF(APPLE)
125
126 IF(WIN32)
127   FILE(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} WIN_SOURCE_DIR)
128   
129   ADD_CUSTOM_COMMAND(TARGET blender
130     POST_BUILD
131     MAIN_DEPENDENCY blender
132     COMMAND if not exist \"$\(TargetDir\)\\.blender\" mkdir \"$\(TargetDir\)\\.blender\"
133     COMMAND if not exist \"$\(TargetDir\)\\.blender\\locale\" mkdir \"$\(TargetDir\)\\.blender\\locale\"
134     COMMAND if not exist \"$\(TargetDir\)\\.blender\\scripts\" mkdir \"$\(TargetDir\)\\.blender\\scripts\"
135     COMMAND if not exist \"$\(TargetDir\)\\plugins\" mkdir \"$\(TargetDir\)\\plugins\"
136     COMMAND copy /Y \"${WIN_SOURCE_DIR}\\bin\\.blender\\.Blanguages\" \"$\(TargetDir\)\\.blender\\\"
137     COMMAND copy /Y \"${WIN_SOURCE_DIR}\\bin\\.blender\\.bfont.ttf\" \"$\(TargetDir\)\\.blender\\\"
138     COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\bin\\.blender\\locale\\*.*\" \"$\(TargetDir\)\\.blender\\locale\"
139     COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\release\\scripts\\*.*\" \"$\(TargetDir\)\\.blender\\scripts\"
140     COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\release\\plugins\\*.*\" \"$\(TargetDir\)\\plugins\"
141     COMMAND copy /Y \"${WIN_SOURCE_DIR}\\release\\text\\*.*\" \"$\(TargetDir\)\"
142   )
143   
144   FILE(TO_NATIVE_PATH "${LIBDIR}" WIN_LIBDIR)
145   
146   ADD_CUSTOM_COMMAND(TARGET blender
147     POST_BUILD
148     MAIN_DEPENDENCY blender
149     COMMAND copy /Y \"${WIN_LIBDIR}\\gettext\\lib\\gnu_gettext.dll\" \"$\(TargetDir\)\\\"
150     COMMAND copy /Y \"${WIN_LIBDIR}\\png\\lib\\libpng.dll\" \"$\(TargetDir\)\\\"
151     COMMAND copy /Y \"${WIN_LIBDIR}\\sdl\\lib\\SDL.dll\" \"$\(TargetDir\)\\\"
152     COMMAND copy /Y \"${WIN_LIBDIR}\\zlib\\lib\\zlib.dll\" \"$\(TargetDir\)\\\"
153     COMMAND copy /Y \"${WIN_LIBDIR}\\tiff\\lib\\libtiff.dll\" \"$\(TargetDir\)\\\"
154     COMMAND if $\(ConfigurationName\)==Debug copy /Y \"${WIN_LIBDIR}\\python\\lib\\python25_D.dll\" \"$\(TargetDir\)\\\"
155     COMMAND if $\(ConfigurationName\)==Debug copy /Y \"${WIN_LIBDIR}\\CRTL\\lib\\msvcrtd.dll\" \"$\(TargetDir\)\\\"
156     COMMAND if NOT $\(ConfigurationName\)==Debug copy /Y \"${WIN_LIBDIR}\\python\\lib\\python25.dll\" \"$\(TargetDir\)\\\"
157     COMMAND copy /Y \"${WIN_LIBDIR}\\pthreads\\lib\\pthreadVC2.dll\" \"$\(TargetDir\)\\\"
158   )
159
160   IF(WITH_INTERNATIONAL)
161     ADD_CUSTOM_COMMAND(TARGET blender
162       POST_BUILD
163       MAIN_DEPENDENCY blender
164       COMMAND copy /Y \"${WIN_LIBDIR}\\iconv\\lib\\iconv.dll\" \"$\(TargetDir\)\\\"
165     )
166   ENDIF(WITH_INTERNATIONAL)
167
168   IF(WITH_FFMPEG)
169     ADD_CUSTOM_COMMAND(TARGET blender
170       POST_BUILD
171       MAIN_DEPENDENCY blender
172       COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avcodec-51.dll\" \"$\(TargetDir\)\\\"
173       COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avformat-52.dll\" \"$\(TargetDir\)\\\"
174       COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avdevice-52.dll\" \"$\(TargetDir\)\\\"
175       COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avutil-49.dll\" \"$\(TargetDir\)\\\"
176       COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libfaac-0.dll\" \"$\(TargetDir\)\\\"
177       COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libfaad-0.dll\" \"$\(TargetDir\)\\\"
178       COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libmp3lame-0.dll\" \"$\(TargetDir\)\\\"
179       COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libx264-59.dll\" \"$\(TargetDir\)\\\"
180       COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\swscale-0.dll\" \"$\(TargetDir\)\\\"
181       COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\xvidcore.dll\" \"$\(TargetDir\)\\\"
182     )
183   ENDIF(WITH_FFMPEG)
184 ENDIF(WIN32)
185
186 ADD_DEPENDENCIES(blender makesdna)
187
188 FILE(READ ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt BLENDER_LINK_LIBS)
189
190 SET(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} src blender_python blender_render blender_radiosity bf_elbeem)
191
192 IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
193   SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} extern_binreloc)
194 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
195
196 IF(UNIX)
197   # Sort libraries
198   SET(BLENDER_SORTED_LIBS
199     src 
200     bf_decimation 
201     blender_BSP 
202     bf_soundsystem 
203     bf_ghost 
204     bf_string 
205     blender_render 
206     blender_radiosity 
207     blender_ONL 
208     blender_python 
209     bf_blenkernel 
210     bf_nodes
211         bf_gpu
212     bf_blenloader 
213     bf_blenpluginapi 
214     bf_imbuf 
215     bf_blenlib 
216     bf_avi 
217     bf_cineon 
218     bf_openexr 
219     bf_readblenfile 
220     blender_bop 
221     bf_kernel 
222     bf_decimation 
223     bf_elbeem 
224     bf_yafray 
225     bf_IK 
226     bf_memutil 
227     bf_guardedalloc 
228     blender_CTR 
229     bf_moto 
230     bf_bmfont 
231     verse 
232     src 
233     bf_ftfont 
234     extern_ftgl 
235     bf_blroutines 
236     bf_converter 
237     bf_dummy 
238     bf_bullet 
239     bf_common 
240     bf_ketsji 
241     bf_logic 
242     bf_rasterizer 
243     bf_oglrasterizer 
244     bf_expressions 
245     bf_scenegraph 
246     bf_moto 
247     bf_blroutines 
248     kx_network 
249     bf_kernel 
250     bf_ngnetwork 
251     extern_bullet 
252     bf_loopbacknetwork 
253     bf_sumo 
254     bf_common 
255     extern_solid 
256     extern_qhull 
257     bf_moto 
258     blender_python
259     bf_quicktime
260     extern_binreloc
261         extern_glew
262   )
263
264   FOREACH(SORTLIB ${BLENDER_SORTED_LIBS})
265     SET(REMLIB ${SORTLIB})
266     FOREACH(SEARCHLIB ${BLENDER_LINK_LIBS})
267       IF(${SEARCHLIB} STREQUAL ${SORTLIB})
268         SET(REMLIB "")
269       ENDIF(${SEARCHLIB} STREQUAL ${SORTLIB})
270     ENDFOREACH(SEARCHLIB)
271     IF(REMLIB)
272       MESSAGE(STATUS "Removing library ${REMLIB} from blender linking because: not configured")
273       LIST(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
274     ENDIF(REMLIB)
275   ENDFOREACH(SORTLIB)
276   TARGET_LINK_LIBRARIES(blender ${BLENDER_SORTED_LIBS})
277 ELSE(UNIX)
278   TARGET_LINK_LIBRARIES(blender ${BLENDER_LINK_LIBS})
279 ENDIF(UNIX)
280
281 SETUP_LIBLINKS(blender)