generated from DonRomanos/Challenge_Template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
90 lines (70 loc) · 2.89 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
cmake_minimum_required(VERSION 3.25)
project(Terms_of_Enrampagement)
include(CTest)
#*******************************************************************
# User options
option(BUILD_BENCHMARK "This will enable the performance tests using google benchmark" ON)
option(BUILD_TESTS "Will build the tests verifying your result" ON)
if(BUILD_TESTING)
find_package(GTest REQUIRED)
include(GoogleTest)
endif()
# This project is structurized into different main parts, which are as follows:
# Program: basically the main setting up the dependencies, this is the executable defined in this CMakelists.txt
# Core: everything that is shared or does not belong to any other part and is used by many other parts, e.g. clock, network, etc.
# Input: responsible for any kind of user information
# Graphics: this is the implementation of the graphics engine
# Simulation: this contains the game state and logic and advances the logic based on the inputs
# Every module has its files in a subdirectory.
# Glfw is used as a dependency for window management and maths
find_package(glfw3 REQUIRED)
find_package(range-v3 REQUIRED)
include(cmake/compiler-settings.cmake)
#*******************************************************************************
# Submodules
add_subdirectory(src/application)
add_subdirectory(src/core)
add_subdirectory(src/input)
add_subdirectory(src/math)
add_subdirectory(src/simulation)
add_subdirectory(src/utility)
#add_subdirectory(src/graphics)
add_subdirectory(src/benchmark)
#***********************************************************************************
add_executable(${PROJECT_NAME})
target_sources(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp
)
target_link_libraries(${PROJECT_NAME}
PRIVATE
input::glfw
application::application
#simulation::logic
#input::provider
#...
)
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wextra -pedantic -Werror>
$<$<CXX_COMPILER_ID:MSVC>:
/W4 /WX /std:c++latest>
)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20)
######################################################################
# Should be extracted each subdir should have its own tests!
if( BUILD_TESTS)
find_package(GTest REQUIRED)
# Actual tests will be defined within subdirectories!
add_executable(${PROJECT_NAME}_Tests)
target_sources(${PROJECT_NAME}_Tests PRIVATE
src/tests/tests.cpp)
target_include_directories(${PROJECT_NAME}_Tests PRIVATE
src/)
target_link_libraries(${PROJECT_NAME}_Tests PRIVATE
GTest::gtest
)
include(GoogleTest)
enable_testing()
gtest_discover_tests(${PROJECT_NAME}_Tests)
endif()