Skip to content

Commit 0c51abe

Browse files
CMake fetchcontent Dependency Management
- Change from using git submodules for dependencies and instead use CMake's in built FetchContent functionality
1 parent 5936746 commit 0c51abe

38 files changed

Lines changed: 327 additions & 264 deletions

.gitmodules

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +0,0 @@
1-
[submodule "__externals/fmt"]
2-
path = __externals/fmt
3-
url = https://github.com/fmtlib/fmt
4-
[submodule "__externals/stb"]
5-
path = __externals/stb
6-
url = https://github.com/nothings/stb
7-
[submodule "__externals/imgui/src"]
8-
path = __externals/imgui/src
9-
url = https://github.com/ocornut/imgui
10-
[submodule "__externals/spdlog"]
11-
path = __externals/spdlog
12-
url = https://github.com/gabime/spdlog
13-
[submodule "__externals/glfw"]
14-
path = __externals/glfw
15-
url = https://github.com/glfw/glfw
16-
[submodule "__externals/entt"]
17-
path = __externals/entt
18-
url = https://github.com/skypjack/entt
19-
[submodule "__externals/assimp"]
20-
path = __externals/assimp
21-
url = https://github.com/assimp/assimp
22-
[submodule "__externals/stduuid"]
23-
path = __externals/stduuid
24-
url = https://github.com/mariusbancila/stduuid
25-
[submodule "__externals/yaml-cpp"]
26-
path = __externals/yaml-cpp
27-
url = https://github.com/jbeder/yaml-cpp
28-
[submodule "__externals/ImGuizmo"]
29-
path = __externals/ImGuizmo
30-
url = https://github.com/CedricGuillemet/ImGuizmo
31-
[submodule "__externals/SPIRV-Cross"]
32-
path = __externals/SPIRV-Cross
33-
url = https://github.com/KhronosGroup/SPIRV-Cross
34-
[submodule "__externals/gtest"]
35-
path = __externals/gtest
36-
url = https://github.com/google/googletest
37-
[submodule "__externals/VulkanMemoryAllocator"]
38-
path = __externals/VulkanMemoryAllocator
39-
url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
40-
[submodule "__externals/nlohmann_json"]
41-
path = __externals/nlohmann_json
42-
url = https://github.com/nlohmann/json
43-
[submodule "__externals/glslang"]
44-
path = __externals/glslang
45-
url = https://github.com/khronosGroup/glslang.git
46-
[submodule "__externals/SPIRV-headers"]
47-
path = __externals/SPIRV-headers
48-
url = https://github.com/khronosGroup/SPIRV-headers.git
49-
[submodule "__externals/SPIRV-Tools"]
50-
path = __externals/SPIRV-Tools
51-
url = https://github.com/khronosGroup/SPIRV-Tools
52-
[submodule "__externals/Vulkan-Loader"]
53-
path = __externals/Vulkan-Loader
54-
url = https://github.com/KhronosGroup/Vulkan-Loader
55-
[submodule "__externals/Vulkan-Headers"]
56-
path = __externals/Vulkan-Headers
57-
url = https://github.com/KhronosGroup/Vulkan-Headers
58-
[submodule "__externals/tlsf/src"]
59-
path = __externals/tlsf/src
60-
url = https://github.com/mattconte/tlsf
61-
[submodule "__externals/CLI11"]
62-
path = __externals/CLI11
63-
url = https://github.com/CLIUtils/CLI11
64-
[submodule "__externals/rapidhash/src"]
65-
path = __externals/rapidhash/src
66-
url = https://github.com/Nicoshev/rapidhash

CMakeLists.txt

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,9 @@ set_property (GLOBAL PROPERTY USE_FOLDERS ON)
1010

1111
# Core invariants
1212
#
13-
get_filename_component (ENLISTMENT_ROOT "." ABSOLUTE CACHE)
14-
get_filename_component (EXTERNAL_DIR "${ENLISTMENT_ROOT}/__externals" ABSOLUTE CACHE)
15-
get_filename_component (EXTERNAL_NUGET_DIR "${ENLISTMENT_ROOT}/__externals/nuget" ABSOLUTE CACHE)
16-
17-
include(${ENLISTMENT_ROOT}/Scripts/CMake/NuGet.cmake)
18-
include(${ENLISTMENT_ROOT}/Scripts/CMake/CppWinRT.cmake)
19-
include(${ENLISTMENT_ROOT}/dependencies.cmake)
2013

