af367467e0059e58a7991eae126c25d81c0d868c
[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 if(WIN32 AND NOT UNIX)
35         string(SUBSTRING ${BLENDER_VERSION} 0 1 bver1)
36         string(SUBSTRING ${BLENDER_VERSION} 2 1 bver2)
37         string(SUBSTRING ${BLENDER_VERSION} 3 1 bver3)
38         if(MINGW)
39                 add_definitions(
40                         -DWINDRES
41                         -DBLEN_VER_RC_STR_M=${BLENDER_VERSION}
42                         -DBLEN_VER_RC_1=${bver1}
43                         -DBLEN_VER_RC_2=${bver2}
44                         -DBLEN_VER_RC_3=${bver3}
45                         -DBLEN_VER_RC_4=0
46                 )
47         else()
48                 add_definitions(
49                         -DBLEN_VER_RC_STR=${BLENDER_VERSION}
50                         -DBLEN_VER_RC_1=${bver1}
51                         -DBLEN_VER_RC_2=${bver2}
52                         -DBLEN_VER_RC_3=${bver3}
53                         -DBLEN_VER_RC_4=0
54                 )
55         endif()
56
57         add_executable(blenderplayer ${EXETYPE} bad_level_call_stubs/stubs.c ../icons/winblender.rc)
58
59         install(TARGETS blenderplayer
60                         COMPONENT Blenderplayer
61                         DESTINATION ".")
62
63 elseif(APPLE)
64         add_executable(blenderplayer ${EXETYPE} bad_level_call_stubs/stubs.c)
65         # setup Info.plist
66         execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
67         set(PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/release/darwin/blenderplayer.app)
68         set(PLAYER_SOURCEINFO ${PLAYER_SOURCEDIR}/Contents/Info.plist)
69         set_target_properties(blenderplayer PROPERTIES
70                 MACOSX_BUNDLE_INFO_PLIST ${PLAYER_SOURCEINFO}
71                 MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION}
72                 MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}")
73
74 else()
75         add_executable(blenderplayer bad_level_call_stubs/stubs.c)
76
77         if(NOT WITH_INSTALL_PORTABLE)
78                 install(
79                         TARGETS blenderplayer
80                         DESTINATION bin
81                 )
82         endif()
83 endif()
84
85 add_dependencies(blenderplayer makesdna)
86
87 get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
88
89 list(APPEND BLENDER_LINK_LIBS
90         ge_player_common
91         ge_player_ghost
92         blenkernel_blc
93 )
94
95 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
96         list(APPEND BLENDER_LINK_LIBS extern_binreloc)
97 endif()
98
99 # if(UNIX)
100         # Sort libraries
101         set(BLENDER_SORTED_LIBS
102                 ge_player_ghost 
103                 ge_player_common 
104                 bf_intern_string 
105                 bf_intern_ghost
106                 bf_intern_ghostndof3dconnexion
107                 bf_rna
108                 bf_blenkernel
109                 bf_depsgraph
110                 bf_physics
111                 bf_intern_rigidbody
112                 bf_blenloader
113                 ge_blen_routines
114                 bf_editor_datafiles
115                 ge_converter 
116                 ge_logic_ketsji 
117                 ge_phys_bullet 
118                 ge_phys_dummy
119                 ge_logic 
120                 ge_rasterizer 
121                 ge_oglrasterizer 
122                 ge_logic_expressions 
123                 ge_scenegraph
124                 bf_ikplugin
125                 bf_intern_itasc
126                 bf_intern_iksolver
127                 bf_intern_smoke
128                 bf_modifiers
129                 bf_intern_moto 
130                 bf_nodes
131                 bf_gpu
132                 bf_imbuf
133                 bf_avi 
134                 ge_logic_network 
135                 ge_logic_ngnetwork 
136                 ge_logic_loopbacknetwork 
137                 extern_bullet 
138                 bf_intern_guardedalloc 
139                 bf_intern_memutil 
140                 bf_python_ext
141                 bf_python_mathutils
142                 bf_python_bmesh
143                 bf_intern_utfconv
144                 bf_imbuf_cineon
145                 bf_imbuf_openexr 
146                 bf_imbuf_openimageio
147                 extern_openjpeg
148                 extern_redcode
149                 bf_imbuf_dds
150                 bf_dna
151                 ge_videotex
152                 bf_blenfont
153                 bf_blentranslation
154                 bf_intern_audaspace
155                 blenkernel_blc
156                 bf_bmesh
157                 bf_blenlib
158                 bf_intern_utfconv
159                 extern_binreloc
160                 extern_minilzo
161                 bf_intern_ghost # duplicate for linking
162                 bf_blenkernel # duplicate for linking
163                 bf_intern_mikktspace
164                 extern_recastnavigation
165                 bf_intern_raskter
166                 bf_intern_opencolorio
167                 bf_intern_opennl
168                 bf_intern_glew_mx
169                 extern_rangetree
170                 extern_wcwidth
171                 extern_libmv
172                 extern_glog
173                 extern_sdlew
174                 extern_eigen3
175         )
176
177         if(WITH_MOD_CLOTH_ELTOPO)
178                 list(APPEND BLENDER_SORTED_LIBS extern_eltopo)
179         endif()
180
181         if(NOT WITH_SYSTEM_GLEW)
182                 list(APPEND BLENDER_SORTED_LIBS ${BLENDER_GLEW_LIBRARIES})
183         endif()
184
185         if(WITH_LZMA)
186                 list(APPEND BLENDER_SORTED_LIBS extern_lzma)
187         endif()
188
189         if(WITH_LIBMV)
190                 list(APPEND BLENDER_SORTED_LIBS extern_ceres)
191         endif()
192
193         list(APPEND BLENDER_SORTED_LIBS extern_colamd)
194
195         if(WITH_MOD_BOOLEAN)
196                 list(APPEND BLENDER_SORTED_LIBS extern_carve)
197         endif()
198
199         if(WITH_GHOST_XDND)
200                 list(APPEND BLENDER_SORTED_LIBS extern_xdnd)
201         endif()
202
203         if(WITH_CODEC_QUICKTIME)
204                 list(APPEND BLENDER_SORTED_LIBS bf_quicktime)
205         endif()
206
207         if(WITH_CXX_GUARDEDALLOC)
208                 list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
209         endif()
210
211         if(WITH_INTERNATIONAL)
212                 list(APPEND BLENDER_SORTED_LIBS bf_intern_locale)
213         endif()
214
215         if(WITH_OPENSUBDIV)
216                 list(APPEND BLENDER_SORTED_LIBS bf_intern_opensubdiv)
217         endif()
218
219         foreach(SORTLIB ${BLENDER_SORTED_LIBS})
220                 set(REMLIB ${SORTLIB})
221                 foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
222                         if(${SEARCHLIB} STREQUAL ${SORTLIB})
223                                 set(REMLIB "")
224                         endif()
225                 endforeach()
226                 if(REMLIB)
227                         # message(STATUS "Removing library ${REMLIB} from blenderplayer linking because: not configured")
228                         list(APPEND REM_MSG ${REMLIB})
229                         list(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
230                 endif()
231         endforeach()
232         if(REM_MSG)
233                 list(SORT REM_MSG)
234                 message(STATUS "Player Skipping: (${REM_MSG})")
235         endif()
236         target_link_libraries(blenderplayer ${BLENDER_SORTED_LIBS})
237
238         unset(SEARCHLIB)
239         unset(SORTLIB)
240         unset(REMLIB)
241         unset(REM_MSG)
242
243 # else()
244 #       target_link_libraries(blenderplayer ${BLENDER_LINK_LIBS})
245 # endif()
246
247 if(WITH_PLAYER)
248         add_subdirectory(bad_level_call_stubs)
249 endif()
250
251 setup_liblinks(blenderplayer)
252
253 # We put CLEW and CUEW here because OPENSUBDIV_LIBRARIES dpeends on them..
254 if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV)
255         target_link_libraries(blenderplayer "extern_clew")
256         target_link_libraries(blenderplayer "extern_cuew")
257 endif()