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