14+
include(Scripts/CMake/NuGet.cmake)
15+
include(Scripts/CMake/CppWinRT.cmake)
2116

2217
option (COPY_EXAMPLE_PROJECT "Copy example projects that show how to use Launcher" ON)
2318
option (LAUNCHER_ONLY "Build Launcher only" OFF)
@@ -42,27 +37,9 @@ endif()
4237
# Externals dependencies
4338
#
4439
if (NOT LAUNCHER_ONLY)
45-
add_subdirectory (${EXTERNAL_DIR}/Vulkan-Headers)
46-
add_subdirectory (${EXTERNAL_DIR}/Vulkan-Loader)
47-
add_subdirectory (${EXTERNAL_DIR}/fmt)
48-
add_subdirectory (${EXTERNAL_DIR}/imgui)
49-
add_subdirectory (${EXTERNAL_DIR}/glfw)
50-
add_subdirectory (${EXTERNAL_DIR}/spdlog)
51-
add_subdirectory (${EXTERNAL_DIR}/entt)
52-
add_subdirectory (${EXTERNAL_DIR}/assimp)
53-
add_subdirectory (${EXTERNAL_DIR}/stduuid)
54-
add_subdirectory (${EXTERNAL_DIR}/yaml-cpp)
55-
add_subdirectory (${EXTERNAL_DIR}/SPIRV-headers)
56-
add_subdirectory (${EXTERNAL_DIR}/SPIRV-Tools)
57-
add_subdirectory (${EXTERNAL_DIR}/glslang)
58-
add_subdirectory (${EXTERNAL_DIR}/SPIRV-Cross)
59-
add_subdirectory (${EXTERNAL_DIR}/gtest)
60-
add_subdirectory (${EXTERNAL_DIR}/VulkanMemoryAllocator)
61-
add_subdirectory (${EXTERNAL_DIR}/tlsf)
62-
add_subdirectory (${EXTERNAL_DIR}/rapidhash)
63-
add_subdirectory (${EXTERNAL_DIR}/CLI11)
64-
add_subdirectory (${EXTERNAL_DIR}/nlohmann_json)
6540

41+
## Setup Dependencies
42+
include(dependencies.cmake)
6643

6744
# Core engine lib is here
6845
#

CMakePresets.json

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
"name": "BaseOptions",
1111
"cacheVariables": {
1212
"CMAKE_BUILD_TYPE": "Debug",
13+
"CMAKE_CXX_STANDARD": "20",
14+
"CMAKE_CXX_STANDARD_REQUIRED": "ON",
15+
"CMAKE_CXX_EXTENSIONS": "OFF",
16+
"BUILD_SHARED_LIBS": "OFF",
17+
"FETCHCONTENT_QUIET": "OFF",
1318

1419
"VULKAN_HEADERS_ENABLE_INSTALL": "ON",
1520
"ENTT_INCLUDE_HEADERS": "ON",
@@ -20,7 +25,6 @@
2025

2126
"GLFW_BUILD_DOCS": "OFF",
2227
"GLFW_BUILD_EXAMPLES": "OFF",
23-
"GLFW_INSTALL": "OFF",
2428

2529
"ASSIMP_BUILD_TESTS": "OFF",
2630
"ASSIMP_INSTALL": "OFF",
@@ -40,13 +44,12 @@
4044
"YAML_CPP_FORMAT_SOURCE": "OFF",
4145
"YAML_BUILD_SHARED_LIBS": "OFF",
4246

43-
"USE_MASM": "OFF",
4447
"USE_GAS": "OFF",
4548

4649
"SPIRV_SKIP_EXECUTABLES": "ON",
4750
"SPIRV_SKIP_TESTS": "ON",
4851
"GLSLANG_ENABLE_INSTALL": "ON",
49-
"ALLOW_EXTERNAL_SPIRV_TOOLS": "OFF",
52+
"ALLOW_EXTERNAL_SPIRV_TOOLS": "ON",
5053

5154
"SPIRV_CROSS_ENABLE_TESTS": "OFF",
5255
"CMAKE_POLICY_VERSION_MINIMUM": "3.5"
@@ -60,8 +63,8 @@
6063
"binaryDir": "Result.Windows.x64.MultiConfig",
6164
"architecture": "x64",
6265
"cacheVariables": {
63-
"CMAKE_BUILD_TYPE": "Debug",
64-
"CMAKE_CONFIGURATION_TYPES": "Debug"
66+
"CMAKE_CONFIGURATION_TYPES": "Debug",
67+
"CMAKE_INSTALL_PREFIX": "Result.Windows.x64.MultiConfig"
6568
}
6669

6770
},
@@ -70,7 +73,6 @@
7073
"displayName": "Windows Visual Studio Release",
7174
"inherits": "Windows_x64_Debug",
7275
"cacheVariables": {
73-
"CMAKE_BUILD_TYPE": "Release",
7476
"CMAKE_CONFIGURATION_TYPES": "Release"
7577
}
7678
},
@@ -82,7 +84,9 @@
8284
"binaryDir": "Result.Darwin.x64.Debug",
8385
"generator": "Xcode",
8486
"cacheVariables": {
85-
"BUILD_FRAMEWORK": "ON"
87+
"BUILD_FRAMEWORK": "ON",
88+
"CMAKE_INSTALL_PREFIX": "Result.Darwin.x64.Debug",
89+
"CMAKE_CONFIGURATION_TYPES": "Debug"
8690
}
8791
},
8892
{
@@ -91,30 +95,41 @@
9195
"displayName": "Darwin XCode Release",
9296
"binaryDir": "Result.Darwin.x64.Release",
9397
"cacheVariables": {
94-
"CMAKE_BUILD_TYPE": "Release"
98+
"CMAKE_BUILD_TYPE": "Release",
99+
"CMAKE_INSTALL_PREFIX": "Result.Darwin.x64.Release",
100+
"CMAKE_CONFIGURATION_TYPES": "Release"
95101
}
96102
},
97103

