Skip to content

Commit

Permalink
Add build script for unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
albin-johansson committed Jul 14, 2023
1 parent 653d859 commit 49f13a1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ function(cen_prepare_target target)
endif ()
endfunction()

add_subdirectory(unit-tests)
26 changes: 26 additions & 0 deletions tests/unit-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
project(centurion-unit-tests LANGUAGES CXX)

file(GLOB_RECURSE CENTURION_UNIT_TEST_FILES
CONFIGURE_DEPENDS
${PROJECT_SOURCE_DIR}/src/*.hpp
${PROJECT_SOURCE_DIR}/src/*.cpp
)

add_executable(centurion-tests ${CENTURION_UNIT_TEST_FILES})

cen_prepare_target(centurion-tests)

target_include_directories(centurion-tests PRIVATE ${PROJECT_SOURCE_DIR})

target_link_libraries(centurion-tests
PRIVATE
cen::centurion
GTest::gtest
)

if (WIN32)
file(COPY ${SDL3_BINARY_DIR}/SDL3.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_BINARY_DIR}/external/SDL_image/SDL3_image.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_BINARY_DIR}/external/SDL_mixer/SDL3_mixer.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_BINARY_DIR}/external/SDL_ttf/SDL3_ttf.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endif ()

0 comments on commit 49f13a1

Please sign in to comment.