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