37 lines
951 B
CMake
37 lines
951 B
CMake
cmake_minimum_required(VERSION 3.14)
|
|
project(mons_exe LANGUAGES C)
|
|
set(CMAKE_C_STANDARD 99)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS true)
|
|
set(CMAKE_BUILD_TYPE "Debug")
|
|
|
|
add_custom_target(hexdump_embeds
|
|
./embed_headers.sh
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
)
|
|
|
|
add_executable(mons_exe
|
|
./src/main.c
|
|
./src/input.c
|
|
)
|
|
|
|
target_include_directories(mons_exe PUBLIC
|
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/include"
|
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
|
)
|
|
target_compile_options(mons_exe PRIVATE -coverage)
|
|
target_link_options(mons_exe PRIVATE -coverage)
|
|
target_link_libraries(mons_exe PUBLIC mons_3d mons_gltf X11)
|
|
add_dependencies(mons_exe hexdump_embeds)
|
|
|
|
include(CTest)
|
|
|
|
function(TESTCASE NAME)
|
|
add_executable(test_${NAME} ./tests/${NAME}.c)
|
|
target_link_libraries(test_${NAME} PUBLIC mons_exe)
|
|
add_test(
|
|
NAME ${NAME}
|
|
COMMAND $<TARGET_FILE:test_${NAME}>
|
|
)
|
|
endfunction()
|
|
|