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