-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
72 lines (65 loc) · 1.58 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
cmake_minimum_required(VERSION 3.12)
project(main
VERSION 0.0.1
LANGUAGES CXX
)
include(FetchContent)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
set(SOURCE_DIR "${CMAKE_SOURCE_DIR}/src")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(BUILD_SHARED_LIBS OFF)
include_directories(
"${CMAKE_SOURCE_DIR}/include"
"${CMAKE_SOURCE_DIR}/include/scenes"
)
add_subdirectory("${CMAKE_SOURCE_DIR}/extern")
add_subdirectory("${CMAKE_SOURCE_DIR}/docs")
add_executable(main)
target_sources(main PRIVATE
"${SOURCE_DIR}/main.cpp"
"${SOURCE_DIR}/scenes/MenuScene.cpp"
"${SOURCE_DIR}/scenes/SceneManager.cpp"
"${SOURCE_DIR}/util.cpp"
)
target_link_libraries(main PRIVATE
sfml-graphics
sfml-network
sfml-system
sfml-window
IMGUI
ImGui-SFML::ImGui-SFML
box2d
)
add_executable(phystest)
target_sources(phystest PRIVATE
"${SOURCE_DIR}/phystest.cpp"
)
target_link_libraries(phystest PRIVATE
box2d
)
add_executable(server)
target_sources(server PRIVATE
"${SOURCE_DIR}/server.cpp"
"${SOURCE_DIR}/util.cpp"
)
target_link_libraries(server PRIVATE
sfml-graphics
sfml-network
sfml-system
sfml-window
box2d
)
file(GLOB_RECURSE ASSETS
CONFIGURE_DEPENDS
RELATIVE "${CMAKE_SOURCE_DIR}/assets/"
"${CMAKE_SOURCE_DIR}/assets/*"
)
foreach(ASSET ${ASSETS})
add_custom_command(TARGET main PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_SOURCE_DIR}/assets/${ASSET}"
"$<TARGET_FILE_DIR:main>/${ASSET}"
)
endforeach()