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