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