-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
67 lines (55 loc) · 2.11 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
cmake_minimum_required(VERSION 3.16)
project(yoku)
set(CMAKE_CXX_STANDARD 17)
# SFML Lib installed with apt-get install sfml-dev
find_package(SFML 2.5 COMPONENTS audio graphics window system REQUIRED)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
# the -I flag in compiler
include_directories(
${PROJECT_SOURCE_DIR}/src/include/
)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(YOKU_LIB_SOURCES
src/Assets.cpp
src/SceneManager.cpp
src/Window.cpp
src/Game.cpp
src/Input.cpp
src/rng.cpp
)
set(YOKU_LIBRARY_NAME yoku)
add_library(${YOKU_LIBRARY_NAME}.static STATIC ${YOKU_LIB_SOURCES})
add_library(${YOKU_LIBRARY_NAME} SHARED ${YOKU_LIB_SOURCES})
file(COPY src/include DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
# add_compile_definitions(FPS=1)
message("Build Type: " ${CMAKE_BUILD_TYPE})
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_definitions(DEBUG)
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(PONG_EXAMPLE_SOURCES
examples/pong/src/main.cpp
examples/pong/src/entities/PlayerPaddle.cpp
examples/pong/src/entities/CpuPaddle.cpp
examples/pong/src/entities/Ball.cpp
examples/pong/src/entities/Paddle.cpp
examples/pong/src/scenes/Main.cpp
examples/pong/src/scenes/Splash.cpp
examples/pong/src/Pong.cpp
)
file(COPY examples/pong/src/assets DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
add_executable(pong ${PONG_EXAMPLE_SOURCES})
target_link_libraries(pong sfml-graphics sfml-window ${YOKU_LIBRARY_NAME})
set(SIMULATION_EXAMPLE_SOURCES
examples/simulation/src/main.cpp
examples/simulation/src/libs/Quadtree.cpp
examples/simulation/src/entities/Cell.cpp
examples/simulation/src/entities/Food.cpp
examples/simulation/src/scenes/Main.cpp
examples/simulation/src/scenes/Splash.cpp
examples/simulation/src/Simulation.cpp
)
file(COPY examples/simulation/src/assets DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
add_executable(simulation ${SIMULATION_EXAMPLE_SOURCES})
target_link_libraries(simulation sfml-graphics sfml-window ${YOKU_LIBRARY_NAME})