File: CMakeLists.txt

package info (click to toggle)
astromenace 1.3.2+repack-3
  • links: PTS, VCS
  • area: contrib
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 4,488 kB
  • ctags: 9,427
  • sloc: cpp: 61,665; makefile: 29; sh: 19
file content (254 lines) | stat: -rwxr-xr-x 7,510 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)

# project name
PROJECT(AstroMenace)




# AstroMenaceFS2VFS
# standalone pack utility for AstroMenace game (gamedata.vfs file)
IF(DEFINED FS2VFS)
	# sources
	FILE(GLOB astromenace_SRCS AstroMenaceSource/MainFS2VFS.cpp
			AstroMenaceSource/Core/VirtualFileSystem/VFS.cpp
			AstroMenaceSource/Core/VirtualFileSystem/Haff.cpp
			AstroMenaceSource/Core/VirtualFileSystem/RLE.cpp)

	# targets
	ADD_EXECUTABLE(AstroMenaceFS2VFS ${astromenace_SRCS})
	TARGET_LINK_LIBRARIES(AstroMenaceFS2VFS)
	SET_TARGET_PROPERTIES(AstroMenaceFS2VFS PROPERTIES COMPILE_FLAGS "-O2 -Wno-unused-result -Dvfs_pack_standalone")
ENDIF(DEFINED FS2VFS)





# depends
set(SDL_CONFIG "sdl-config" CACHE STRING "Path to sdl-config script")
EXEC_PROGRAM(${SDL_CONFIG} ARGS "--cflags" OUTPUT_VARIABLE SDL_CFLAGS)
ADD_DEFINITIONS(${SDL_CFLAGS})
EXEC_PROGRAM(${SDL_CONFIG} ARGS "--libs" OUTPUT_VARIABLE SDL_LIBS)


IF (NOT APPLE)
FIND_PACKAGE(X11 REQUIRED)
SET(ALL_LIBRARIES ${ALL_LIBRARIES} ${X11_LIBRARIES})
ENDIF (NOT APPLE)

FIND_PACKAGE(SDL REQUIRED)
SET(ALL_LIBRARIES ${ALL_LIBRARIES} ${SDL_LIBS})

FIND_PACKAGE(OpenGL REQUIRED)
IF(OPENGL_FOUND)
	INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
	SET(ALL_LIBRARIES ${ALL_LIBRARIES} ${OPENGL_gl_LIBRARY})
ELSE(OPENGL_FOUND)
	MESSAGE(FATAL_ERROR "OpenGL not found")
ENDIF(OPENGL_FOUND)

FIND_PACKAGE(OpenAL REQUIRED)
SET(ALL_LIBRARIES ${ALL_LIBRARIES} ${OPENAL_LIBRARY})



# Xinerama lib + header

IF (NOT APPLE)
FIND_LIBRARY(XINERAMA_LIBRARY Xinerama)
IF(XINERAMA_LIBRARY)
	MESSAGE(STATUS "Found Xinerama: ${XINERAMA_LIBRARY}")
	SET(ALL_LIBRARIES ${ALL_LIBRARIES} ${XINERAMA_LIBRARY})
ELSE(XINERAMA_LIBRARY)
	MESSAGE(STATUS "Xinerama library not found, Xinerama compilation feature disabled.")
ENDIF(XINERAMA_LIBRARY)
FIND_PATH(XINERAMA_INCLUDE_DIR X11/extensions/Xinerama.h
 	HINTS
 	PATHS
 	PATH_SUFFIXES include)
IF(XINERAMA_INCLUDE_DIR)
	MESSAGE(STATUS "Found Xinerama headers: ${XINERAMA_INCLUDE_DIR}")
	INCLUDE_DIRECTORIES(${XINERAMA_INCLUDE_DIR})
ELSE(XINERAMA_INCLUDE_DIR)
	MESSAGE(STATUS "Xinerama headers not found, Xinerama compilation feature disabled.")
ENDIF(XINERAMA_INCLUDE_DIR)
ENDIF (NOT APPLE)


# GLU lib + header (GLU - part of OpenGL framework in MacOSX)

IF (NOT APPLE)
FIND_LIBRARY(GLU_LIBRARY GLU)
IF(GLU_LIBRARY)
	MESSAGE(STATUS "Found GLU: ${GLU_LIBRARY}")
	SET(ALL_LIBRARIES ${ALL_LIBRARIES} ${GLU_LIBRARY})
ELSE(GLU_LIBRARY)
	MESSAGE(FATAL_ERROR "GLU not found")
