This repository has been archived by the owner on Aug 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
77 lines (52 loc) · 2.38 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
73
74
75
76
77
cmake_minimum_required (VERSION 3.20)
project ("history_survival")
file(GLOB_RECURSE SOURCES "src/*.cpp")
if (MSVC)
list(APPEND SOURCES config.rc)
endif()
add_executable(${PROJECT_NAME} ${SOURCES})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT HistorySurvival)
file(COPY ${CMAKE_SOURCE_DIR}/resources DESTINATION ${CMAKE_BINARY_DIR})
target_include_directories(${PROJECT_NAME} PUBLIC src)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20)
if (CMAKE_COMPILER_IS_GNUC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
endif()
target_precompile_headers(${PROJECT_NAME} PUBLIC src/pch.hpp)
add_subdirectory(third_party/glad)
target_link_libraries(${PROJECT_NAME} PUBLIC glad)
add_subdirectory(third_party/irrKlang)
target_link_libraries(${PROJECT_NAME} PUBLIC irrKlang)
add_subdirectory(third_party/stb_image)
target_link_libraries(${PROJECT_NAME} PUBLIC stb_image)
add_subdirectory(third_party/FastNoiseLite)
target_link_libraries(${PROJECT_NAME} PUBLIC FastNoiseLite)
add_subdirectory(third_party/jbt)
target_link_libraries(${PROJECT_NAME} PUBLIC jbt)
find_package(glm CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC glm::glm)
find_package(OpenGL REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC OpenGL::GL)
find_package(imgui CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC imgui::imgui)
find_package(spdlog CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog::spdlog spdlog::spdlog_header_only)
find_package(yaml-cpp CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC yaml-cpp)
find_path(BSHOSHANY_THREAD_POOL_INCLUDE_DIRS "BS_thread_pool.hpp")
target_include_directories(${PROJECT_NAME} PUBLIC ${BSHOSHANY_THREAD_POOL_INCLUDE_DIRS})
find_package(unofficial-concurrentqueue CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC unofficial::concurrentqueue::concurrentqueue)
find_package(SDL2 CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME}
PRIVATE
$<TARGET_NAME_IF_EXISTS:SDL2::SDL2main>
$<IF:$<TARGET_EXISTS:SDL2::SDL2>,SDL2::SDL2,SDL2::SDL2-static>
)
if (WIN32)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_SOURCE_DIR}/third_party/irrKlang/bin/irrKlang.dll"
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
endif()