Skip to content

Commit 05e342d

Browse files
committed
Fixed packaging logic to include vulkan dlls for Windows
1 parent 5268601 commit 05e342d

File tree

8 files changed

+45
-23
lines changed

8 files changed

+45
-23
lines changed

engine/render/Makefile

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ linkFlags += -l utils -l window
2828
compileFlags += -I $(vendorDir)/vulkan/include -I $(vendorDir)/glfw/include -I $(vendorDir)/glm \
2929
-I $(vendorDir)/zlib/build/include -I $(vendorDir)/libpng -I $(vendorDir)/include/freetype
3030

31-
.PHONY: all vulkan-libs
31+
.PHONY: all
3232

33-
all: $(renderLib) $(vertObjects) $(fragObjects) vulkan-libs
33+
all: $(renderLib) $(vertObjects) $(fragObjects)
3434

3535
# Build the static library
3636
$(renderLib): $(renderObjects)
@@ -48,9 +48,4 @@ $(renderBinDir)/%.o: $(renderSrcDir)/%.cpp
4848
# Compile shaders to the build directory
4949
$(renderBuildDir)/assets/shaders/%.spv: $(renderSrcDir)/assets/shaders/%
5050
$(MKDIR) $(call platformpth, $(@D))
51-
$(call platformpth,$(vendorDir)/glslang/build/StandAlone/glslangValidator$(EXE_NAME)) $< -V -o $@
52-
53-
# Copy Vulkan libraries to the build directory
54-
vulkan-libs:
55-
$(MKDIR) $(call platformpth, $(renderBuildDir)/lib)
56-
$(call COPY,$(vendorDir)/vulkan/lib,$(renderBuildDir)/lib,$(RWCARDGLOB))
51+
$(call platformpth,$(vendorDir)/glslang/build/StandAlone/glslangValidator$(EXE_NAME)) $< -V -o $@

examples/game/Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ packagingFlags = $(ENV_VARS) --excludes "$(packagingExcludes)"
5050
compileFlags += -I $(vendorDir)/glfw/include -I $(vendorDir)/glm -I $(vendorDir)/freetype/include
5151
linkFlags += -l core -l window -l render -l resources -l utils
5252

53-
.PHONY: all pack-assets
53+
.PHONY: all vulkan-libs pack-assets
5454

55-
all: $(exampleGameApp) pack-assets
55+
all: $(exampleGameApp) vulkan-libs pack-assets
5656

5757
# Link the object files and create an executable
5858
$(exampleGameApp): $(utilsLib) $(windowLib) $(renderLib) $(coreLib) $(exampleGameObjects)
@@ -74,9 +74,13 @@ pack-assets:
7474
$(MKDIR) $(call platformpth,$(exampleGameBuildDir)/assets/shaders)
7575
$(call COPY,$(binDir)/engine/render/build/assets/shaders,$(exampleGameBuildDir)/assets/shaders,$(RWCARDGLOB))
7676
$(packerApp) $(exampleGameBuildDir)/app.pck $(exampleGameBuildDir) $(exampleGameAssets)
77-
$(RM) $(call platformpth,$(exampleGameBuildDir)/assets)
7877

7978
# Package the built application and all its assets to the output directory
8079
package: all
8180
$(RM) "$(outputDir)/$(exampleGameOutputName)"
8281
$(call PACKAGE_SCRIPT, $(exampleGameOutputName), $(call BASENAME, $(exampleGameApp)), $(outputDir), $(exampleGameBuildDir), $(packagingFlags))
82+
83+
# Copy Vulkan libraries to the build directory
84+
vulkan-libs:
85+
$(call COPY_VULKAN,$(vendorDir),$(exampleGameBuildDir))
86+

examples/render/Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ packagingFlags = $(ENV_VARS) --excludes "$(packagingExcludes)"
4949
compileFlags += -I $(vendorDir)/glfw/include -I $(vendorDir)/glm -I $(vendorDir)/freetype/include
5050
linkFlags += -l render -l window -l resources -l utils
5151

52-
.PHONY: all pack-assets
52+
.PHONY: all vulkan-libs pack-assets
5353

54-
all: $(exampleRenderApp) pack-assets
54+
all: $(exampleRenderApp) vulkan-libs pack-assets
5555

5656
# Link the object files and create an executable
5757
$(exampleRenderApp): $(renderLib) $(exampleRenderObjects)
@@ -73,9 +73,12 @@ pack-assets:
7373
$(MKDIR) $(call platformpth,$(exampleRenderBuildDir)/assets/shaders)
7474
$(call COPY,$(binDir)/engine/render/build/assets/shaders,$(exampleRenderBuildDir)/assets/shaders,$(RWCARDGLOB))
7575
$(packerApp) $(exampleRenderBuildDir)/app.pck $(exampleRenderBuildDir) $(exampleRenderAssets)
76-
$(RM) $(call platformpth,$(exampleRenderBuildDir)/assets)
7776

7877
# Package the built application and all its assets to the output directory
7978
package:
8079
$(RM) "$(outputDir)/$(exampleRenderOutputName)"
8180
$(call PACKAGE_SCRIPT, $(exampleRenderOutputName), $(call BASENAME, $(exampleRenderApp)), $(outputDir), $(exampleRenderBuildDir), $(packagingFlags))
81+
82+
# Copy Vulkan libraries to the build directory
83+
vulkan-libs:
84+
$(call COPY_VULKAN,$(vendorDir),$(exampleRenderBuildDir))

