-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
104 lines (84 loc) · 2.64 KB
/
CMakeLists.txt
File metadata and controls
104 lines (84 loc) · 2.64 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
cmake_minimum_required(VERSION 3.30)
project(Driving_Sim)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
include_directories(src)
find_package(SFML 2.5 COMPONENTS graphics REQUIRED)
# Inclusion de Boost pour les graphes
find_package(Boost COMPONENTS iostreams REQUIRED)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
endif()
add_executable(Driving_Sim
src/main.cpp
src/game.cpp
src/circuit.cpp
src/fpscounter.cpp
src/car.cpp
src/debugmode.cpp
src/dejavu_sans_mono_ttf.cpp
src/vehicle.cpp
src/Headers/plotting.h
src/Headers/gnuplot-iostream.h
src/plotting.cpp
)
target_include_directories(Driving_Sim PRIVATE
src/Headers
src/Headers/GraphicsUtils
src/Headers/Physics
)
target_link_libraries(Driving_Sim
sfml-graphics
sfml-audio
${Boost_LIBRARIES}
)
add_custom_command(TARGET Driving_Sim POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/assets $<TARGET_FILE_DIR:Driving_Sim>/assets)
# ------------------------------------------------------------------
# Ajout de l'exécutable de tests avec GoogleTest
# ------------------------------------------------------------------
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG 075196ca060107d44b4e3a1f44b25886ed5bd187 # v1.15.2
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
find_package(Threads REQUIRED)
add_executable(DrivingSimTests
src/vehicle.cpp
src/plotting.cpp
tests/vehicle_test.cpp)
target_include_directories(DrivingSimTests PRIVATE
src/Headers
src/Headers/GraphicsUtils
src/Headers/Physics
)
target_compile_options(DrivingSimTests PRIVATE "-Wall" "-Wextra" "-g" "-O0" "-fsanitize=address,undefined")
set_target_properties(DrivingSimTests PROPERTIES LINK_FLAGS "-fsanitize=address,undefined")
target_link_libraries(DrivingSimTests PRIVATE
GTest::gtest_main
Threads::Threads
${Boost_LIBRARIES}
)
include(GoogleTest)
gtest_discover_tests(DrivingSimTests)
# ------------------------------------------------------------------
add_executable(DrivingSim_Plots
srcPlots/vehicle.cpp
srcPlots/vehicle.h
srcPlots/plotting.cpp
srcPlots/plotting.h
)
target_include_directories(DrivingSim_Plots PRIVATE
srcPlots/
src/Headers/GraphicsUtils
)
target_link_libraries(DrivingSim_Plots
${Boost_LIBRARIES}
)