Part I of the Freestyle branch merger: new 'freestyle' folders.
[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 elseif(APPLE)
60         add_executable(blenderplayer ${EXETYPE} bad_level_call_stubs/stubs.c)
61         # setup Info.plist
62         execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
63         set(PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/release/darwin/blenderplayer.app)
64         set(PLAYER_SOURCEINFO ${PLAYER_SOURCEDIR}/Contents/Info.plist)
65         set_target_properties(blenderplayer PROPERTIES
66                 MACOSX_BUNDLE_INFO_PLIST ${PLAYER_SOURCEINFO}
67                 MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION}
68                 MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}")
69
70 else()
71         add_executable(blenderplayer bad_level_call_stubs/stubs.c)
72 endif()
73
74 add_dependencies(blenderplayer makesdna)
75
76 get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
77
78 list(APPEND BLENDER_LINK_LIBS
79         ge_player_common
80         ge_player_ghost
81         blenkernel_blc
82 )
83
84 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
85         list(APPEND BLENDER_LINK_LIBS extern_binreloc)
86 endif()
87
88 # if(UNIX)
89         # Sort libraries
90         set(BLENDER_SORTED_LIBS
91                 ge_player_ghost 
92                 ge_player_common 
93                 bf_intern_string 
94                 bf_intern_ghost
95                 bf_rna
96                 bf_bmesh
97                 bf_blenkernel
98                 bf_intern_rigidbody
99                 bf_blenloader
100                 ge_blen_routines
101                 bf_editor_datafiles
102                 ge_converter 
103                 ge_logic_ketsji 
104                 ge_phys_bullet 
105                 ge_phys_dummy
106                 ge_logic 
107                 ge_rasterizer 
108                 ge_oglrasterizer 
109                 ge_logic_expressions 
110                 ge_scenegraph
111                 bf_ikplugin
112                 bf_intern_itasc
113                 bf_intern_iksolver
114                 bf_intern_smoke
115                 bf_modifiers
116                 bf_intern_moto 
117                 bf_nodes
118                 bf_gpu
119                 bf_imbuf
120                 bf_avi 
121                 ge_logic_network 
122                 ge_logic_ngnetwork 
123                 ge_logic_loopbacknetwork 
124                 extern_bullet 
125                 bf_intern_guardedalloc 
126                 bf_intern_memutil 
127                 bf_python_ext
128                 bf_python_mathutils
129                 bf_python_bmesh
130                 bf_blenlib 
131                 bf_intern_utfconv
132                 bf_imbuf_cineon
133                 bf_imbuf_openexr 
134                 extern_openjpeg
135                 extern_redcode
136                 bf_imbuf_dds
137                 bf_dna
138                 ge_videotex
139                 bf_blenfont
140                 bf_intern_audaspace
141                 blenkernel_blc
142                 bf_bmesh
143                 extern_binreloc
144                 extern_minilzo
145                 bf_intern_ghost # duplicate for linking
146                 bf_blenkernel # duplicate for linking
147                 bf_intern_mikktspace
148                 extern_recastnavigation
149                 bf_intern_raskter
150                 bf_intern_opencolorio
151                 bf_intern_opennl
152                 extern_rangetree
153                 extern_wcwidth
154         )
155
156         if(WITH_MOD_CLOTH_ELTOPO)
157                 list(APPEND BLENDER_SORTED_LIBS extern_eltopo)
158         endif()
159
160         if(NOT WITH_SYSTEM_GLEW)
161                 list(APPEND BLENDER_SORTED_LIBS extern_glew)
162         endif()
163
164         if(WITH_LZMA)
165                 list(APPEND BLENDER_SORTED_LIBS extern_lzma)
166         endif()
167
168         if(WITH_LIBMV)
169                 list(APPEND BLENDER_SORTED_LIBS extern_libmv)
170                 list(APPEND BLENDER_SORTED_LIBS extern_ceres)
171         endif()
172
173         list(APPEND BLENDER_SORTED_LIBS extern_colamd)
174
175         if(WITH_MOD_BOOLEAN)
176                 list(APPEND BLENDER_SORTED_LIBS bf_intern_bsp)
177                 list(APPEND BLENDER_SORTED_LIBS bf_intern_moto)
178         endif()
179
180         if(WITH_MOD_BOOLEAN)
181                 list(APPEND BLENDER_SORTED_LIBS extern_carve)
182         endif()
183
184         if(WITH_GHOST_XDND)
185                 list(APPEND BLENDER_SORTED_LIBS extern_xdnd)
186         endif()
187
188         if(WITH_CODEC_QUICKTIME)
189                 list(APPEND BLENDER_SORTED_LIBS bf_quicktime)
190         endif()
191
192         if(WITH_CXX_GUARDEDALLOC)
193                 list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
194         endif()
195
196         if(WITH_INTERNATIONAL)
197                 list(APPEND BLENDER_SORTED_LIBS bf_intern_locale)
198         endif()
199
200         foreach(SORTLIB ${BLENDER_SORTED_LIBS})
201                 set(REMLIB ${SORTLIB})
202                 foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
203                         if(${SEARCHLIB} STREQUAL ${SORTLIB})
204                                 set(REMLIB "")
205                         endif()
206                 endforeach()
207                 if(REMLIB)
208                         # message(STATUS "Removing library ${REMLIB} from blenderplayer linking because: not configured")
209                         list(APPEND REM_MSG ${REMLIB})
210                         list(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
211                 endif()
212         endforeach()
213         if(REM_MSG)
214                 list(SORT REM_MSG)
215                 message(STATUS "Player Skipping: (${REM_MSG})")
216         endif()
217         target_link_libraries(blenderplayer ${BLENDER_SORTED_LIBS})
218
219         unset(SEARCHLIB)
220         unset(SORTLIB)
221         unset(REMLIB)
222         unset(REM_MSG)
223
224 # else()
225 #       target_link_libraries(blenderplayer ${BLENDER_LINK_LIBS})
226 # endif()
227
228 if(WITH_PLAYER)
229         add_subdirectory(bad_level_call_stubs)
230 endif()
231
232 setup_liblinks(blenderplayer)