-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
189 lines (140 loc) · 4.99 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
cmake_minimum_required(VERSION 3.24.0)
project(future)
set(CMAKE_CXX_STANDARD 20)
set(IMGUI_DIR extern/imgui)
include_directories(${IMGUI_DIR})
include_directories(${IMGUI_DIR}/backends)
include_directories(extern/dr_libs)
include_directories(extern/imgui_toggle)
include_directories(extern/)
# tinyxml2.h is in the extern folder. Only windows builds it.
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
include_directories(extern/)
endif()
file (GLOB future__imgui
extern/imgui/imgui.cpp
extern/imgui/imgui_draw.cpp
extern/imgui/imgui_tables.cpp
extern/imgui/imgui_widgets.cpp
)
file (GLOB future__imgui_toggle
extern/imgui_toggle/*.cpp
)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
file (GLOB future__imgui_backend
extern/imgui/backends/imgui_impl_dx11.cpp
extern/imgui/backends/imgui_impl_win32.cpp)
elseif ((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
file (GLOB future__imgui_backend
extern/imgui/backends/imgui_impl_sdl2.cpp
extern/imgui/backends/imgui_impl_opengl3.cpp)
endif()
source_group("ImGui" REGULAR_EXPRESSION "extern/imgui/*")
file (GLOB future__main RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"main.cpp"
)
file (GLOB future__windows
windows/*.cpp
)
file (GLOB future__windows_headers
windows/*.h
)
include_directories(windows/)
source_group("Windows" REGULAR_EXPRESSION "windows/")
file (GLOB future__utils
utils/*.cpp
)
file (GLOB future__utils_headers
utils/*.h
)
include_directories(utils/)
source_group("Utils" REGULAR_EXPRESSION "utils/*")
file (GLOB future__tinyxml2
extern/tinyxml2.cpp)
file (GLOB future__xml_embed
utils/xml_embed.cpp
)
set(ALL_FILES
${future__imgui}
${future__imgui_toggle}
${future__main}
${future__imgui_backend}
${future__windows}
${future__utils}
${future__tinyxml2}
${future__xml_embed}
)
################################################################################
# VCPKG dependencies for Windows
################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
include(CMake/automate-vcpkg.cmake)
if ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
set(VCPKG_TRIPLET x86-windows-static)
set(VCPKG_TARGET_TRIPLET x86-windows-static)
elseif ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
set(VCPKG_TRIPLET x64-windows-static)
set(VCPKG_TARGET_TRIPLET x64-windows-static)
elseif ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "arm64")
set(VCPKG_TRIPLET arm64-windows-static)
set(VCPKG_TARGET_TRIPLET arm64-windows-static)
endif()
vcpkg_bootstrap()
vcpkg_install_packages(zlib bzip2 libzip libogg opus libopusenc libvorbis)
endif()
add_executable(future ${ALL_FILES})
include(FetchContent)
FetchContent_Declare(
StormLib
GIT_REPOSITORY https://github.com/ladislav-zezula/StormLib.git
GIT_TAG v9.25
PATCH_COMMAND ${stormlib_apply_path_if_needed}
)
FetchContent_MakeAvailable(StormLib)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
include_directories(future, extern/StormLib/src)
target_link_libraries(future PUBLIC storm)
find_package(libzip REQUIRED)
target_link_libraries(future PRIVATE libzip::zip )
file (COPY assets/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/assets)
list(APPEND CMAKE_MODULE_PATH "CMake")
if ((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
find_package(SDL2 REQUIRED)
target_link_libraries(future PRIVATE SDL2::SDL2)
find_package(OpenGL)
target_link_libraries(future PRIVATE OpenGL::GL)
find_package(Ogg)
target_link_libraries(Ogg::ogg)
find_package(Vorbis REQUIRED)
target_link_libraries(future PRIVATE Vorbis::vorbis)
target_link_libraries(future PRIVATE Vorbis::vorbisfile)
target_link_libraries(future PRIVATE Vorbis::vorbisenc)
find_package(Opus)
target_link_libraries(future PRIVATE ${OPUS_LIBRARY})
target_include_directories(future PRIVATE ${OPUS_INCLUDE_DIR})
find_package(Opusenc)
target_link_libraries(future PRIVATE ${Opusenc_LIBRARY})
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
find_package(Ogg CONFIG REQUIRED)
target_link_libraries(future PRIVATE Ogg::ogg)
find_package(Opus CONFIG REQUIRED)
target_link_libraries(future PRIVATE Opus::opus)
find_package(Opusenc)
target_link_libraries(future PRIVATE ${Opusenc_LIBRARY})
find_package(Vorbis REQUIRED)
target_link_libraries(future PRIVATE Vorbis::vorbis)
target_link_libraries(future PRIVATE Vorbis::vorbisfile)
target_link_libraries(future PRIVATE Vorbis::vorbisenc)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CPACK_GENERATOR "External")
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows|NintendoSwitch|CafeOS")
set(CPACK_GENERATOR "ZIP")
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CPACK_GENERATOR "Bundle")
endif()
set_property(TARGET future PROPERTY APPIMAGE_DESKTOP_FILE_TERMINAL YES)
set_property(TARGET future PROPERTY APPIMAGE_DESKTOP_FILE "../future.desktop")
set_property(TARGET future PROPERTY APPIMAGE_ICON_FILE "../futureicon.png")
set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_SOURCE_DIR}/CMake/Packaging-2.cmake)
include(CMake/Packaging.cmake)