2024-09-29 21:07:07 -04:00
|
|
|
|
|
|
|
find_package(SDL2 REQUIRED)
|
|
|
|
|
|
|
|
include(FetchContent)
|
|
|
|
FetchContent_Declare(
|
|
|
|
googletest
|
|
|
|
URL https://github.com/google/googletest/archive/refs/tags/v1.15.2.zip
|
|
|
|
)
|
|
|
|
FetchContent_MakeAvailable(googletest)
|
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
|
|
|
|
file(GLOB_RECURSE cpp_sources
|
|
|
|
CONFIGURE_DEPENDS
|
|
|
|
"../src/*.cpp")
|
|
|
|
|
|
|
|
list(REMOVE_ITEM cpp_sources
|
|
|
|
"../src/pc_app/main.cpp")
|
|
|
|
|
|
|
|
file(GLOB_RECURSE test_sources
|
|
|
|
CONFIGURE_DEPENDS
|
|
|
|
"*.cc")
|
|
|
|
|
|
|
|
file(GLOB_RECURSE c_sources
|
|
|
|
CONFIGURE_DEPENDS
|
|
|
|
"../src/*.c")
|
|
|
|
|
|
|
|
file (GLOB_RECURSE headers CONFIGURE_DEPENDS "../src/*.h")
|
|
|
|
set (include_dirs "")
|
|
|
|
foreach (_headerFile ${headers})
|
|
|
|
get_filename_component(_dir ${_headerFile} PATH)
|
|
|
|
list (APPEND include_dirs ${_dir})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
add_executable(
|
2024-10-04 21:28:49 -04:00
|
|
|
chess_test
|
2024-09-29 21:07:07 -04:00
|
|
|
# ${cpp_sources}
|
|
|
|
${test_sources}
|
|
|
|
${c_sources}
|
|
|
|
)
|
2024-10-04 21:28:49 -04:00
|
|
|
target_include_directories(chess_test PRIVATE ${include_dirs})
|
2024-09-29 21:07:07 -04:00
|
|
|
target_link_libraries(
|
2024-10-04 21:28:49 -04:00
|
|
|
chess_test
|
2024-09-29 21:07:07 -04:00
|
|
|
GTest::gtest_main
|
|
|
|
SDL2::SDL2
|
|
|
|
)
|
|
|
|
|
|
|
|
include(GoogleTest)
|
2024-10-04 21:28:49 -04:00
|
|
|
gtest_discover_tests(chess_test)
|
2024-09-29 21:07:07 -04:00
|
|
|
|