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