-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
96 lines (74 loc) · 2.88 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
# Set project name and version
project(Biohazard VERSION "0.1.0" LANGUAGES CXX)
# Set default runtime directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
# Add CMake modules folder path
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
# Set C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8 /Zc:char8_t- /MP")
message(STATUS "Build options: ${CMAKE_CXX_FLAGS}")
endif()
# Display build type
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
# Copy ressources to default runtime directory
file(GLOB resources ${PROJECT_SOURCE_DIR}/3rd/resources/*)
file(COPY ${resources} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
message(STATUS "Resources were copied to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
# __________________________________________
# __ Libraries
# Library options
#set(OpenGL_GL_PREFERENCE GLVND)
# External libraries
#find_package(Threads REQUIRED)
#find_package(OpenCV REQUIRED)
#find_package(OpenGL REQUIRED)
#find_package(SDL2 REQUIRED)
#find_package(GLAD REQUIRED)
#3rd Directory
set(3RD_DIR ${PROJECT_SOURCE_DIR}/3rd)
message(STATUS "Third dependency directory: ${3RD_DIR}")
# Header only libraries
#set(spdlog_INCLUDE_DIR ${3RD_DIR}/spdlog/include) # spdlog - Fast C++ logging library
#set(json_INCLUDE_DIR ${3RD_DIR}/json/include) # JSON for modern C++ library
#set(glm_INCLUDE_DIR ${3RD_DIR}/glm/include) # glm - OpenGL Mathematics
set(IMGUI_DIR ${3RD_DIR}/imgui) # ImGui - Dear ImGui
message(STATUS "Imgui Directory: ${IMGUI_DIR}")
set(ICONS_FONT_AWESOME_DIR ${3RD_DIR}/IconsFontAwesome) # Incons Font Awesome
message(STATUS "IconsFontAwesome: ${ICONS_FONT_AWESOME_DIR}")
# __________________________________________
# __ IMGUI Backends
# Create toolkit source files list
if(NOT EXISTS ${IMGUI_DIR})
message(STATUS "Directory ${IMGUI_DIR} does not exist. Cloning from GitHub...")
execute_process(
COMMAND git clone --branch docking https://github.com/ocornut/imgui.git ${IMGUI_DIR}
WORKING_DIRECTORY ${3RD_DIR}
)
if(NOT EXISTS ${IMGUI_DIR})
message(FATAL_ERROR "Failed to clone ImGui repository.")
endif()
else()
message(STATUS "Directory ${IMGUI_DIR} already exists.")
endif()
SET(IMGUI_SOURCEFILES
${IMGUI_DIR}/imgui.cpp
${IMGUI_DIR}/imgui_demo.cpp
${IMGUI_DIR}/imgui_draw.cpp
${IMGUI_DIR}/imgui_widgets.cpp
${IMGUI_DIR}/imgui_tables.cpp
${IMGUI_DIR}/backends/imgui_impl_opengl3.cpp
${IMGUI_DIR}/backends/imgui_impl_sdl2.cpp
${IMGUI_DIR}/misc/cpp/imgui_stdlib.cpp
)
set(IMGUI_INCLUDE_DIRS ${IMGUI_DIR} ${IMGUI_DIR}/backends ${IMGUI_DIR}/misc/cpp)
# __________________________________________
# __ Subdirectories
add_subdirectory(biohazardmod)
add_subdirectory(biohazard3d)
add_subdirectory(biohazardgui)
add_subdirectory(biohazardimg)
add_subdirectory(tests)