svn merge -r37335:37500 https://svn.blender.org/svnroot/bf-blender/trunk/blender
[blender.git] / source / blenderplayer / CMakeLists.txt
1 # -*- mode: cmake; indent-tabs-mode: t; -*-
2 # $Id$
3 # ***** BEGIN GPL LICENSE BLOCK *****
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 #
19 # The Original Code is Copyright (C) 2006, Blender Foundation
20 # All rights reserved.
21 #
22 # The Original Code is: all of this file.
23 #
24 # Contributor(s): Jacques Beaurain.
25 #
26 # ***** END GPL LICENSE BLOCK *****
27
28 # message(STATUS "Configuring blenderplayer")
29
30 setup_libdirs()
31
32 if(WITH_CODEC_QUICKTIME)
33         add_definitions(-DWITH_QUICKTIME)
34 endif()
35
36 add_custom_command(
37         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dna.c
38         COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna ${CMAKE_CURRENT_BINARY_DIR}/dna.c ${CMAKE_SOURCE_DIR}/source/blender/makesdna/
39         DEPENDS ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna
40 )
41
42 if(WIN32 AND NOT UNIX)
43         string(SUBSTRING ${BLENDER_VERSION} 0 1 bver1)
44         string(SUBSTRING ${BLENDER_VERSION} 2 1 bver2)
45         string(SUBSTRING ${BLENDER_VERSION} 3 1 bver3)
46         if(MINGW)
47                 add_definitions(
48                         -DWINDRES
49                         -DBLEN_VER_RC_STR_M=${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         else()
56                 add_definitions(
57                         -DBLEN_VER_RC_STR=${BLENDER_VERSION}
58                         -DBLEN_VER_RC_1=${bver1}
59                         -DBLEN_VER_RC_2=${bver2}
60                         -DBLEN_VER_RC_3=${bver3}
61                         -DBLEN_VER_RC_4=0
62                 )
63         endif()
64
65         add_executable(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../icons/winblender.rc)
66 else()
67         add_executable(blenderplayer ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
68 endif()
69
70 add_dependencies(blenderplayer makesdna)
71
72 get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
73
74 list(APPEND BLENDER_LINK_LIBS
75         ge_player_common
76         ge_player_ghost
77         blenkernel_blc
78 )
79
80 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
81         list(APPEND BLENDER_LINK_LIBS extern_binreloc)
82 endif()
83
84 # if(UNIX)
85         # Sort libraries
86         set(BLENDER_SORTED_LIBS
87                 ge_player_ghost 
88                 ge_player_common 
89                 bf_intern_string 
90                 bf_intern_ghost
91                 bf_rna
92                 bf_bmesh
93                 bf_blenkernel
94                 bf_blenloader 
95                 bf_blenpluginapi 
96                 ge_blen_routines
97                 bf_editor_datafiles
98                 ge_converter 
99                 ge_logic_ketsji 
100                 ge_phys_bullet 
101                 ge_phys_dummy
102                 ge_phys_common 
103                 ge_logic 
104                 ge_rasterizer 
105                 ge_oglrasterizer 
106                 ge_logic_expressions 
107                 ge_scenegraph
108                 bf_ikplugin
109                 bf_intern_itasc
110                 bf_intern_ik
111                 bf_intern_smoke
112                 bf_modifiers
113                 bf_intern_moto 
114                 bf_nodes
115                 bf_gpu
116                 bf_imbuf
117                 bf_avi 
118                 ge_logic_network 
119                 ge_logic_ngnetwork 
120                 ge_logic_loopbacknetwork 
121                 extern_bullet 
122                 bf_intern_guardedalloc 
123                 bf_intern_memutil 
124                 bf_python_ext
125                 bf_blenlib 
126                 bf_imbuf_cineon
127                 bf_imbuf_openexr 
128                 extern_openjpeg
129                 extern_redcode
130                 bf_imbuf_dds
131                 bf_dna
132                 ge_videotex
133                 bf_blenfont
134                 bf_intern_audaspace
135                 blenkernel_blc
136                 bf_bmesh
137                 extern_binreloc
138                 extern_minilzo
139                 bf_intern_ghost # duplicate for linking
140                 bf_blenkernel # duplicate for linking
141                 bf_intern_mikktspace
142         )
143
144         if(WITH_BUILTIN_GLEW)
145                 list(APPEND BLENDER_SORTED_LIBS extern_glew)
146         endif()
147
148         if(WITH_LZMA)
149                 list(APPEND BLENDER_SORTED_LIBS extern_lzma)
150         endif()
151
152         if(WITH_MOD_DECIMATE)
153                 list(APPEND BLENDER_SORTED_LIBS bf_intern_decimate)
154         endif()
155
156         if(WITH_MOD_BOOLEAN)
157                 list(APPEND BLENDER_SORTED_LIBS bf_intern_bsp)
158                 list(APPEND BLENDER_SORTED_LIBS bf_intern_bop)
159                 list(APPEND BLENDER_SORTED_LIBS bf_intern_moto)
160         endif()
161
162         if(WITH_CODEC_QUICKTIME)
163                 list(APPEND BLENDER_SORTED_LIBS bf_quicktime)
164         endif()
165
166         if(WITH_CXX_GUARDEDALLOC)
167                 list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
168         endif()
169
170         foreach(SORTLIB ${BLENDER_SORTED_LIBS})
171                 set(REMLIB ${SORTLIB})
172                 foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
173                         if(${SEARCHLIB} STREQUAL ${SORTLIB})
174                                 set(REMLIB "")
175                         endif()
176                 endforeach()
177                 if(REMLIB)
178                         # message(STATUS "Removing library ${REMLIB} from blenderplayer linking because: not configured")
179                         list(APPEND REM_MSG ${REMLIB})
180                         list(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
181                 endif()
182         endforeach()
183         if(REM_MSG)
184                 list(SORT REM_MSG)
185                 message(STATUS "Player Skipping: (${REM_MSG})")
186         endif()
187         target_link_libraries(blenderplayer ${BLENDER_SORTED_LIBS})
188
189         unset(SEARCHLIB)
190         unset(SORTLIB)
191         unset(REMLIB)
192         unset(REM_MSG)
193
194 # else()
195 #       target_link_libraries(blenderplayer ${BLENDER_LINK_LIBS})
196 # endif()
197
198 if(WITH_PLAYER)
199         add_subdirectory(bad_level_call_stubs)
200 endif()
201
202 setup_liblinks(blenderplayer)