Skip to content

Commit 0bd9c4c

Browse files
add VcPkg Binary Cache for windows
1 parent 906548d commit 0bd9c4c

7 files changed

Lines changed: 104 additions & 50 deletions

File tree

.github/workflows/Engine-CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
on:
22
push:
3-
branches: [ master, develop, arena-integration, compile_on_linux_fetchcontent ]
3+
branches: [ master, develop, arena-integration, vcpkg_binary_cache ]
44
pull_request:
55
branches: [ master, develop, arena-integration ]
66

.github/workflows/job-cmakebuild-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Update the list of packages after we added packages.microsoft.com
3535
run: sudo apt-get update
3636
- name: Install development library
37-
run: sudo apt-get install libasound2-dev libgl1-mesa-dev libpulse-dev libdbus-1-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxxf86vm-dev cmake apt-transport-https software-properties-common gcc g++ powershell clang-format-20 libwayland-dev libxkbcommon-dev libassimp-dev libfmt-dev libstb-dev libglfw3-dev libspdlog-dev libyaml-cpp-dev nlohmann-json3-dev libcli11-dev
37+
run: sudo apt-get install libasound2-dev libgl1-mesa-dev libpulse-dev libdbus-1-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxxf86vm-dev cmake apt-transport-https software-properties-common gcc g++ powershell clang-format-20 libwayland-dev libxkbcommon-dev libassimp-dev libfmt-dev libstb-dev libglfw3-dev libspdlog-dev libyaml-cpp-dev nlohmann-json3-dev libcli11-dev libspirv-cross-c-shared-dev spirv-tools glslang-dev glslang-tools dotnet-runtime-8.0 libgtest-dev
3838

3939
- name: CMake Build
4040
run: .\Scripts\BuildEngine.ps1 -Configurations ${{inputs.configuration}}

.github/workflows/job-cmakebuild-windows.yml

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
#
33
name: Windows Build Workflow
44

5+
permissions:
6+
packages: write
7+
8+
env:
9+
USERNAME: mathewbensoncode
10+
VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg
11+
FEED_URL: https://nuget.pkg.github.com/mathewbensoncode/index.json
12+
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/mathewbensoncode/index.json,readwrite"
13+
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
14+
CMAKE_TOOLCHAIN_FILE: ${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
15+
516
on:
617
workflow_call:
718
inputs:
@@ -20,6 +31,28 @@ jobs:
2031
- name: Checkout repository
2132
uses: actions/checkout@v4
2233

34+
- name: Install vcpkg
35+
shell: pwsh
36+
run: git clone --depth=1 https://github.com/Microsoft/vcpkg ${{github.workspace}}/vcpkg
37+
38+
- name: Bootstrap vcpkg
39+
shell: pwsh
40+
run: ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.bat
41+
42+
- name: Add NuGet sources
43+
shell: pwsh
44+
run: |
45+
.$(${{ env.VCPKG_EXE }} fetch nuget) `
46+
sources add `
47+
-Source "${{ env.FEED_URL }}" `
48+
-StorePasswordInClearText `
49+
-Name GitHubPackages `
50+
-UserName "${{ env.USERNAME }}" `
51+
-Password "${{ secrets.GITHUB_TOKEN }}"
52+
.$(${{ env.VCPKG_EXE }} fetch nuget) `
53+
setapikey "${{ secrets.GITHUB_TOKEN }}" `
54+
-Source "${{ env.FEED_URL }}"
55+
2356
- name: CMake Build
2457
run: .\Scripts\BuildEngine.ps1 -Configurations ${{inputs.configuration}} -RunClangFormat 0
2558
shell: pwsh
@@ -42,6 +75,5 @@ jobs:
4275
with:
4376
name: Vulkan-build-x64-${{inputs.configuration}}
4477
path: |
45-
Result.Windows.x64.MultiConfig/_deps/Vulkan-Loader/loader/${{inputs.configuration}}/vulkan-1.dll
46-
Result.Windows.x64.MultiConfig/_deps/Vulkan-Loader/loader/${{inputs.configuration}}/vulkan-1.exp
47-
Result.Windows.x64.MultiConfig/_deps/Vulkan-Loader/loader/${{inputs.configuration}}/vulkan-1.lib
78+
Result.Windows.x64.MultiConfig/vcpkg_installed/x64-windows/bin/vulkan-1.dll
79+
Result.Windows.x64.MultiConfig/vcpkg_installed/x64-windows/lib/vulkan-1.lib

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,3 +424,6 @@ CMakeSettings.json
424424

425425
# MacOS files
426426
.DS_Store
427+
428+
# Vcpkg Install Directory
429+
vcpkg_installed/

CMakePresets.json

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@
4343
"YAML_CPP_FORMAT_SOURCE": "OFF",
4444
"YAML_BUILD_SHARED_LIBS": "OFF",
4545

46+
"USE_MASM": "OFF",
4647
"USE_GAS": "OFF",
4748

4849
"SPIRV_SKIP_EXECUTABLES": "ON",
4950
"SPIRV_SKIP_TESTS": "ON",
50-
"GLSLANG_ENABLE_INSTALL": "OFF",
51+
"GLSLANG_ENABLE_INSTALL": "ON",
5152
"ALLOW_EXTERNAL_SPIRV_TOOLS": "ON",
52-
"ENABLE_OPT": "OFF",
5353

5454
"SPIRV_CROSS_ENABLE_TESTS": "OFF"
5555
}
@@ -60,10 +60,9 @@
6060
"displayName": "Windows Visual Studio Debug",
6161
"generator": "Visual Studio 17 2022",
6262
"binaryDir": "Result.Windows.x64.MultiConfig",
63+
"architecture": "x64",
6364
"cacheVariables": {
6465
"CMAKE_BUILD_TYPE": "Debug",
65-
"USE_MASM": "OFF",
66-
"CMAKE_PREFIX_PATH": "__tools/ShaderCCompiler",
6766
"CMAKE_CONFIGURATION_TYPES": "Debug"
6867
}
6968

