-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
66 lines (57 loc) · 1.86 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
cmake_minimum_required(VERSION 3.9)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
project(simple_pool DESCRIPTION "Simple Pool game made with C++/SDL2" LANGUAGES CXX VERSION 0.1.0)
find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_ttf REQUIRED)
find_package(SDL2_mixer REQUIRED)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include"
${SDL2_INCLUDE_DIR}
${SDL2_IMAGE_INCLUDE_DIR}
${SDL2_TTF_INCLUDE_DIR}
${SDL2_MIXER_INCLUDE_DIRS}
)
set(SOURCES
src/main.cpp
src/exception.cpp
src/mainwindow.cpp
src/texture.cpp
src/font.cpp
src/music.cpp
src/gamestate.cpp
src/intro.cpp
src/level.cpp
src/table.cpp
src/subject.cpp
src/observer.cpp
src/rect.cpp
src/ball.cpp
src/collisionobserver.cpp
src/audioobserver.cpp
src/cue.cpp
)
add_executable(${PROJECT_NAME} ${SOURCES})
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_14)
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>:
$<$<CONFIG:Debug>:
-O0 -Wall -Wextra -Weffc++ -Werror -pedantic-errors -g>
$<$<CONFIG:Release>:
-O3 -Wall -pipe -march=native>>
$<$<CXX_COMPILER_ID:MSVC>:
$<$<CONFIG:Debug>:/Od /Wall /Zi>>
)
target_link_libraries(${PROJECT_NAME}
${SDL2_LIBRARY}
${SDL2_IMAGE_LIBRARIES}
${SDL2_TTF_LIBRARIES}
${SDL2_MIXER_LIBRARIES}
)
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/pool_assets/
DESTINATION ${CMAKE_INSTALL_BINDIR}/pool_assets/
)