CMake: use a global list to store libraries built rather then cmake_blender_libs...
[blender.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(WITH_CODEC_QUICKTIME)
34
35 IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
36         ADD_DEFINITIONS(-DWITH_BINRELOC)
37         INCLUDE_DIRECTORIES(${BINRELOC_INC})
38 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
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(WIN32 AND NOT UNIX)
49         ADD_EXECUTABLE(blenderplayer ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
50 ENDIF(WIN32 AND NOT UNIX)
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(CMAKE_SYSTEM_NAME MATCHES "Linux")
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(WITH_CODEC_QUICKTIME)
129
130         IF(WITH_CXX_GUARDEDALLOC)
131                 LIST(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
132         ENDIF(WITH_CXX_GUARDEDALLOC)
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(${SEARCHLIB} STREQUAL ${SORTLIB})
140                 ENDFOREACH(SEARCHLIB)
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(REMLIB)
145         ENDFOREACH(SORTLIB)
146
147         TARGET_LINK_LIBRARIES(blenderplayer ${BLENDER_SORTED_LIBS})
148 ELSE(UNIX)
149         TARGET_LINK_LIBRARIES(blenderplayer ${BLENDER_LINK_LIBS})
150 ENDIF(UNIX)
151
152 IF(WITH_PLAYER)
153         ADD_SUBDIRECTORY(bad_level_call_stubs)
154 ENDIF(WITH_PLAYER)
155
156 SETUP_LIBLINKS(blenderplayer)