@@ -85,7 +84,6 @@
8584
"binaryDir": "Result.Darwin.x64.Debug",
8685
"generator": "Xcode",
8786
"cacheVariables": {
88-
"CMAKE_PREFIX_PATH": "__tools/ShaderCCompiler",
8987
"BUILD_FRAMEWORK": "ON"
9088
}
9189
},
@@ -101,34 +99,24 @@
10199

102100
{
103101
"name": "Darwin_arm64_Debug",
104-
"inherits": "BaseOptions",
102+
"inherits": "Darwin_x64_Debug",
105103
"binaryDir": "Result.Darwin.arm64.Debug",
106-
"displayName": "Darwin ARM XCode Debug",
107-
"generator": "Xcode",
108-
"cacheVariables": {
109-
"BUILD_FRAMEWORK": "ON"
110-
}
104+
"displayName": "Darwin ARM XCode Debug"
111105
},
112106

113107
{
114108
"name": "Darwin_arm64_Release",
115-
"inherits": "Darwin_arm64_Debug",
109+
"inherits": "Darwin_x64_Release",
116110
"binaryDir": "Result.Darwin.arm64.Release",
117-
"displayName": "Darwin ARM XCode Release",
118-
"cacheVariables": {
119-
"CMAKE_BUILD_TYPE": "Release"
120-
}
111+
"displayName": "Darwin ARM XCode Release"
121112
},
122113