98104
{
99105
"name": "Darwin_arm64_Debug",
100106
"inherits": "Darwin_x64_Debug",
101107
"binaryDir": "Result.Darwin.arm64.Debug",
102-
"displayName": "Darwin ARM XCode Debug"
108+
"displayName": "Darwin ARM XCode Debug",
109+
"cacheVariables": {
110+
"CMAKE_INSTALL_PREFIX": "Result.Darwin.arm64.Debug"
111+
}
103112
},
104113

105114
{
106115
"name": "Darwin_arm64_Release",
107116
"inherits": "Darwin_x64_Release",
108117
"binaryDir": "Result.Darwin.arm64.Release",
109-
"displayName": "Darwin ARM XCode Release"
118+
"displayName": "Darwin ARM XCode Release",
119+
"cacheVariables": {
120+
"CMAKE_INSTALL_PREFIX": "Result.Darwin.arm64.Release"
121+
}
110122
},
111123

112124
{
113125
"name": "Linux_x64_Debug",
114126
"inherits": "BaseOptions",
115127
"displayName": "Linux Ninja Debug",
116128
"binaryDir": "Result.Linux.x64.Debug",
117-
"generator": "Ninja"
129+
"generator": "Ninja",
130+
"cacheVariables": {
131+
"CMAKE_INSTALL_PREFIX": "Result.Linux.x64.Debug"
132+
}
118133
},
119134
{
120135
"name": "Linux_x64_Release",
@@ -123,6 +138,7 @@
123138
"binaryDir": "Result.Linux.x64.Release",
124139
"generator": "Ninja",
125140
"cacheVariables": {
141+
"CMAKE_INSTALL_PREFIX": "Result.Linux.x64.Release",
126142
"CMAKE_BUILD_TYPE": "Release"
127143
}
128144
}

