Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 470365f

Browse files
committedApr 27, 2021
Build: Convert CMakeLists.txt to be more Serenity friendly
1 parent d26d008 commit 470365f

File tree

2 files changed

+6
-69
lines changed

2 files changed

+6
-69
lines changed
 

‎CMakeLists.txt

-9
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,7 @@ cmake_policy(SET CMP0048 NEW)
33

44
project (quake2sdl VERSION 0.17)
55

6-
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/Modules")
76
set (CMAKE_C_FLAGS_RELEASE "-O3")
87
find_package (SDL2 REQUIRED)
9-
find_package (OpenGL REQUIRED)
10-
11-
option (WITH_RETEX "Support for retexture" OFF)
12-
option (WITH_QMAX "Improved graphics" OFF)
13-
14-
if (WITH_QMAX)
15-
find_package (JPEG REQUIRED)
16-
endif (WITH_QMAX)
178

189
add_subdirectory (src)

‎src/CMakeLists.txt

+6-60
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,7 @@ set (quake_resource_libdir ${CMAKE_INSTALL_PREFIX}/lib/quake2sdl)
22
set (quake_resource_datadir ${CMAKE_INSTALL_PREFIX}/share/quake2)
33
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/q_resources.h.in ${CMAKE_CURRENT_BINARY_DIR}/q_resources.h)
44

5-
add_definitions (-DHAVE_IPV6 -DLINUX_VERSION="1")
6-
include_directories (${SDL2_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${OPENGL_INCLUDE_DIR})
7-
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
8-
add_definitions (-DHAVE_SIN6_LEN)
9-
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
10-
# Linux-specific stuff like mremap
11-
add_definitions (-D_GNU_SOURCE)
12-
endif ()
13-
14-
if (WITH_RETEX)
15-
add_definitions (-DRETEX)
16-
endif (WITH_RETEX)
17-
18-
if (WITH_QMAX)
19-
add_definitions (-DQMAX)
20-
include_directories (${JPEG_INCLUDE_DIR})
21-
endif (WITH_QMAX)
5+
include_directories (${SDL2_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
226

237
set (Q2_SOURCES
248
client/cl_cin.c
@@ -65,22 +49,14 @@ set (Q2_SOURCES
6549
linux/vid_so.c
6650
linux/sys_linux.c
6751
linux/glob.c
68-
linux/net_udp6.c
52+
linux/net_udp.c
6953
game/q_shared.c
7054
linux/snd_sdl.c
71-
)
72-
73-
if (WITH_QMAX)
74-
set (Q2_SOURCES ${Q2_SOURCES} client/cl_fxmax.c)
75-
else (WITH_QMAX)
76-
set (Q2_SOURCES ${Q2_SOURCES} client/cl_fx.c)
77-
endif (WITH_QMAX)
55+
)
7856

57+
set (Q2_SOURCES ${Q2_SOURCES} client/cl_fx.c)
7958
add_executable (quake2 ${Q2_SOURCES})
80-
target_link_libraries (quake2 ${SDL2_LIBRARY} m)
81-
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
82-
target_link_libraries (quake2 dl)
83-
endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
59+
target_link_libraries (quake2 dl SDL2 pthread gfx gui c m)
8460

8561
add_library (ref-softsdl SHARED
8662
ref_soft/r_aclip.c
@@ -108,36 +84,6 @@ add_library (ref-softsdl SHARED
10884
)
10985
set_target_properties (ref-softsdl PROPERTIES OUTPUT_NAME ref_softsdl PREFIX "")
11086

111-
if (WITH_QMAX)
112-
set (GL_DIR ref_candygl)
113-
else (WITH_QMAX)
114-
set (GL_DIR ref_gl)
115-
endif (WITH_QMAX)
116-
117-
add_library (ref-sdlgl SHARED
118-
${GL_DIR}/gl_draw.c
119-
${GL_DIR}/gl_image.c
120-
${GL_DIR}/gl_light.c
121-
${GL_DIR}/gl_mesh.c
122-
${GL_DIR}/gl_model.c
123-
${GL_DIR}/gl_rmain.c
124-
${GL_DIR}/gl_rmisc.c
125-
${GL_DIR}/gl_rsurf.c
126-
${GL_DIR}/gl_warp.c
127-
linux/qgl_linux.c
128-
game/q_shared.c
129-
linux/q_shlinux.c
130-
linux/glob.c
131-
linux/rw_sdl.c
132-
linux/rw_linux.c
133-
linux/joystick.c
134-
)
135-
if (WITH_QMAX)
136-
target_link_libraries (ref-sdlgl ${JPEG_LIBRARY})
137-
endif (WITH_QMAX)
138-
target_compile_definitions (ref-sdlgl PRIVATE -DOPENGL)
139-
set_target_properties (ref-sdlgl PROPERTIES OUTPUT_NAME ref_sdlgl PREFIX "")
140-
14187
add_library (game-base SHARED
14288
game/g_ai.c
14389
game/p_client.c
@@ -190,5 +136,5 @@ add_library (game-base SHARED
190136
set_target_properties (game-base PROPERTIES OUTPUT_NAME game PREFIX "")
191137

192138
install (TARGETS quake2 RUNTIME DESTINATION bin)
193-
install (TARGETS ref-softsdl ref-sdlgl LIBRARY DESTINATION lib/quake2sdl)
139+
install (TARGETS ref-softsdl LIBRARY DESTINATION lib/quake2sdl)
194140
install (TARGETS game-base LIBRARY DESTINATION lib/quake2sdl/baseq2)

0 commit comments

Comments
 (0)
Please sign in to comment.