CMake: Proper bundle for blender binary for Mac OS X and just keep blenderplayer...
[blender-staging.git] / source / creator / CMakeLists.txt
1 # $Id$
2 # ***** BEGIN GPL/BL DUAL 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. 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
10 # about this.
11 #
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.
16 #
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.
20 #
21 # The Original Code is Copyright (C) 2006, Blender Foundation
22 # All rights reserved.
23 #
24 # The Original Code is: all of this file.
25 #
26 # Contributor(s): Jacques Beaurain.
27 #
28 # ***** END GPL/BL DUAL LICENSE BLOCK *****
29
30 SETUP_LIBDIRS()
31
32 FILE(APPEND ../blender/makesdna/intern/dna.c "")
33
34 INCLUDE_DIRECTORIES(../../intern/guardedalloc
35   ../blender/blenlib
36   ../blender/blenkernel
37   ../blender/include
38   ../blender/blenloader
39   ../blender/imbuf
40   ../blender/renderconverter
41   ../blender/render/extern/include
42   ../blender/python
43   ../blender/makesdna
44   ../kernel/gen_messaging
45   ../kernel/gen_system
46 )
47
48 IF(WITH_QUICKTIME)
49   ADD_DEFINITIONS(-DWITH_QUICKTIME)
50 ENDIF(WITH_QUICKTIME)
51
52 MESSAGE(STATUS "Configuring blender")
53
54 IF(WIN32)
55   ADD_EXECUTABLE(blender ${EXETYPE} creator.c ../blender/makesdna/intern/dna.c ../icons/winblender.rc)
56 ELSE(WIN32)
57   ADD_EXECUTABLE(blender ${EXETYPE} creator.c ../blender/makesdna/intern/dna.c)
58 ENDIF(WIN32)
59
60 IF(APPLE)
61   SET(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
62   SET(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist)
63   SET(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/blender.app)
64   SET(TARGETINFO ${TARGETDIR}/Contents/Info.plist)
65
66   ADD_CUSTOM_COMMAND(TARGET blender
67     POST_BUILD
68     MAIN_DEPENDENCY blender
69     COMMAND cp -R ${SOURCEINFO} ${TARGETDIR}/Contents/
70     COMMAND cp -R ${SOURCEDIR}/Contents/PkgInfo ${TARGETDIR}/Contents/
71     COMMAND cp -R ${SOURCEDIR}/Contents/Resources ${TARGETDIR}/Contents/
72     COMMAND cat ${SOURCEINFO} | sed s/VERSION/`cat ${CMAKE_SOURCE_DIR}/release/VERSION`/ | sed s/DATE/`date +'%Y-%b-%d'`/ > ${TARGETINFO}
73     COMMAND rm -Rf ${TARGETDIR}/Contents/MacOS/.blender
74     COMMAND mkdir ${TARGETDIR}/Contents/MacOS/.blender/
75     COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.bfont.ttf ${TARGETDIR}/Contents/MacOS/.blender/
76     COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/Contents/MacOS/.blender/
77     COMMAND cp -R ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/Contents/Resources/
78     COMMAND cp -R ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/Contents/MacOS/.blender/
79     COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/Contents/Resources/
80     COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/Contents/MacOS/.blender/
81     COMMAND find ${TARGETDIR} -name CVS -prune -exec rm -rf {} "\;"
82     COMMAND find ${TARGETDIR} -name CVS.sandboxinfo -prune -exec rm -rf {} "\;"
83     COMMAND find ${TARGETDIR} -name .DS_Store -prune -exec rm -rf {} "\;"
84   )
85 ENDIF(APPLE)
86
87 ADD_DEPENDENCIES(blender makesdna)
88
89 SETUP_LIBLINKS(blender)
90 FILE(READ ${CMAKE_SOURCE_DIR}/cmake_blender_libs.txt BLENDER_LINK_LIBS)
91
92 SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} src blender_python blender_render blender_radiosity blender_IK bf_elbeem)
93
94 IF(UNIX)
95   # Sort libraries
96   SET(BLENDER_SORTED_LIBS
97     src 
98     bf_decimation 
99     blender_BSP 
100     bf_soundsystem 
101     bf_ghost 
102     bf_string 
103     blender_render 
104     blender_radiosity 
105     blender_ONL 
106     blender_python 
107     bf_blenkernel 
108     bf_blenloader 
109     bf_blenpluginapi 
110     bf_imbuf 
111     bf_blenlib 
112     bf_avi 
113     bf_cineon 
114     bf_openexr 
115     bf_readblenfile 
116     blender_bop 
117     bf_kernel 
118     bf_decimation 
119     bf_elbeem 
120     bf_yafray 
121     blender_IK 
122     bf_memutil 
123     bf_guardedalloc 
124     blender_CTR 
125     bf_moto 
126     bf_bmfont 
127     verse 
128     src 
129     bf_ftfont 
130     extern_ftgl 
131     bf_blroutines 
132     bf_converter 
133     bf_dummy 
134     bf_bullet 
135     bf_common 
136     bf_ketsji 
137     bf_logic 
138     bf_rasterizer 
139     bf_oglrasterizer 
140     bf_expressions 
141     bf_scenegraph 
142     bf_moto 
143     bf_blroutines 
144     kx_network 
145     bf_kernel 
146     bf_ngnetwork 
147     extern_bullet 
148     bf_loopbacknetwork 
149     bf_sumo 
150     bf_common 
151     extern_solid 
152     extern_qhull 
153     bf_moto 
154     blender_python
155     bf_quicktime
156   )
157
158   FOREACH(SORTLIB ${BLENDER_SORTED_LIBS})
159     SET(REMLIB ${SORTLIB})
160     FOREACH(SEARCHLIB ${BLENDER_LINK_LIBS})
161       IF(${SEARCHLIB} STREQUAL ${SORTLIB})
162         SET(REMLIB "")
163       ENDIF(${SEARCHLIB} STREQUAL ${SORTLIB})
164     ENDFOREACH(SEARCHLIB)
165     IF(REMLIB)
166       MESSAGE("Removing library ${REMLIB} from blender linking because: not configured")
167       LIST(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
168     ENDIF(REMLIB)
169   ENDFOREACH(SORTLIB)
170   TARGET_LINK_LIBRARIES(blender ${BLENDER_SORTED_LIBS})
171 ELSE(UNIX)
172   TARGET_LINK_LIBRARIES(blender ${BLENDER_LINK_LIBS})
173 ENDIF(UNIX)
174