8fcea674ebbe62ac7bb8a27908cb31d44d1f75f1
[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_QUICKTIME)
32         ADD_DEFINITIONS(-DWITH_QUICKTIME)
33 ENDIF(WITH_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)
47         ADD_EXECUTABLE(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../icons/winblender.rc)
48 ELSE(WIN32)
49         ADD_EXECUTABLE(blenderplayer ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
50 ENDIF(WIN32)
51
52 ADD_DEPENDENCIES(blenderplayer makesdna)
53
54 FILE(READ ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt BLENDER_LINK_LIBS)
55
56 SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} gp_common gp_ghost blenkernel_blc)
57
58 IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
59         SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} extern_binreloc)
60 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
61
62 IF(UNIX)
63         # Sort libraries
64         SET(BLENDER_SORTED_LIBS
65                 gp_ghost 
66                 gp_common 
67                 bf_intern_string 
68                 bf_intern_ghost 
69                 bf_rna
70                 bf_blenkernel
71                 bf_blenloader 
72                 bf_blenpluginapi 
73                 bf_blroutines 
74                 bf_converter 
75                 bf_ketsji 
76                 bf_bullet 
77                 bf_common 
78                 bf_dummy 
79                 bf_logic 
80                 bf_rasterizer 
81                 bf_oglrasterizer 
82                 bf_expressions 
83                 bf_scenegraph
84                 bf_ikplugin
85                 bf_intern_itasc
86                 bf_intern_ik
87                 bf_intern_smoke
88                 bf_modifiers
89                 bf_intern_moto 
90                 bf_kernel 
91                 bf_nodes
92                 bf_gpu
93                 bf_imbuf
94                 bf_avi 
95                 kx_network 
96                 bf_ngnetwork 
97                 bf_loopbacknetwork 
98                 extern_bullet 
99                 bf_intern_guardedalloc 
100                 bf_intern_memutil 
101                 bf_python
102                 bf_python_ext
103                 bf_blenlib 
104                 bf_cineon
105                 bf_openexr 
106                 extern_openjpeg 
107                 bf_dds
108                 bf_readblenfile 
109                 bf_dna
110                 bf_videotex
111                 bf_blenfont
112                 bf_intern_audaspace
113                 blenkernel_blc
114                 extern_binreloc
115                 extern_glew
116         )
117   
118         IF(WITH_QUICKTIME)
119                 SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_quicktime)
120         ENDIF(WITH_QUICKTIME)
121
122         IF(WITH_CXX_GUARDEDALLOC)
123                 SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_intern_guardedalloc_cpp)
124         ENDIF(WITH_CXX_GUARDEDALLOC)
125
126         FOREACH(SORTLIB ${BLENDER_SORTED_LIBS})
127                 SET(REMLIB ${SORTLIB})
128                 FOREACH(SEARCHLIB ${BLENDER_LINK_LIBS})
129                         IF(${SEARCHLIB} STREQUAL ${SORTLIB})
130                                 SET(REMLIB "")
131                         ENDIF(${SEARCHLIB} STREQUAL ${SORTLIB})
132                 ENDFOREACH(SEARCHLIB)
133                 IF(REMLIB)
134                         MESSAGE(STATUS "Removing library ${REMLIB} from blenderplayer linking because: not configured")
135                         LIST(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
136                 ENDIF(REMLIB)
137         ENDFOREACH(SORTLIB)
138
139         TARGET_LINK_LIBRARIES(blenderplayer ${BLENDER_SORTED_LIBS})
140 ELSE(UNIX)
141         TARGET_LINK_LIBRARIES(blenderplayer ${BLENDER_LINK_LIBS})
142 ENDIF(UNIX)
143
144 IF(WITH_PLAYER)
145         ADD_SUBDIRECTORY(bad_level_call_stubs)
146 ENDIF(WITH_PLAYER)
147
148 SETUP_LIBLINKS(blenderplayer)