27 lines
668 B
CMake
27 lines
668 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})
|
|
|
|
file(GLOB_RECURSE zig-sources ${CMAKE_CURRENT_SOURCE_DIR}/src/*.zig)
|
|
|
|
# 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} ${zig-sources}
|
|
)
|
|
|
|
add_custom_target(
|
|
zig-step ALL
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libgame.so
|
|
)
|