Buildbot: Initial work to move linux build environment to CMake
[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         else()
83                 install(
84                         TARGETS blenderplayer
85                         DESTINATION "."
86                 )
87         endif()
88 endif()
89
90 add_dependencies(blenderplayer makesdna)
91
92 get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
93
94 list(APPEND BLENDER_LINK_LIBS
95         ge_player_common
96         ge_player_ghost
97         blenkernel_blc
98 )
99
100 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
101         list(APPEND BLENDER_LINK_LIBS extern_binreloc)
102 endif()
103
104 # if(UNIX)
105         # Sort libraries
106         set(BLENDER_SORTED_LIBS
107                 ge_player_ghost 
108                 ge_player_common 
109                 bf_intern_string 
110                 bf_intern_ghost
111                 bf_intern_ghostndof3dconnexion
112                 bf_rna
113                 bf_blenkernel
114                 bf_depsgraph
115                 bf_physics
116                 bf_intern_rigidbody
117                 bf_blenloader
118                 ge_blen_routines
119                 bf_editor_datafiles
120                 ge_converter 
121                 ge_logic_ketsji 
122                 ge_phys_bullet 
123                 ge_phys_dummy
124                 ge_logic 
125                 ge_rasterizer 
126                 ge_oglrasterizer 
127                 ge_logic_expressions 
128                 ge_scenegraph
129                 bf_ikplugin
130                 bf_intern_itasc
131                 bf_intern_iksolver
132                 bf_intern_smoke
133                 bf_modifiers
134                 bf_intern_moto 
135                 bf_nodes
136                 bf_gpu
137                 bf_imbuf
138                 bf_avi 
139                 ge_logic_network 
140                 ge_logic_ngnetwork 
141                 ge_logic_loopbacknetwork 
142                 extern_bullet 
143                 bf_intern_guardedalloc 
144                 bf_intern_memutil 
145                 bf_python_ext
146                 bf_python_mathutils
147                 bf_python_bmesh
148                 bf_intern_utfconv
149                 bf_imbuf_cineon
150                 bf_imbuf_openexr 
151                 bf_imbuf_openimageio
152                 extern_openjpeg
153                 extern_redcode
154                 bf_imbuf_dds
155                 bf_dna
156                 ge_videotex
157                 bf_blenfont
158                 bf_blentranslation
159                 bf_intern_audaspace
160                 blenkernel_blc
161                 bf_bmesh
162                 bf_blenlib
163                 bf_intern_utfconv
164                 extern_binreloc
165                 extern_minilzo
166                 bf_intern_ghost # duplicate for linking
167                 bf_blenkernel # duplicate for linking
168                 bf_intern_mikktspace
169                 extern_recastnavigation
170                 bf_intern_raskter
171                 bf_intern_opencolorio
172                 bf_intern_opennl
173                 bf_intern_glew_mx
174                 extern_rangetree
175                 extern_wcwidth
176                 extern_libmv
177                 extern_glog
178                 extern_sdlew
179                 extern_eigen3
180         )
181
182         if(WITH_MOD_CLOTH_ELTOPO)
183                 list(APPEND BLENDER_SORTED_LIBS extern_eltopo)
184         endif()
185
186         if(NOT WITH_SYSTEM_GLEW)
187                 list(APPEND BLENDER_SORTED_LIBS ${BLENDER_GLEW_LIBRARIES})
188         endif()
189
190         if(WITH_LZMA)
191                 list(APPEND BLENDER_SORTED_LIBS extern_lzma)
192         endif()
193
194         if(WITH_LIBMV)
195                 list(APPEND BLENDER_SORTED_LIBS extern_ceres)
196         endif()
197
198         list(APPEND BLENDER_SORTED_LIBS extern_colamd)
199
200         if(WITH_MOD_BOOLEAN)
201                 list(APPEND BLENDER_SORTED_LIBS extern_carve)
202         endif()
203
204         if(WITH_GHOST_XDND)
205                 list(APPEND BLENDER_SORTED_LIBS extern_xdnd)
206         endif()
207
208         if(WITH_CODEC_QUICKTIME)
209                 list(APPEND BLENDER_SORTED_LIBS bf_quicktime)
210         endif()
211
212         if(WITH_CXX_GUARDEDALLOC)
213                 list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
214         endif()
215
216         if(WITH_INTERNATIONAL)
217                 list(APPEND BLENDER_SORTED_LIBS bf_intern_locale)
218         endif()
219
220         if(WITH_OPENSUBDIV)
221                 list(APPEND BLENDER_SORTED_LIBS bf_intern_opensubdiv)
222         endif()
223
224         foreach(SORTLIB ${BLENDER_SORTED_LIBS})
225                 set(REMLIB ${SORTLIB})
226                 foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
227                         if(${SEARCHLIB} STREQUAL ${SORTLIB})
228                                 set(REMLIB "")
229                         endif()
230                 endforeach()
231                 if(REMLIB)
232                         # message(STATUS "Removing library ${REMLIB} from blenderplayer linking because: not configured")
233                         list(APPEND REM_MSG ${REMLIB})
234                         list(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
235                 endif()
236         endforeach()
237         if(REM_MSG)
238                 list(SORT REM_MSG)
239                 message(STATUS "Player Skipping: (${REM_MSG})")
240         endif()
241         target_link_libraries(blenderplayer ${BLENDER_SORTED_LIBS})
242
243         unset(SEARCHLIB)
244         unset(SORTLIB)
245         unset(REMLIB)
246         unset(REM_MSG)
247
248 # else()
249 #       target_link_libraries(blenderplayer ${BLENDER_LINK_LIBS})
250 # endif()
251
252 if(WITH_PLAYER)
253         add_subdirectory(bad_level_call_stubs)
254 endif()
255
256 setup_liblinks(blenderplayer)
257
258 # We put CLEW and CUEW here because OPENSUBDIV_LIBRARIES dpeends on them..
259 if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV)
260         target_link_libraries(blenderplayer "extern_clew")
261         target_link_libraries(blenderplayer "extern_cuew")
262 endif()