CMake builds
This weekend I’ve finally got around writing a CMake build system for Tremulous. Unlike every other Quake3 fork which has done a this, ours is actually good. Anyone familiar with modding Tremulous previously would likely be aware of the monolith Makefile. Modders may also no be aware that it’s Just Wrong!
Build just the game
And now we can rebuild the game logic like so:
$ cd tremulous
$ cmake ..
$ gmake game game.qvm
Whats involved?
This system adds CMakeLists.txt
files in more appropriate places, these files define how to build the code. The game code is compiled by the rules in src/game/CMakeLists.txt
.
##src/game/CMakeLists.txt
#
## ____ _
## / ___| __ _ _ __ ___ ___ ___ ___ __| | ___
## | | _ / _` | '_ ` _ \ / _ \ / __/ _ \ / _` |/ _ \
## | |_| | (_| | | | | | | __/ | (_| (_) | (_| | __/
## \____|\__,_|_| |_| |_|\___| \___\___/ \__,_|\___|
##
#
set(QC_SOURCE_DIR ../qcommon)
add_definitions( -DGAME )
set( GAME_SOURCES
g_main.c # Must be listed first!
bg_alloc.c
bg_lib.c
bg_lib.h
bg_local.h
bg_misc.c
bg_pmove.c
bg_public.h
bg_slidemove.c
bg_voice.c
g_active.c
g_admin.c
g_admin.h
g_buildable.c
g_client.c
g_cmds.c
g_combat.c
g_local.h
g_maprotation.c
g_misc.c
g_missile.c
g_mover.c
g_namelog.c
g_physics.c
g_playermodel.c
g_public.h
g_session.c
g_spawn.c
g_svcmds.c
g_target.c
g_team.c
g_trigger.c
g_utils.c
g_weapon.c
g_weapondrop.c
tremulous.h
${QC_SOURCE_DIR}/q_shared.h
${QC_SOURCE_DIR}/q_shared.c
${QC_SOURCE_DIR}/q_math.c
)
add_library(
game SHARED
${GAME_SOURCES}
g_syscalls.c
)
add_qvm(
game
${GAME_SOURCES}
g_syscalls.asm
)
This is only available in our private repo for the time being.