ENDIF(GLU_LIBRARY)
FIND_PATH(GLU_INCLUDE_DIR GL/glu.h
 	HINTS
	$ENV{GLUTDIR}
	$ENV{GLU_PATH}
 	PATHS
 	PATH_SUFFIXES include/GL include)
IF(GLU_INCLUDE_DIR)
	MESSAGE(STATUS "Found GLU headers: ${GLU_INCLUDE_DIR}")
	INCLUDE_DIRECTORIES(${GLU_INCLUDE_DIR})
ELSE(GLU_INCLUDE_DIR)
	MESSAGE(FATAL_ERROR "GLU headers not found")
ENDIF(GLU_INCLUDE_DIR)
ENDIF (NOT APPLE)


# alut lib + header

FIND_LIBRARY(ALUT_LIBRARY alut)
IF(ALUT_LIBRARY)
	MESSAGE(STATUS "Found alut: ${ALUT_LIBRARY}")
	SET(ALL_LIBRARIES ${ALL_LIBRARIES} ${ALUT_LIBRARY})
ELSE(ALUT_LIBRARY)
	MESSAGE(FATAL_ERROR "alut not found")
ENDIF(ALUT_LIBRARY)
FIND_PATH(ALUT_INCLUDE_DIR alut.h
 	HINTS
	$ENV{ALUTDIR}
	$ENV{ALUT_PATH}
 	PATHS
 	PATH_SUFFIXES include/AL include)
IF(ALUT_INCLUDE_DIR)
	MESSAGE(STATUS "Found alut headers: ${ALUT_INCLUDE_DIR}")
	INCLUDE_DIRECTORIES(${ALUT_INCLUDE_DIR})
ELSE(ALUT_INCLUDE_DIR)
	MESSAGE(FATAL_ERROR "alut headers not found")
ENDIF(ALUT_INCLUDE_DIR)


# ogg lib + header

FIND_LIBRARY(OGG_LIBRARY ogg)
IF(OGG_LIBRARY)
	MESSAGE(STATUS "Found ogg: ${OGG_LIBRARY}")
	SET(ALL_LIBRARIES ${ALL_LIBRARIES} ${OGG_LIBRARY})
ELSE(OGG_LIBRARY)
	MESSAGE(FATAL_ERROR "ogg not found")
ENDIF(OGG_LIBRARY)
FIND_PATH(OGG_INCLUDE_DIR ogg/ogg.h
	HINTS
	$ENV{OGGDIR}
        $ENV{OGG_PATH}
 	PATHS
 	PATH_SUFFIXES include)
IF(OGG_INCLUDE_DIR)
	MESSAGE(STATUS "Found ogg headers: ${OGG_INCLUDE_DIR}")
	INCLUDE_DIRECTORIES(${OGG_INCLUDE_DIR})
ELSE(OGG_INCLUDE_DIR)
	MESSAGE(FATAL_ERROR "ogg headers not found")
ENDIF(OGG_INCLUDE_DIR)


# vorbis lib

FIND_LIBRARY(VORBIS_LIBRARY vorbis)
IF(VORBIS_LIBRARY)
	MESSAGE(STATUS "Found vorbis: ${VORBIS_LIBRARY}")
	SET(ALL_LIBRARIES ${ALL_LIBRARIES} ${VORBIS_LIBRARY})
ELSE(VORBIS_LIBRARY)
	MESSAGE(FATAL_ERROR "vorbis not found")
ENDIF(VORBIS_LIBRARY)


# vorbisfile lib + header

FIND_LIBRARY(VORBISFILE_LIBRARY vorbisfile)
IF(VORBISFILE_LIBRARY)
	MESSAGE(STATUS "Found vorbisfile: ${VORBISFILE_LIBRARY}")
	SET(ALL_LIBRARIES ${ALL_LIBRARIES} ${VORBISFILE_LIBRARY})
ELSE(VORBISFILE_LIBRARY)
	MESSAGE(FATAL_ERROR "vorbisfile not found")
ENDIF(VORBISFILE_LIBRARY)
FIND_PATH(VORBISFILE_INCLUDE_DIR vorbis/vorbisfile.h
	HINTS
        $ENV{VORBISFILEDIR}
        $ENV{VORBISFILE_PATH}
        $ENV{VORBISDIR}
        $ENV{VORBIS_PATH}
 	PATHS
 	PATH_SUFFIXES vorbis include)
