Add option for CMake to build libredcode, also use CODEC prefix for ffmpeg, quicktime...
[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(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 FILE(READ ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt BLENDER_LINK_LIBS)
55
56 SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} ge_player_common ge_player_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                 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
103                 bf_python_ext
104                 bf_blenlib 
105                 bf_imbuf_cineon
106                 bf_imbuf_openexr 
107                 extern_openjpeg 
108                 bf_imbuf_dds
109                 bf_readblenfile 
110                 bf_dna
111                 ge_videotex
112                 bf_blenfont
113                 bf_intern_audaspace
114                 blenkernel_blc
115                 extern_binreloc
116                 extern_glew
117                 extern_minilzo
118                 bf_intern_ghost # duplicate for linking
119                 bf_blenkernel # duplicate for linking
120         )
121   
122         IF(WITH_CODEC_QUICKTIME)
123                 SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_quicktime)
124         ENDIF(WITH_CODEC_QUICKTIME)
125
126         IF(WITH_CXX_GUARDEDALLOC)
127                 SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_intern_guardedalloc_cpp)
128         ENDIF(WITH_CXX_GUARDEDALLOC)
129
130         FOREACH(SORTLIB ${BLENDER_SORTED_LIBS})
131                 SET(REMLIB ${SORTLIB})
132                 FOREACH(SEARCHLIB ${BLENDER_LINK_LIBS})
133                         IF(${SEARCHLIB} STREQUAL ${SORTLIB})
134                                 SET(REMLIB "")
135                         ENDIF(${SEARCHLIB} STREQUAL ${SORTLIB})
136                 ENDFOREACH(SEARCHLIB)
137                 IF(REMLIB)
138                         MESSAGE(STATUS "Removing library ${REMLIB} from blenderplayer linking because: not configured")
139                         LIST(REMOVE_ITEM BLENDER_SORTED_LIBS ${REMLIB})
140                 ENDIF(REMLIB)
141         ENDFOREACH(SORTLIB)
142
143         TARGET_LINK_LIBRARIES(blenderplayer ${BLENDER_SORTED_LIBS})
144 ELSE(UNIX)
145         TARGET_LINK_LIBRARIES(blenderplayer ${BLENDER_LINK_LIBS})
146 ENDIF(UNIX)
147
148 IF(WITH_PLAYER)
149         ADD_SUBDIRECTORY(bad_level_call_stubs)
150 ENDIF(WITH_PLAYER)
151
152 SETUP_LIBLINKS(blenderplayer)