46a1d41d0988d1441ecac746aa4b1d6651bd5ddf
[blender-staging.git] / source / blenderplayer / CMakeLists.txt
1 # $Id$
2 # ***** BEGIN GPL LICENSE BLOCK *****
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software Foundation,
16 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 #
18 # The Original Code is Copyright (C) 2006, Blender Foundation
19 # All rights reserved.
20 #
21 # The Original Code is: all of this file.
22 #
23 # Contributor(s): Jacques Beaurain.
24 #
25 # ***** END GPL LICENSE BLOCK *****
26
27 message(STATUS "Configuring blenderplayer")
28
29 setup_libdirs()
30
31 if(WITH_CODEC_QUICKTIME)
32         add_definitions(-DWITH_QUICKTIME)
33 endif()
34
35 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
36         add_definitions(-DWITH_BINRELOC)
37         include_directories(${BINRELOC_INC})
38 endif()
39
40 add_custom_command(
41         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dna.c
42         COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna ${CMAKE_CURRENT_BINARY_DIR}/dna.c ${CMAKE_SOURCE_DIR}/source/blender/makesdna/
43         DEPENDS ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna
44 )
45
46 if(WIN32 AND NOT UNIX)
47         add_executable(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../icons/winblender.rc)
48 else()
49         add_executable(blenderplayer ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
50 endif()
51
52 add_dependencies(blenderplayer makesdna)
53
54 get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
55
56 list(APPEND BLENDER_LINK_LIBS
57         ge_player_common
58         ge_player_ghost
59         blenkernel_blc
60 )
61
62 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
63         list(APPEND BLENDER_LINK_LIBS extern_binreloc)
64 endif()
65
66 if(UNIX)
67         # Sort libraries
68         set(BLENDER_SORTED_LIBS
69                 ge_player_ghost 
70                 ge_player_common 
71                 bf_intern_string 
72                 bf_intern_ghost
73                 bf_rna
74                 bf_blenkernel
75                 bf_blenloader 
76                 bf_blenpluginapi 
77                 ge_blen_routines
78                 bf_editor_datafiles
79                 ge_converter 
80                 ge_logic_ketsji 
81                 ge_phys_bullet 
82                 ge_phys_dummy
83                 ge_phys_common 
84                 ge_logic 
85                 ge_rasterizer 
86                 ge_oglrasterizer 
87                 ge_logic_expressions 
88                 ge_scenegraph
89                 bf_ikplugin
90                 bf_intern_itasc
91                 bf_intern_ik
92                 bf_intern_smoke
93                 bf_modifiers
94                 bf_intern_moto 
95                 bf_gen_system 
96                 bf_nodes
97                 bf_gpu
98                 bf_imbuf
99                 bf_avi 
100                 ge_logic_network 
101                 ge_logic_ngnetwork 
102                 ge_logic_loopbacknetwork 
103                 extern_bullet 
104                 bf_intern_guardedalloc 
105                 bf_intern_memutil 
106                 bf_python
107                 bf_python_ext
108                 bf_blenlib 
109                 bf_imbuf_cineon
110                 bf_imbuf_openexr 
111                 extern_openjpeg 
112                 bf_imbuf_dds
113                 bf_readblenfile 
114                 bf_dna
115                 ge_videotex
116                 bf_blenfont
117                 bf_intern_audaspace
118                 blenkernel_blc
119                 extern_binreloc
120                 extern_glew
121                 extern_minilzo
122                 bf_intern_ghost # duplicate for linking
123                 bf_blenkernel # duplicate for linking
124         )
125   
126         if(WITH_CODEC_QUICKTIME)
127                 list(APPEND BLENDER_SORTED_LIBS bf_quicktime)
128         endif()
129
130         if(WITH_CXX_GUARDEDALLOC)
131                 list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
132         endif()
133
134         foreach(SORTLIB ${BLENDER_SORTED_LIBS})
135                 set(REMLIB ${SORTLIB})
136                 foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
137                         if(${SEARCHLIB} STREQUAL ${SORTLIB})
138                                 set(REMLIB "")
139                         endif()
140                 endforeach()
141                 if(REMLIB)
142                         message(STATUS "Removing library ${REMLIB} from blenderplayer linking because: not configured")
143                         list(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
144                 endif()
145         endforeach()
146
147         target_link_libraries(blenderplayer ${BLENDER_SORTED_LIBS})
148 else()
149         target_link_libraries(blenderplayer ${BLENDER_LINK_LIBS})
150 endif()
151
152 if(WITH_PLAYER)
153         add_subdirectory(bad_level_call_stubs)
154 endif()
155
156 setup_liblinks(blenderplayer)