examples/tilemap/Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ packagingFlags = $(ENV_VARS) --excludes "$(packagingExcludes)"
4848
compileFlags += -I $(vendorDir)/glfw/include -I $(vendorDir)/glm -I $(vendorDir)/freetype/include
4949
linkFlags += -l render -l window -l resources -l utils
5050

51-
.PHONY: all pack-assets
51+
.PHONY: all vulkan-libs pack-assets
5252

53-
all: $(exampleTilemapApp) pack-assets
53+
all: $(exampleTilemapApp) vulkan-libs pack-assets
5454

5555
# Link the object files and create an executable
5656
$(exampleTilemapApp): $(renderLib) $(exampleTilemapObjects)
@@ -72,9 +72,12 @@ pack-assets:
7272
$(MKDIR) $(call platformpth,$(exampleTilemapBuildDir)/assets/shaders)
7373
$(call COPY,$(binDir)/engine/render/build/assets/shaders,$(exampleTilemapBuildDir)/assets/shaders,$(RWCARDGLOB))
7474
$(packerApp) $(exampleTilemapBuildDir)/app.pck $(exampleTilemapBuildDir) $(exampleTilemapAssets)
75-
$(RM) $(call platformpth,$(exampleTilemapBuildDir)/assets)
7675

7776
# Package the built application and all its assets to the output directory
7877
package:
7978
$(RM) "$(outputDir)/$(exampleTilemapOutputName)"
80-
$(call PACKAGE_SCRIPT, $(exampleTilemapOutputName), $(call BASENAME, $(exampleTilemapApp)), $(outputDir), $(exampleTilemapBuildDir), $(packagingFlags))
79+
$(call PACKAGE_SCRIPT, $(exampleTilemapOutputName), $(call BASENAME, $(exampleTilemapApp)), $(outputDir), $(exampleTilemapBuildDir), $(packagingFlags))
80+
81+
# Copy Vulkan libraries to the build directory
82+
vulkan-libs:
83+
$(call COPY_VULKAN,$(vendorDir),$(exampleTilemapBuildDir))

make/Platform.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ ifeq ($(OS), Windows_NT)
1818
EXE_NAME := .exe
1919
VOLK_OS := WIN32_KHR
2020
COPY = powershell -executionpolicy bypass $(scriptsDir)/copy.ps1 -Source $1 -Destination $2 -Filter $3
21+
COPY_VULKAN = $(call COPY,$1/vulkan/lib,$2/lib,$(RWCARDGLOB)); $(call COPY,$2/lib, $2,"vulkan-1.dll"); $(RM) $2\lib\vulkan-1.dll
2122
BASENAME = $(basename $1)
2223
VALIDATION_LAYERS_INSTALL_DIR := explicit_layer.d
2324
BUILD_FLAGS_SCRIPT = powershell -executionpolicy bypass $(scriptsDir)/buildflags.ps1 --Target $1 --CXXFlags $2 --Dirs $3
@@ -44,9 +45,10 @@ else
4445
RWCARDGLOB := **
4546
THEN := ;
4647
PATHSEP := /
47-
MKDIR := mkdir -p
48+
MKDIR = mkdir -p $1
4849
RM := rm -rf
4950
COPY = cp -r $1$(PATHSEP)$3 $2
51+
COPY_VULKAN = $(call COPY,$1/vulkan/lib,$2/lib,$(RWCARDGLOB))
5052
BASENAME = $(shell basename $1)
5153
COPY_DIR = $(call COPY,$1,$2,$3)
5254
VALIDATION_LAYERS_INSTALL_DIR := lib/explicit_layer.d

scripts/copy.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@
77
#
88

99
param( [String] $Source, [String] $Destination, [String] $Filter)
10-
Write-Host ">>> $Filter"
1110
robocopy $Source $Destination $Filter /e /im /is /it

scripts/package.ps1

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ if (Test-Path $OutputDir/$PkgName) { Remove-Item -Path $OutputDir/$PkgName -Recu
3939

4040
New-Item -Path $PkgFile -ItemType directory -Force
4141

42-
Get-ChildItem $BuildDir/lib | Copy-Item -Filter * -Destination $PkgFile -Recurse -Force
42+
if (Test-Path -Path $BuildDir/lib)
43+
{
44+
Get-ChildItem -Directory $BuildDir/lib | Copy-Item -Filter * -Destination $PkgFile -Recurse -Force
45+
}
4346

4447
New-Item -Path $BuildDir/assets -ItemType directory -Force
4548

@@ -51,4 +54,11 @@ Get-ChildItem $BuildDir | Copy-Item -Filter **.exe -Destination $PkgFile -Recurs
5154
if ($Excludes.Count -gt 0)
5255
{
5356
foreach ($i in $Excludes) { if ($1 -ne $OutputDir) { Remove-Item -Path $PkgFile/$i -Recurse -Force -ErrorAction SilentlyContinue } }
54-
}
57+
}
58+
59+
if (-not (Test-Path -Path "$PkgFile/lib/*"))
60+
{
61+
Remove-Item -Path $PkgFile/lib -Force
62+
}
63+
64+
Remove-Item -Path "$PkgFile/assets" -Force -Recurse

scripts/package.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,10 @@ for EXCLUDE in $EXCLUDES; do
8080
if [[ "$EXCLUDE_PATH" != "$CONTENTS_DIR/" ]]; then
8181
rm -rf "$EXCLUDE_PATH"
8282
fi
83-
done
83+
done
84+
85+
if [ -z "$( ls -A "$CONTENTS_DIR/lib" )" ]; then
86+
rm -rf "$CONTENTS_DIR/lib"
87+
fi
88+
89+
rm -rf "$CONTENTS_DIR/assets"

0 commit comments

Comments
 (0)