Obelisk/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
2626
set_target_properties(${TARGET_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(ProjectDir)$(Configuration)")
2727
endif ()
2828

29-
include(${EXTERNAL_DIR}/externals.cmake)
30-
3129
target_include_directories (${TARGET_NAME}
3230
PRIVATE
3331
.
@@ -48,4 +46,4 @@ target_link_libraries(${TARGET_NAME} PRIVATE
4846
zEngineLib
4947
tetragrama
5048
imported::External_obeliskLibs
51-
)
49+
)

Scripts/BuildEngine.ps1

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,6 @@ if ($IsWindows) {
8787
}
8888

8989

90-
if(-Not $LauncherOnly) {
91-
$RepoRoot = [IO.Path]::Combine($PSScriptRoot, "..")
92-
Write-Host "Ensuring submodules are initialized and updated..."
93-
& git -C $RepoRoot submodule update --init --recursive
94-
95-
} else {
96-
Write-Host "Skipping submodules initialization..."
97-
}
98-
99-
10090
function Build([string]$configuration, [int]$VsVersion , [bool]$runBuild) {
10191

10292
# Check if the system supports multiple configurations

Tetragrama/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
2727
set_target_properties(${TARGET_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(ProjectDir)$(Configuration)")
2828
endif ()
2929

30-
include(${EXTERNAL_DIR}/externals.cmake)
31-
3230
target_include_directories (${TARGET_NAME}
3331
PUBLIC
3432
.

Tetragrama/Components/DockspaceUIComponent.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <Messengers/Messenger.h>
77
#include <ZEngine/Logging/LoggerDefinition.h>
88
#include <fmt/format.h>
9-
#include <imgui/src/imgui_internal.h>
9+
#include <imgui/imgui_internal.h>
1010

1111
namespace fs = std::filesystem;
1212

Tetragrama/Helpers/UIComponentDrawerHelper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22
#include <ZEngine/Core/Maths/Vec.h>
33
#include <ZEngine/Rendering/Scenes/GraphicScene.h>
4-
#include <imgui/src/imgui_internal.h>
4+
#include <imgui/imgui_internal.h>
55

66
namespace Tetragrama::Helpers
77
{

ZEngine/ZEngine/CMakeLists.txt

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
include(${EXTERNAL_DIR}/externals.cmake)
2-
31
file (GLOB_RECURSE HEADER_FILES_LIST CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
42
file (GLOB_RECURSE CPP_FILES_LIST CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
53
file (GLOB_RECURSE RESOURCE_FILES_LIST CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/../Resources/Shaders/*.*)
@@ -9,17 +7,13 @@ source_group (TREE ${PROJECT_SOURCE_DIR}/../Resources PREFIX "Resources Files" F
97

108
# ZEngine source files
119
#
12-
add_library (zEngineLib
13-
STATIC
14-
${HEADER_FILES_LIST}
15-
${CPP_FILES_LIST}
16-
${RESOURCE_FILES_LIST}
17-
${EXTERNAL_DIR}/ImGuizmo/ImGuizmo.h
18-
${EXTERNAL_DIR}/ImGuizmo/ImGuizmo.cpp
19-
)
10+
add_library (zEngineLib STATIC)
11+
12+
target_sources(zEngineLib PRIVATE ${CPP_FILES_LIST})
2013

2114
target_include_directories (zEngineLib
2215
PUBLIC
16+
..
2317
.
2418
./Applications
2519
./Core
@@ -55,32 +49,28 @@ target_include_directories (zEngineLib
5549
./Windows/Layers
5650
./Managers
5751
./Serializers
58-
${EXTERNAL_DIR}
59-
${EXTERNAL_INCLUDE_DIRS}
6052
)
6153

6254
target_precompile_headers(zEngineLib PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/pch.h)
6355

6456
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
6557
target_compile_definitions (zEngineLib PUBLIC ENABLE_VULKAN_VALIDATION_LAYER)
6658
endif()
59+
6760
target_compile_definitions (zEngineLib
6861
PUBLIC
6962
ZENGINE_PLATFORM
7063
ENABLE_VULKAN_SYNCHRONIZATION_LAYER
7164
YAML_CPP_STATIC_DEFINE
7265
)
7366

67+
target_link_libraries (zEngineLib PUBLIC imported::ZEngine_External_Dependencies)
68+
7469
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
75-
target_compile_definitions (zEngineLib PUBLIC VK_USE_PLATFORM_WIN32_KHR)
70+
target_link_libraries (zEngineLib PUBLIC imported::cppwinrt_headers WindowsApp.lib)
71+
target_compile_definitions(zEngineLib PUBLIC NOMINMAX)
7672
endif()
7773

7874
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
79-
target_link_libraries(zEngineLib PRIVATE stdc++fs)
75+
target_link_libraries(zEngineLib PUBLIC stdc++fs)
8076
endif ()
81-
82-
target_link_libraries (zEngineLib PUBLIC imported::External_libs)
83-
84-
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
85-
target_link_libraries (zEngineLib PUBLIC imported::cppwinrt_headers WindowsApp.lib)
86-
endif()

ZEngine/ZEngine/Hardwares/AsyncResourceLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#define STB_IMAGE_WRITE_IMPLEMENTATION
1313
#define STB_IMAGE_RESIZE_IMPLEMENTATION
14-
#include <stb/stb_image_resize.h>
14+
#include <stb/deprecated/stb_image_resize.h>
1515
#include <stb/stb_image_write.h>
1616

1717
using namespace ZEngine::Helpers;

0 commit comments

Comments
 (0)