-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
69 lines (52 loc) · 2.08 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
cmake_minimum_required(VERSION 3.20.4)
project(snake VERSION 0.1)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
find_package(SDL2 REQUIRED)
add_executable(snake main.cpp)
target_include_directories(snake PRIVATE ${SDL2_INCLUDE_DIRS})
add_executable(manual manual_tests.cpp)
add_subdirectory(helpers)
add_subdirectory(game)
add_subdirectory(genetic)
add_subdirectory(matrix)
add_subdirectory(machine)
add_subdirectory(qubo)
add_subdirectory(nativefiledialog-extended)
file(GLOB HELPERS_FILES "helpers/*.cpp")
add_library(helpers ${HELPERS_FILES})
target_link_libraries(helpers matrix machine)
file(GLOB GENETIC_FILES "genetic/*.cpp")
add_library(genetic ${GENETIC_FILES})
target_link_libraries(genetic players matrix machine board helpers)
file(GLOB MATRIX_FILES "matrix/*.cpp")
add_library(matrix ${MATRIX_FILES})
file(GLOB QUBO_FILES "qubo/*.cpp")
add_library(qubo ${QUBO_FILES})
file(GLOB MACHINE_FILES "machine/*.cpp")
add_library(machine ${MACHINE_FILES})
target_link_libraries(machine helpers matrix)
file(GLOB BOARD_FILE "game/board.cpp")
file(GLOB SCREENS_FILES "game/screens/*.cpp")
file(GLOB PLAYERS_FILES "game/players/*.cpp")
add_library(board ${BOARD_FILE})
add_library(screens ${SCREENS_FILES})
add_library(players ${PLAYERS_FILES})
target_link_libraries(players machine matrix genetic helpers qubo ${SDL2_LIBRARIES})
target_link_libraries(screens players board helpers genetic matrix qubo ${SDL2_LIBRARIES} SDL2_ttf nfd)
target_link_libraries(board helpers players)
target_link_libraries(snake PRIVATE helpers board screens players ${SDL2_LIBRARIES} SDL2_ttf)
target_link_libraries(manual PRIVATE helpers board players)
enable_testing()
file(GLOB TESTS "tests/*_test.cc")
add_executable(tests ${TESTS})
target_link_libraries(tests matrix helpers genetic players board machine GTest::gtest_main GTest::gmock)
include(GoogleTest)
gtest_discover_tests(tests)