finish cleanup for plugins
[blender.git] / source / blenderplayer / CMakeLists.txt
1 # ***** BEGIN GPL LICENSE BLOCK *****
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # The Original Code is Copyright (C) 2006, Blender Foundation
18 # All rights reserved.
19 #
20 # The Original Code is: all of this file.
21 #
22 # Contributor(s): Jacques Beaurain.
23 #
24 # ***** END GPL LICENSE BLOCK *****
25
26 # message(STATUS "Configuring blenderplayer")
27
28 setup_libdirs()
29
30 if(WITH_CODEC_QUICKTIME)
31         add_definitions(-DWITH_QUICKTIME)
32 endif()
33
34 add_custom_command(
35         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dna.c
36         COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna ${CMAKE_CURRENT_BINARY_DIR}/dna.c ${CMAKE_SOURCE_DIR}/source/blender/makesdna/
37         DEPENDS ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna
38 )
39
40 if(WIN32 AND NOT UNIX)
41         string(SUBSTRING ${BLENDER_VERSION} 0 1 bver1)
42         string(SUBSTRING ${BLENDER_VERSION} 2 1 bver2)
43         string(SUBSTRING ${BLENDER_VERSION} 3 1 bver3)
44         if(MINGW)
45                 add_definitions(
46                         -DWINDRES
47                         -DBLEN_VER_RC_STR_M=${BLENDER_VERSION}
48                         -DBLEN_VER_RC_1=${bver1}
49                         -DBLEN_VER_RC_2=${bver2}
50                         -DBLEN_VER_RC_3=${bver3}
51                         -DBLEN_VER_RC_4=0
52                 )
53         else()
54                 add_definitions(
55                         -DBLEN_VER_RC_STR=${BLENDER_VERSION}
56                         -DBLEN_VER_RC_1=${bver1}
57                         -DBLEN_VER_RC_2=${bver2}
58                         -DBLEN_VER_RC_3=${bver3}
59                         -DBLEN_VER_RC_4=0
60                 )
61         endif()
62
63         add_executable(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../icons/winblender.rc)
64
65 elseif(APPLE)
66         add_executable(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
67         # setup Info.plist
68         execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
69         set(PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app)
70         set(PLAYER_SOURCEINFO ${PLAYER_SOURCEDIR}/Contents/Info.plist)
71         set_target_properties(blenderplayer PROPERTIES
72                 MACOSX_BUNDLE_INFO_PLIST ${PLAYER_SOURCEINFO}
73                 MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION}
74                 MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}")
75
76 else()
77         add_executable(blenderplayer ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
78 endif()
79
80 add_dependencies(blenderplayer makesdna)
81
82 get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
83
84 list(APPEND BLENDER_LINK_LIBS
85         ge_player_common
86         ge_player_ghost
87         blenkernel_blc
88 )
89
90 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
91         list(APPEND BLENDER_LINK_LIBS extern_binreloc)
92 endif()
93
94 # if(UNIX)
95         # Sort libraries
96         set(BLENDER_SORTED_LIBS
97                 ge_player_ghost 
98                 ge_player_common 
99                 bf_intern_string 
100                 bf_intern_ghost
101                 bf_rna
102                 bf_bmesh
103                 bf_blenkernel
104                 bf_blenloader
105                 ge_blen_routines
106                 bf_editor_datafiles
107                 ge_converter 
108                 ge_logic_ketsji 
109                 ge_phys_bullet 
110                 ge_phys_dummy
111                 ge_phys_common 
112                 ge_logic 
113                 ge_rasterizer 
114                 ge_oglrasterizer 
115                 ge_logic_expressions 
116                 ge_scenegraph
117                 bf_ikplugin
118                 bf_intern_itasc
119                 bf_intern_ik
120                 bf_intern_smoke
121                 bf_modifiers
122                 bf_intern_moto 
123                 bf_nodes
124                 bf_gpu
125                 bf_imbuf
126                 bf_avi 
127                 ge_logic_network 
128                 ge_logic_ngnetwork 
129                 ge_logic_loopbacknetwork 
130                 extern_bullet 
131                 bf_intern_guardedalloc 
132                 bf_intern_memutil 
133                 bf_python_ext
134                 bf_python_mathutils
135                 bf_python_bmesh
136                 bf_blenlib 
137                 bf_intern_utfconv
138                 bf_imbuf_cineon
139                 bf_imbuf_openexr 
140                 extern_openjpeg
141                 extern_redcode
142                 bf_imbuf_dds
143                 bf_dna
144                 ge_videotex
145                 bf_blenfont
146                 bf_intern_audaspace
147                 blenkernel_blc
148                 bf_bmesh
149                 extern_binreloc
150                 extern_minilzo
151                 bf_intern_ghost # duplicate for linking
152                 bf_blenkernel # duplicate for linking
153                 bf_intern_mikktspace
154                 extern_recastnavigation
155         )
156
157         if(WITH_MOD_CLOTH_ELTOPO)
158                 list(APPEND BLENDER_SORTED_LIBS extern_eltopo)
159         endif()
160
161         if(WITH_BUILTIN_GLEW)
162                 list(APPEND BLENDER_SORTED_LIBS extern_glew)
163         endif()
164
165         if(WITH_LZMA)
166                 list(APPEND BLENDER_SORTED_LIBS extern_lzma)
167         endif()
168
169         if(WITH_LIBMV)
170                 list(APPEND BLENDER_SORTED_LIBS extern_libmv)
171         endif()
172
173         list(APPEND BLENDER_SORTED_LIBS extern_colamd)
174
175         if(WITH_MOD_DECIMATE)
176                 list(APPEND BLENDER_SORTED_LIBS bf_intern_decimate)
177         endif()
178
179         if(WITH_MOD_BOOLEAN)
180                 list(APPEND BLENDER_SORTED_LIBS bf_intern_bsp)
181                 list(APPEND BLENDER_SORTED_LIBS bf_intern_bop)
182                 list(APPEND BLENDER_SORTED_LIBS bf_intern_moto)
183         endif()
184
185         if(WITH_CARVE)
186                 list(APPEND BLENDER_SORTED_LIBS extern_carve)
187         endif()
188
189         if(WITH_GHOST_XDND)
190                 list(APPEND BLENDER_SORTED_LIBS extern_xdnd)
191         endif()
192
193         if(WITH_CODEC_QUICKTIME)
194                 list(APPEND BLENDER_SORTED_LIBS bf_quicktime)
195         endif()
196
197         if(WITH_CXX_GUARDEDALLOC)
198                 list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
199         endif()
200
201         foreach(SORTLIB ${BLENDER_SORTED_LIBS})
202                 set(REMLIB ${SORTLIB})
203                 foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
204                         if(${SEARCHLIB} STREQUAL ${SORTLIB})
205                                 set(REMLIB "")
206                         endif()
207                 endforeach()
208                 if(REMLIB)
209                         # message(STATUS "Removing library ${REMLIB} from blenderplayer linking because: not configured")
210                         list(APPEND REM_MSG ${REMLIB})
211                         list(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
212                 endif()
213         endforeach()
214         if(REM_MSG)
215                 list(SORT REM_MSG)
216                 message(STATUS "Player Skipping: (${REM_MSG})")
217         endif()
218         target_link_libraries(blenderplayer ${BLENDER_SORTED_LIBS})
219
220         unset(SEARCHLIB)
221         unset(SORTLIB)
222         unset(REMLIB)
223         unset(REM_MSG)
224
225 # else()
226 #       target_link_libraries(blenderplayer ${BLENDER_LINK_LIBS})
227 # endif()
228
229 if(WITH_PLAYER)
230         add_subdirectory(bad_level_call_stubs)
231 endif()
232
233 setup_liblinks(blenderplayer)