mirror of
https://git.shylie.info/shylie/glerminal.git
synced 2024-11-14 13:40:04 +00:00
56 lines
1.3 KiB
CMake
56 lines
1.3 KiB
CMake
cmake_minimum_required(VERSION 3.28)
|
|
|
|
set(CMAKE_FOLDER tests)
|
|
|
|
add_library(test-common STATIC
|
|
${CMAKE_SOURCE_DIR}/source/glad/glad.h
|
|
|
|
test-common/test-common.h
|
|
test-common/stb_image_write.h
|
|
test-common/test-common.cpp
|
|
)
|
|
|
|
target_include_directories(test-common
|
|
PUBLIC
|
|
test-common
|
|
PRIVATE
|
|
${CMAKE_SOURCE_DIR}/source
|
|
)
|
|
|
|
target_link_libraries(test-common PRIVATE glerminallib)
|
|
|
|
file(GLOB_RECURSE
|
|
TEST_RESOURCES
|
|
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
|
CONFIGURE_DEPENDS
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/resources/**.png
|
|
)
|
|
|
|
foreach(RESOURCE_FILE ${TEST_RESOURCES})
|
|
add_custom_command(
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${RESOURCE_FILE}
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
${CMAKE_CURRENT_SOURCE_DIR}/${RESOURCE_FILE}
|
|
${CMAKE_CURRENT_BINARY_DIR}/${RESOURCE_FILE}
|
|
DEPENDS
|
|
${CMAKE_CURRENT_SOURCE_DIR}/${RESOURCE_FILE}
|
|
)
|
|
endforeach()
|
|
|
|
file(GLOB_RECURSE
|
|
TEST_SOURCES
|
|
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
|
CONFIGURE_DEPENDS
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
|
|
)
|
|
|
|
list(REMOVE_ITEM TEST_SOURCES test-common/test-common.cpp)
|
|
list(TRANSFORM TEST_RESOURCES PREPEND ${CMAKE_CURRENT_BINARY_DIR}/)
|
|
|
|
foreach(SOURCE_FILE ${TEST_SOURCES})
|
|
get_filename_component(SOURCE_FILENAME ${SOURCE_FILE} NAME_WLE)
|
|
add_executable(test-${SOURCE_FILENAME} WIN32 ${SOURCE_FILE} ${TEST_RESOURCES})
|
|
target_link_libraries(test-${SOURCE_FILENAME} PRIVATE glerminallib test-common)
|
|
endforeach() |