1f796e86693a713f2b6ced0187608461b3aacb55
[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         add_definitions(
47                 -DBLEN_VER_RC_STR=${BLENDER_VERSION}
48                 -DBLEN_VER_RC_1=${bver1}
49                 -DBLEN_VER_RC_2=${bver2}
50                 -DBLEN_VER_RC_3=${bver3}
51                 -DBLEN_VER_RC_4=0
52         )
53         add_executable(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../icons/winblender.rc)
54 else()
55         add_executable(blenderplayer ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
56 endif()
57
58 add_dependencies(blenderplayer makesdna)
59
60 get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
61
62 list(APPEND BLENDER_LINK_LIBS
63         ge_player_common
64         ge_player_ghost
65         blenkernel_blc
66 )
67
68 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
69         list(APPEND BLENDER_LINK_LIBS extern_binreloc)
70 endif()
71
72 # if(UNIX)
73         # Sort libraries
74         set(BLENDER_SORTED_LIBS
75                 ge_player_ghost 
76                 ge_player_common 
77                 bf_intern_string 
78                 bf_intern_ghost
79                 bf_rna
80                 bf_blenkernel
81                 bf_blenloader 
82                 bf_blenpluginapi 
83                 ge_blen_routines
84                 bf_editor_datafiles
85                 ge_converter 
86                 ge_logic_ketsji 
87                 ge_phys_bullet 
88                 ge_phys_dummy
89                 ge_phys_common 
90                 ge_logic 
91                 ge_rasterizer 
92                 ge_oglrasterizer 
93                 ge_logic_expressions 
94                 ge_scenegraph
95                 bf_ikplugin
96                 bf_intern_itasc
97                 bf_intern_ik
98                 bf_intern_smoke
99                 bf_modifiers
100                 bf_intern_moto 
101                 bf_gen_system 
102                 bf_nodes
103                 bf_gpu
104                 bf_imbuf
105                 bf_avi 
106                 ge_logic_network 
107                 ge_logic_ngnetwork 
108                 ge_logic_loopbacknetwork 
109                 extern_bullet 
110                 bf_intern_guardedalloc 
111                 bf_intern_memutil 
112                 bf_python_ext
113                 bf_blenlib 
114                 bf_imbuf_cineon
115                 bf_imbuf_openexr 
116                 extern_openjpeg
117                 extern_redcode
118                 bf_imbuf_dds
119                 bf_readblenfile 
120                 bf_dna
121                 ge_videotex
122                 bf_blenfont
123                 bf_intern_audaspace
124                 blenkernel_blc
125                 extern_binreloc
126                 extern_minilzo
127                 bf_intern_ghost # duplicate for linking
128                 bf_blenkernel # duplicate for linking
129                 bf_intern_mikktspace
130         )
131
132         if(WITH_BUILTIN_GLEW)
133                 list(APPEND BLENDER_SORTED_LIBS extern_glew)
134         endif()
135
136         if(WITH_LZMA)
137                 list(APPEND BLENDER_SORTED_LIBS extern_lzma)
138         endif()
139
140         if(WITH_MOD_DECIMATE)
141                 list(APPEND BLENDER_SORTED_LIBS bf_intern_decimate)
142         endif()
143
144         if(WITH_MOD_BOOLEAN)
145                 list(APPEND BLENDER_SORTED_LIBS bf_intern_bsp)
146                 list(APPEND BLENDER_SORTED_LIBS bf_intern_bop)
147                 list(APPEND BLENDER_SORTED_LIBS bf_intern_moto)
148         endif()
149
150         if(WITH_CODEC_QUICKTIME)
151                 list(APPEND BLENDER_SORTED_LIBS bf_quicktime)
152         endif()
153
154         if(WITH_CXX_GUARDEDALLOC)
155                 list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
156         endif()
157
158         foreach(SORTLIB ${BLENDER_SORTED_LIBS})
159                 set(REMLIB ${SORTLIB})
160                 foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
161                         if(${SEARCHLIB} STREQUAL ${SORTLIB})
162                                 set(REMLIB "")
163                         endif()
164                 endforeach()
165                 if(REMLIB)
166                         # message(STATUS "Removing library ${REMLIB} from blenderplayer linking because: not configured")
167                         list(APPEND REM_MSG ${REMLIB})
168                         list(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
169                 endif()
170         endforeach()
171         if(REM_MSG)
172                 list(SORT REM_MSG)
173                 message(STATUS "Player Skipping: (${REM_MSG})")
174         endif()
175         target_link_libraries(blenderplayer ${BLENDER_SORTED_LIBS})
176 # else()
177 #       target_link_libraries(blenderplayer ${BLENDER_LINK_LIBS})
178 # endif()
179
180 if(WITH_PLAYER)
181         add_subdirectory(bad_level_call_stubs)
182 endif()
183
184 setup_liblinks(blenderplayer)