-
Notifications
You must be signed in to change notification settings - Fork 59
/
CMakeLists.txt
120 lines (102 loc) · 3.23 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
cmake_minimum_required(VERSION 3.29)
# Hack because vcpkg doesn't allow you to just declare that you want to be static on all platforms
# Linux and MacOS are static by default
# if(WIN32)
# SET(VCPKG_TARGET_TRIPLET "x64-windows-static")
# endif()
project (HiveWE CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 23)
find_package(Qt6 COMPONENTS Core Gui Widgets OpenGL OpenGLWidgets REQUIRED)
find_package(Bullet CONFIG REQUIRED)
find_package(glm CONFIG REQUIRED)
find_package(glad CONFIG REQUIRED)
find_package(soil2 CONFIG REQUIRED)
find_package(stormlib CONFIG REQUIRED)
find_package(BZip2 REQUIRED)
find_package(CascLib CONFIG REQUIRED)
find_package(JPEG REQUIRED)
find_package(qt6advanceddocking CONFIG REQUIRED)
find_package(absl CONFIG REQUIRED)
find_package(TBB CONFIG REQUIRED)
find_package(libjpeg-turbo CONFIG REQUIRED)
find_package(imgui CONFIG REQUIRED)
find_package(outcome CONFIG REQUIRED)
find_package(unordered_dense CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
qt_standard_project_setup()
add_executable(HiveWE
${QT_RESOURCES}
)
add_subdirectory(src)
target_include_directories(HiveWE PRIVATE
"src"
"src/base"
"src/brush"
"src/custom_widgets"
"src/file_formats"
"src/main_window"
"src/menus"
"src/models"
"src/model_editor"
"src/object_editor"
"src/resources"
"src/resources/skinned_mesh"
"src/utilities"
${BULLET_INCLUDE_DIR}
)
target_link_libraries(HiveWE PUBLIC
Qt6::Gui
Qt6::Widgets
Qt6::OpenGL
Qt6::OpenGLWidgets
glm::glm
glad::glad
soil2::soil2
StormLib::storm
BZip2::BZip2
libjpeg-turbo::jpeg
libjpeg-turbo::turbojpeg
ads::qt6advanceddocking
absl::flat_hash_map
absl::flat_hash_set
TBB::tbb
imgui::imgui
outcome::hl
unordered_dense::unordered_dense
nlohmann_json::nlohmann_json
${BULLET_LIBRARIES}
)
target_compile_options(HiveWE PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/Zc:__cplusplus /MP /sdl /diagnostics:caret>
$<$<CXX_COMPILER_ID:Clang>:-Wextra -Wpedantic -Werror -Wno-multichar>
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wpedantic -Werror -Wno-multichar>
)
target_compile_definitions(HiveWE PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:UNICODE _UNICODE>
$<$<CXX_COMPILER_ID:Clang>:TBB_SUPPRESS_DEPRECATED_MESSAGES>
$<$<CXX_COMPILER_ID:GNU>:TBB_SUPPRESS_DEPRECATED_MESSAGES>
)
if(WIN32)
target_link_libraries(HiveWE PUBLIC CascLib::casc)
else()
target_link_libraries(HiveWE PUBLIC CascLib::casc_static)
endif()
target_compile_features(HiveWE PUBLIC cxx_std_23)
message(${CMAKE_CURRENT_BINARY_DIR})
message(${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
message($<TARGET_FILE_DIR:HiveWE>)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND}
-E create_symlink
"${PROJECT_SOURCE_DIR}/data"
"$<TARGET_FILE_DIR:HiveWE>/data"
)
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(QT_VCPKG_PATH "${CMAKE_CURRENT_BINARY_DIR}/vcpkg_installed/x64-windows/debug")
else()
set(QT_VCPKG_PATH "${CMAKE_CURRENT_BINARY_DIR}/vcpkg_installed/x64-windows")
endif()
file(COPY "${QT_VCPKG_PATH}/Qt6/plugins/platforms/" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/debug/platforms")
file(COPY "${QT_VCPKG_PATH}/Qt6/plugins/styles/" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/debug/styles")
file(COPY "${QT_VCPKG_PATH}/Qt6/plugins/imageformats/" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/debug/imageformats")