add option WITH_BUILTIN_GLEW, so linux packagers can disable to use their own glew...
[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_ext
103                 bf_blenlib 
104                 bf_imbuf_cineon
105                 bf_imbuf_openexr 
106                 extern_openjpeg 
107                 bf_imbuf_dds
108                 bf_readblenfile 
109                 bf_dna
110                 ge_videotex
111                 bf_blenfont
112                 bf_intern_audaspace
113                 blenkernel_blc
114                 extern_binreloc
115                 extern_minilzo
116                 bf_intern_ghost # duplicate for linking
117                 bf_blenkernel # duplicate for linking
118                 bf_intern_mikktspace
119         )
120
121     if(WITH_BUILTIN_GLEW)
122                 list(APPEND BLENDER_SORTED_LIBS extern_glew)
123     endif()
124
125         if(WITH_LZMA)
126                 list(APPEND BLENDER_SORTED_LIBS extern_lzma)
127         endif()
128
129         if(WITH_MOD_DECIMATE)
130                 list(APPEND BLENDER_SORTED_LIBS bf_intern_decimate)
131         endif()
132
133         if(WITH_MOD_BOOLEAN)
134                 list(APPEND BLENDER_SORTED_LIBS bf_intern_bsp)
135                 list(APPEND BLENDER_SORTED_LIBS bf_intern_bop)
136                 list(APPEND BLENDER_SORTED_LIBS bf_intern_moto)
137         endif()
138
139         if(WITH_CODEC_QUICKTIME)
140                 list(APPEND BLENDER_SORTED_LIBS bf_quicktime)
141         endif()
142
143         if(WITH_CXX_GUARDEDALLOC)
144                 list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
145         endif()
146
147         foreach(SORTLIB ${BLENDER_SORTED_LIBS})
148                 set(REMLIB ${SORTLIB})
149                 foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
150                         if(${SEARCHLIB} STREQUAL ${SORTLIB})
151                                 set(REMLIB "")
152                         endif()
153                 endforeach()
154                 if(REMLIB)
155                         # message(STATUS "Removing library ${REMLIB} from blenderplayer linking because: not configured")
156                         list(APPEND REM_MSG ${REMLIB})
157                         list(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
158                 endif()
159         endforeach()
160         if(REM_MSG)
161                 list(SORT REM_MSG)
162                 message(STATUS "Player Skipping: (${REM_MSG})")
163         endif()
164         target_link_libraries(blenderplayer ${BLENDER_SORTED_LIBS})
165 else()
166         target_link_libraries(blenderplayer ${BLENDER_LINK_LIBS})
167 endif()
168
169 if(WITH_PLAYER)
170         add_subdirectory(bad_level_call_stubs)
171 endif()
172
173 setup_liblinks(blenderplayer)