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