More CMake stuff

This commit is contained in:
2021-10-17 00:12:35 -07:00
parent f7165daa6d
commit b2e99bb976
8 changed files with 97 additions and 26 deletions

View File

@@ -11,35 +11,43 @@ set(CMAKE_C_STANDARD_REQUIRED ON)
# Set some global flags
add_compile_definitions(
_CRT_SECURE_NO_WARNINGS=1
SETTING_ASSET_PREFIX="../../../assets/"
ASSET_PREFIX="../../../assets/"
)
# Which game are we building?
if(TARGET_GAME STREQUAL poker)
add_compile_definitions(
GAME_NAME="Penny's Poker"
GAME_FILE="poker/game.h"
GAME_TYPE=pokergame_t
GAME_INIT=pokerGameInit
GAME_UPDATE=pokerGameUpdate
GAME_DISPOSE=pokerGameDispose
GAME_VERSION=1.0
)
# Do initial set up depending on the build target type.
if(TARGET_TYPE STREQUAL tool)
set(TARGET_NAME tool)
elseif(TARGET_TYPE STREQUAL test)
set(TARGET_NAME test)
else()
set(TARGET_NAME ${TARGET_GAME})
endif()
# Set up the project.
project(Dawn VERSION 1.0)
# Set up the project
project(${TARGET_NAME} VERSION 1.0)
add_executable(${PROJECT_NAME})
# Add libraries
add_subdirectory(lib)
# Now change sources depending on the target type
if(TARGET_TYPE STREQUAL tool)
# Add sources
add_subdirectory(src)
# Are we building a game, a tool or running tests?
if(TARGET_TYPE STREQUAL test)
elseif(TARGET_TYPE STREQUAL test)
add_subdirectory(test)
else()
if(TARGET_GAME STREQUAL poker)
add_compile_definitions(
GAME_NAME="Penny's Poker"
GAME_FILE="poker/game.h"
GAME_TYPE=pokergame_t
GAME_INIT=pokerGameInit
GAME_UPDATE=pokerGameUpdate
GAME_DISPOSE=pokerGameDispose
GAME_VERSION=1.0
)
endif()
add_subdirectory(client)
endif()
endif()
# Add global sources.
add_subdirectory(lib)
add_subdirectory(src)