build python module without binreloc, add dummy argv[0] to initialize bprogname.
[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 if(WITH_BINRELOC)
37         add_definitions(-DWITH_BINRELOC)
38         blender_include_dirs(${BINRELOC_INC})
39 endif()
40
41 add_custom_command(
42         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dna.c
43         COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna ${CMAKE_CURRENT_BINARY_DIR}/dna.c ${CMAKE_SOURCE_DIR}/source/blender/makesdna/
44         DEPENDS ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna
45 )
46
47 if(WIN32 AND NOT UNIX)
48         add_executable(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../icons/winblender.rc)
49 else()
50         add_executable(blenderplayer ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
51 endif()
52
53 add_dependencies(blenderplayer makesdna)
54
55 get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
56
57 list(APPEND BLENDER_LINK_LIBS
58         ge_player_common
59         ge_player_ghost
60         blenkernel_blc
61 )
62
63 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
64         list(APPEND BLENDER_LINK_LIBS extern_binreloc)
65 endif()
66
67 if(UNIX)
68         # Sort libraries
69         set(BLENDER_SORTED_LIBS
70                 ge_player_ghost 
71                 ge_player_common 
72                 bf_intern_string 
73                 bf_intern_ghost
74                 bf_rna
75                 bf_blenkernel
76                 bf_blenloader 
77                 bf_blenpluginapi 
78                 ge_blen_routines
79                 bf_editor_datafiles
80                 ge_converter 
81                 ge_logic_ketsji 
82                 ge_phys_bullet 
83                 ge_phys_dummy
84                 ge_phys_common 
85                 ge_logic 
86                 ge_rasterizer 
87                 ge_oglrasterizer 
88                 ge_logic_expressions 
89                 ge_scenegraph
90                 bf_ikplugin
91                 bf_intern_itasc
92                 bf_intern_ik
93                 bf_intern_smoke
94                 bf_modifiers
95                 bf_intern_moto 
96                 bf_gen_system 
97                 bf_nodes
98                 bf_gpu
99                 bf_imbuf
100                 bf_avi 
101                 ge_logic_network 
102                 ge_logic_ngnetwork 
103                 ge_logic_loopbacknetwork 
104                 extern_bullet 
105                 bf_intern_guardedalloc 
106                 bf_intern_memutil 
107                 bf_python
108                 bf_python_ext
109                 bf_blenlib 
110                 bf_imbuf_cineon
111                 bf_imbuf_openexr 
112                 extern_openjpeg 
113                 bf_imbuf_dds
114                 bf_readblenfile 
115                 bf_dna
116                 ge_videotex
117                 bf_blenfont
118                 bf_intern_audaspace
119                 blenkernel_blc
120                 extern_binreloc
121                 extern_glew
122                 extern_minilzo
123                 bf_intern_ghost # duplicate for linking
124                 bf_blenkernel # duplicate for linking
125                 bf_intern_mikktspace
126         )
127
128         if(WITH_CODEC_QUICKTIME)
129                 list(APPEND BLENDER_SORTED_LIBS bf_quicktime)
130         endif()
131
132         if(WITH_CXX_GUARDEDALLOC)
133                 list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
134         endif()
135
136         foreach(SORTLIB ${BLENDER_SORTED_LIBS})
137                 set(REMLIB ${SORTLIB})
138                 foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
139                         if(${SEARCHLIB} STREQUAL ${SORTLIB})
140                                 set(REMLIB "")
141                         endif()
142                 endforeach()
143                 if(REMLIB)
144                         # message(STATUS "Removing library ${REMLIB} from blenderplayer linking because: not configured")
145                         list(APPEND REM_MSG ${REMLIB})
146                         list(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
147                 endif()
148         endforeach()
149         if(REM_MSG)
150                 list(SORT REM_MSG)
151                 message(STATUS "Player Skipping: (${REM_MSG})")
152         endif()
153         target_link_libraries(blenderplayer ${BLENDER_SORTED_LIBS})
154 else()
155         target_link_libraries(blenderplayer ${BLENDER_LINK_LIBS})
156 endif()
157
158 if(WITH_PLAYER)
159         add_subdirectory(bad_level_call_stubs)
160 endif()
161
162 setup_liblinks(blenderplayer)