Dawn/CMakeLists.txt
2021-10-17 11:08:40 -07:00

63 lines
1.5 KiB
CMake

# Copyright (c) 2021 Dominic Msters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
# Set up the base CMake stuff.
cmake_minimum_required(VERSION 3.13)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
# Set some global flags
add_compile_definitions(
_CRT_SECURE_NO_WARNINGS=1
ASSET_PREFIX="../../../assets/"
)
# Do initial set up depending on the build target type.
if(TARGET_TYPE STREQUAL test)
set(TARGET_NAME test)
elseif(TARGET_TYPE STREQUAL game)
set(TARGET_NAME ${TARGET_GAME})
else()
message(FATAL_ERROR "Missing or invalid definition of TARGET_TYPE")
endif()
# Set up the project
project(${TARGET_NAME} VERSION 1.0)
add_executable(${PROJECT_NAME})
# Variables
SET(ROOT_DIR "${CMAKE_SOURCE_DIR}")
set(TOOLS_DIR "${ROOT_DIR}/tools")
# Include tools
add_subdirectory(tools)
# Now change sources depending on the target type
if(TARGET_TYPE STREQUAL test)
add_subdirectory(test)
elseif(TARGET_TYPE STREQUAL game)
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
)
set(DIR_CHARS assets/poker/characters/penny)
tool_vn_character(penny ${DIR_CHARS}/character.xml ${DIR_CHARS}/bruh.png)
add_dependencies(${PROJECT_NAME} penny)
endif()
add_subdirectory(client)
endif()
# Add global sources.
add_subdirectory(lib)
add_subdirectory(src)