123114
{
124115
"name": "Linux_x64_Debug",
125116
"inherits": "BaseOptions",
126117
"displayName": "Linux Ninja Debug",
127118
"binaryDir": "Result.Linux.x64.Debug",
128-
"generator": "Ninja",
129-
"cacheVariables": {
130-
"CMAKE_PREFIX_PATH": "__tools/ShaderCCompiler"
131-
}
119+
"generator": "Ninja"
132120
},
133121
{
134122
"name": "Linux_x64_Release",

dependencies.cmake

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FetchContent_Declare(
44
fmt
55
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
66
GIT_SHALLOW TRUE
7-
FIND_PACKAGE_ARGS
7+
FIND_PACKAGE_ARGS CONFIG
88
)
99

1010
FetchContent_Declare(
@@ -27,50 +27,51 @@ FetchContent_Declare(
2727
stbimage
2828
GIT_REPOSITORY https://github.com/nothings/stb.git
2929
SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/stb
30-
GIT_SHALLOW TRUE)
30+
GIT_SHALLOW TRUE
31+
)
3132

3233
FetchContent_Declare(
3334
glfw3
3435
GIT_REPOSITORY https://github.com/glfw/glfw.git
3536
GIT_SHALLOW TRUE
36-
FIND_PACKAGE_ARGS
37+
FIND_PACKAGE_ARGS CONFIG
3738
)
3839

3940
FetchContent_Declare(
4041
spdlog
4142
GIT_REPOSITORY https://github.com/gabime/spdlog.git
4243
GIT_SHALLOW TRUE
4344
GIT_TAG v1.15.3
44-
FIND_PACKAGE_ARGS
45+
FIND_PACKAGE_ARGS CONFIG
4546
)
4647

4748
FetchContent_Declare(
4849
EnTT
4950
GIT_REPOSITORY https://github.com/skypjack/entt.git
5051
GIT_SHALLOW TRUE
51-
FIND_PACKAGE_ARGS
52+
FIND_PACKAGE_ARGS CONFIG
5253
)
5354

5455
FetchContent_Declare(
5556
assimp
5657
GIT_REPOSITORY https://github.com/assimp/assimp.git
5758
GIT_TAG v5.3.0
5859
GIT_SHALLOW TRUE
59-
FIND_PACKAGE_ARGS
60+
FIND_PACKAGE_ARGS CONFIG
6061
)
6162

6263
FetchContent_Declare(
6364
stduuid
6465
GIT_REPOSITORY https://github.com/mariusbancila/stduuid.git
6566
GIT_SHALLOW TRUE
66-
FIND_PACKAGE_ARGS
67+
FIND_PACKAGE_ARGS CONFIG
6768
)
6869

6970
FetchContent_Declare(
7071
yaml-cpp
7172
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp
7273
GIT_SHALLOW TRUE
73-
FIND_PACKAGE_ARGS
74+
FIND_PACKAGE_ARGS CONFIG
7475
)
7576

7677

@@ -79,23 +80,23 @@ FetchContent_Declare(
7980
GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Cross.git
8081
GIT_TAG vulkan-sdk-1.3.296
8182
GIT_SHALLOW TRUE
82-
FIND_PACKAGE_ARGS
83+
FIND_PACKAGE_ARGS CONFIG
8384
)
8485

8586
FetchContent_Declare(
8687
VulkanMemoryAllocator
8788
GIT_REPOSITORY
8889
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
8990
GIT_SHALLOW TRUE
90-
FIND_PACKAGE_ARGS
91+
FIND_PACKAGE_ARGS CONFIG
9192
)
9293

9394
FetchContent_Declare(
9495
SPIRV-Headers
9596
GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Headers.git
9697
GIT_SHALLOW TRUE
9798
GIT_TAG main
98-
FIND_PACKAGE_ARGS
99+
FIND_PACKAGE_ARGS CONFIG
99100
)
100101

101102
FetchContent_Declare(
@@ -104,7 +105,7 @@ FetchContent_Declare(
104105
GIT_SHALLOW TRUE
105106
GIT_TAG main-tot
106107
SOURCE_DIR "${FETCHCONTENT_BASE_DIR}/glslang"
107-
FIND_PACKAGE_ARGS
108+
FIND_PACKAGE_ARGS CONFIG
108109
)
109110

110111

@@ -113,12 +114,7 @@ FetchContent_Declare(
113114
GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Tools.git
114115
GIT_SHALLOW TRUE
115116
GIT_TAG main
116-
FIND_PACKAGE_ARGS
117-
)
118-
119-
FetchContent_Declare(
120-
SPIRV-Tools-opt
121-
FIND_PACKAGE_ARGS
117+
FIND_PACKAGE_ARGS CONFIG
122118
)
123119

124120

@@ -127,22 +123,22 @@ Fetchcontent_Declare(
127123
GIT_REPOSITORY https://github.com/google/googletest.git
128124
GIT_SHALLOW TRUE
129125
GIT_TAG main
130-
FIND_PACKAGE_ARGS
126+
FIND_PACKAGE_ARGS CONFIG
131127
)
132128

133129
Fetchcontent_Declare(
134130
nlohmann_json
135131
GIT_REPOSITORY https://github.com/nlohmann/json.git
136132
GIT_SHALLOW TRUE
137-
FIND_PACKAGE_ARGS
133+
FIND_PACKAGE_ARGS CONFIG
138134
)
139135

140136
Fetchcontent_Declare(
141137
tlsf
142138
GIT_REPOSITORY https://github.com/mattconte/tlsf
143139
GIT_SHALLOW TRUE
144140
SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/tlsf
145-
FIND_PACKAGE_ARGS
141+
FIND_PACKAGE_ARGS CONFIG
146142
)
147143

148144
Fetchcontent_Declare(
@@ -151,7 +147,7 @@ Fetchcontent_Declare(
151147
GIT_SHALLOW TRUE
152148
GIT_TAG main
153149
SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/CLI11
154-
FIND_PACKAGE_ARGS
150+
FIND_PACKAGE_ARGS CONFIG
155151
)
156152

157153

@@ -160,21 +156,24 @@ Fetchcontent_Declare(
160156
GIT_REPOSITORY https://github.com/Nicoshev/rapidhash
161157
GIT_SHALLOW TRUE
162158
SOURCE_DIR ${FETCHCONTENT_BASE_DIR}/rapidhash
163-
FIND_PACKAGE_ARGS
159+
FIND_PACKAGE_ARGS CONFIG
164160
)
165161

166162
FetchContent_Declare(Vulkan-Headers
167163
GIT_REPOSITORY https://github.com/KhronosGroup/Vulkan-Headers
168164
GIT_SHALLOW TRUE
169165
GIT_TAG v1.3.296
166+
FIND_PACKAGE_ARGS CONFIG NAMES VulkanHeaders
170167
)
171168

172169
FetchContent_Declare(Vulkan-Loader
173170
GIT_REPOSITORY https://github.com/KhronosGroup/Vulkan-Loader
174171
GIT_SHALLOW TRUE
175172
GIT_TAG v1.3.296
173+
FIND_PACKAGE_ARGS CONFIG NAMES VulkanLoader
176174
)
177175

176+
178177
FetchContent_MakeAvailable(
179178
fmt
180179
Vulkan-Headers
@@ -191,7 +190,6 @@ FetchContent_MakeAvailable(
191190
VulkanMemoryAllocator
192191
SPIRV-Headers
193192
SPIRV-Tools
194-
SPIRV-Tools-opt
195193
glslang
196194
spirv_cross_core
197195
GTest
@@ -201,6 +199,8 @@ FetchContent_MakeAvailable(
201199
rapidhash
202200
)
203201

202+
find_package(SPIRV-Tools-opt CONFIG)
203+
204204
set(IMGUIDIR ${FETCHCONTENT_BASE_DIR}/imgui)
205205

206206
add_library(imgui STATIC)
@@ -245,9 +245,17 @@ target_include_directories(External_libs
245245
${FETCHCONTENT_BASE_DIR}/stb
246246
${FETCHCONTENT_BASE_DIR}/CLI11
247247
${FETCHCONTENT_BASE_DIR}/tlsf
248-
"__tools/ShaderCCompiler/include"
249248
)
250249

250+
251+
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
252+
target_link_libraries(External_libs INTERFACE SPIRV-Tools-static)
253+
else()
254+
target_link_libraries(External_libs INTERFACE SPIRV-Tools)
255+
256+
endif()
257+
258+
251259
target_link_libraries(External_libs
252260
INTERFACE
253261
fmt::fmt
@@ -258,6 +266,7 @@ target_link_libraries(External_libs
258266
stduuid
259267
yaml-cpp::yaml-cpp
260268
spirv-cross-core
269+
SPIRV-Tools-opt
261270
glslang::glslang
262271
glslang::glslang-default-resource-limits
263272
glslang::SPIRV
@@ -266,6 +275,7 @@ target_link_libraries(External_libs
266275
nlohmann_json::nlohmann_json
267276
)
268277

278+
269279
add_library(imported::ZEngine_External_Dependencies ALIAS External_libs)
270280

271281
add_library(External_obeliskLibs INTERFACE)

0 commit comments

Comments
 (0)