-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
71 lines (62 loc) · 1.45 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
cmake_minimum_required(VERSION 3.10)
# Project name
project(DuckShot)
# Set the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Compiler warning flags
set(WARN_FLAGS
-Wall
-Wextra
-Werror
-Wshadow
-Wconversion
-pedantic
-pedantic-errors
-Wformat=2
-Wundef
-Wredundant-decls
-Wmissing-declarations
-Wmissing-include-dirs
-Wswitch-enum
)
# Sanitizer flags
set(SANITIZER_FLAGS
-fsanitize=address
-fno-omit-frame-pointer
)
# Apply warning flags and sanitizer flags for Debug builds
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(${WARN_FLAGS} ${SANITIZER_FLAGS})
add_link_options(${SANITIZER_FLAGS})
else()
add_compile_options(${WARN_FLAGS})
endif()
# Enable IWYU
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "include-what-you-use;-Xiwyu;--mapping_file=../mappings.imp")
# Find SFML
find_package(SFML 2.5 COMPONENTS system window graphics audio REQUIRED)
# Add the executable
add_executable(DuckShot
src/main.cpp
src/game.cpp
src/state.cpp
src/play.cpp
src/input.cpp
src/graphics.cpp
src/clock.cpp
src/sound.cpp
src/frames.cpp
src/animator.cpp
src/player.cpp
src/duck.cpp
src/screens.cpp
src/collision.cpp
src/text.cpp
src/user-interface.cpp
src/handlers.cpp
src/tally-util.cpp
src/score.cpp
)
# Link SFML libraries
target_link_libraries(DuckShot sfml-system sfml-window sfml-graphics sfml-audio)