IF(VORBISFILE_INCLUDE_DIR)
	MESSAGE(STATUS "Found vorbisfile headers: ${VORBISFILE_INCLUDE_DIR}")
	INCLUDE_DIRECTORIES(${VORBISFILE_INCLUDE_DIR})
ELSE(VORBISFILE_INCLUDE_DIR)
	MESSAGE(FATAL_ERROR "vorbisfile headers not found")
ENDIF(VORBISFILE_INCLUDE_DIR)


# freetype lib + header

FIND_LIBRARY(FREETYPE_LIBRARY freetype)
IF(FREETYPE_LIBRARY)
	MESSAGE(STATUS "Found freetype: ${FREETYPE_LIBRARY}")
	SET(ALL_LIBRARIES ${ALL_LIBRARIES} ${FREETYPE_LIBRARY})
ELSE(FREETYPE_LIBRARY)
	MESSAGE(FATAL_ERROR "freetype not found")
ENDIF(FREETYPE_LIBRARY)
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
	HINTS
	$ENV{FREETYPE_DIR}/include/freetype2
	PATHS
	PATH_SUFFIXES freetype2)
IF(FREETYPE_INCLUDE_DIR_freetype2)
	MESSAGE(STATUS "Found freetype2 headers: ${FREETYPE_INCLUDE_DIR_freetype2}")
	INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIR_freetype2})
ELSE(FREETYPE_INCLUDE_DIR_freetype2)
	EXEC_PROGRAM("freetype-config" ARGS "--cflags" OUTPUT_VARIABLE freetype2_CFLAGS)
	IF(freetype2_CFLAGS)
		MESSAGE(STATUS "Found freetype2 cflags: ${freetype2_CFLAGS}")
		ADD_DEFINITIONS(${freetype2_CFLAGS})
	ELSE(freetype2_CFLAGS)
		MESSAGE(FATAL_ERROR "freetype2 headers not found")
	ENDIF(freetype2_CFLAGS)
ENDIF(FREETYPE_INCLUDE_DIR_freetype2)


# fontconfig lib + header

IF (NOT APPLE)
FIND_LIBRARY(FONTCONFIG_LIBRARY fontconfig)
IF(FONTCONFIG_LIBRARY)
	MESSAGE(STATUS "Found fontconfig: ${FONTCONFIG_LIBRARY}")
	SET(ALL_LIBRARIES ${ALL_LIBRARIES} ${FONTCONFIG_LIBRARY})
ELSE(FONTCONFIG_LIBRARY)
	MESSAGE(STATUS "fontconfig library not found, fontconfig compilation feature disabled.")
ENDIF(FONTCONFIG_LIBRARY)
FIND_PATH(FONTCONFIG_INCLUDE_DIR_fontconfig fontconfig/fontconfig.h
	HINTS
	PATHS
	PATH_SUFFIXES fontconfig)
IF(FONTCONFIG_INCLUDE_DIR_fontconfig)
	MESSAGE(STATUS "Found fontconfig headers: ${FONTCONFIG_INCLUDE_DIR_fontconfig}")
	INCLUDE_DIRECTORIES(${FONTCONFIG_INCLUDE_DIR_fontconfig})
ELSE(FONTCONFIG_INCLUDE_DIR_fontconfig)
	MESSAGE(STATUS "fontconfig headers not found, fontconfig compilation feature disabled.")
ENDIF(FONTCONFIG_INCLUDE_DIR_fontconfig)
ENDIF (NOT APPLE)


# sources
FILE(GLOB_RECURSE astromenace_SRCS AstroMenaceSource/*.cpp)

# targets
IF(DEFINED DATADIR)
	ADD_DEFINITIONS(-DDATADIR=\\"${DATADIR}\\")
ENDIF(DEFINED DATADIR)
IF(XINERAMA_LIBRARY AND XINERAMA_INCLUDE_DIR)
	ADD_DEFINITIONS(-Dxinerama_detected_by_cmake)
ENDIF(XINERAMA_LIBRARY AND XINERAMA_INCLUDE_DIR)
IF(FONTCONFIG_LIBRARY AND FONTCONFIG_INCLUDE_DIR_fontconfig)
	ADD_DEFINITIONS(-Dfontconfig_detected_by_cmake)
ENDIF(FONTCONFIG_LIBRARY AND FONTCONFIG_INCLUDE_DIR_fontconfig)

# we need speed optimization flag Os, this could add up to 40% FPS in game
ADD_DEFINITIONS("-Os")
ADD_EXECUTABLE(AstroMenace ${astromenace_SRCS})
TARGET_LINK_LIBRARIES(AstroMenace ${ALL_LIBRARIES})