townengine/apps/templates/zig/CMakeLists.txt
2025-03-10 09:58:28 +03:00

25 lines
583 B
CMake

cmake_minimum_required(VERSION 3.21)
project(twngame LANGUAGES C)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
add_subdirectory($ENV{TWNROOT} ${CMAKE_BINARY_DIR}/twn)
cmake_path(GET CMAKE_SOURCE_DIR STEM LAST_ONLY GAME_PROJECT_NAME)
put_townengine(${CMAKE_CURRENT_SOURCE_DIR})
# TODO: support static build
# TODO: propagate release switches
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/libgame.so
COMMAND env zig build
DEPENDS ${TWN_TARGET}
)
add_custom_target(
zig-step ALL
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libgame.so
)