Skip to content

Commit 71d4be2

Browse files
committed
Converted all bat scripts to powershell scripts
1 parent ef2c302 commit 71d4be2

File tree

14 files changed

+126
-176
lines changed

14 files changed

+126
-176
lines changed

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@ endif
1818
# Set platform vars
1919
ifeq ($(platform), windows)
2020
linkFlags += -Wl,--allow-multiple-definition -pthread -lopengl32 -lgdi32 -lwinmm -mwindows -static -static-libgcc -static-libstdc++
21-
export packageScript = $(scriptsDir)/package.bat
21+
export packageScript = powershell -executionpolicy bypass $(scriptsDir)/package.ps1 --pkg-name $1 --exe-name $2 --output-dir $3 --build-dir $4 $5
2222
else ifeq ($(platform), linux)
2323
linkFlags += -Wl,--no-as-needed -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi -no-pie
2424
formatScript = $(scriptsDir)/format.sh
25-
export packageScript = $(scriptsDir)/package.sh
2625
else ifeq ($(platform), macos)
2726
linkFlags += -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL
2827
formatScript = $(scriptsDir)/format.sh
29-
export packageScript = $(scriptsDir)/package.sh
3028
endif
3129

3230
# Set directories
@@ -93,7 +91,7 @@ package-renderapp: renderapp
9391

9492
# Check to invalidate the build if flags have changed
9593
buildFlags:
96-
$(BUILD_FLAGS_SCRIPT) $(buildFlagsFile) "$(CXXFLAGS)" "$(libDir) $(binDir)"
94+
$(call BUILD_FLAGS_SCRIPT, $(buildFlagsFile), $(CXXFLAGS), $(libDir) $(binDir))
9795

9896
# Run cleanup across project
9997
clean:

engine/core/Makefile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ raylibLib := $(vendorDir)/raylib-cpp/vendor/raylib/$(libGenDir)/libraylib.a
2727
$(coreLib): $(raylibLib) $(raylibIncludeDir) $(coreObjects)
2828
$(MKDIR) $(call platformpth, $(libDir))
2929
$(RM) $(call platformpth, $(coreLib))
30-
$(call COPY,$(vendorDir)/raylib-cpp/vendor/raylib/$(libGenDir),$(libDir),libraylib.a)
31-
mv $(call platformpth,$(libDir)/libraylib.a) $(call platformpth,$(libDir)/libcore.a)
32-
ar -rs $(coreLib) $(coreObjects)
30+
$(call COMBINE_LIBS, $(vendorDir)/raylib-cpp/vendor/raylib/$(libGenDir)/libraylib.a, $(coreObjects), $(libDir), core)
3331

3432
# Add all rules from dependency files
3533
-include $(coreDepends)
@@ -43,8 +41,8 @@ $(coreBinDir)/%.o: $(coreSrcDir)/%.cpp
4341
# Copy the relevant header files into includes
4442
$(raylibIncludeDir):
4543
$(MKDIR) $(call platformpth, $(raylibIncludeDir)/raylib)
46-
$(call COPY,$(vendorDir)/raylib-cpp/vendor/raylib/src,$(raylibIncludeDir)/raylib,raylib.h)
47-
$(call COPY,$(vendorDir)/raylib-cpp/vendor/raylib/src,$(raylibIncludeDir)/raylib,raymath.h)
44+
$(call COPY,$(vendorDir)/raylib-cpp/vendor/raylib/src,$(raylibIncludeDir)/raylib,raylib.h,**)
45+
$(call COPY,$(vendorDir)/raylib-cpp/vendor/raylib/src,$(raylibIncludeDir)/raylib,raymath.h,**)
4846
$(call COPY,$(vendorDir)/raylib-cpp/include,$(raylibIncludeDir)/raylib,*.hpp)
4947

5048
# Build the raylib static library file

engine/render/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ $(renderBuildDir)/assets/shaders/%.spv: $(renderSrcDir)/assets/shaders/%
5353
# Copy Vulkan libraries to the build directory
5454
vulkan-libs:
5555
$(MKDIR) $(call platformpth, $(renderBuildDir)/lib)
56-
$(call COPY_DIR,$(vendorDir)/vulkan/lib,$(renderBuildDir)/lib)
56+
$(call COPY,$(vendorDir)/vulkan/lib,$(renderBuildDir)/lib,**)

examples/game/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ game-assets:
4444
# Package the built application and all its assets to the output directory
4545
package: all
4646
$(RM) $(call platformpth,$(outputDir)/$(exampleGameOutputName))
47-
$(packageScript) $(exampleGameOutputName) $(shell basename $(exampleGameApp)) $(outputDir) $(exampleGameBuildDir)
47+
$(call PACKAGE_SCRIPT, $(exampleGameOutputName), $(shell basename $(exampleGameApp)), $(outputDir), $(exampleGameBuildDir))

examples/render/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ $(exampleRenderBinDir)/%.o: $(exampleRenderSrcDir)/%.cpp
6363
# Copy assets (and other required build files) directory to the build directory
6464
render-assets:
6565
$(MKDIR) $(call platformpth,$(exampleRenderBuildDir))
66-
$(call COPY_DIR,$(binDir)/engine/render/build,$(exampleRenderBuildDir))
66+
$(call COPY,$(binDir)/engine/render/build,$(exampleRenderBuildDir),**)
6767
$(MKDIR) $(call platformpth,$(exampleRenderBuildDir)/assets)
68-
$(call COPY_DIR,$(exampleRenderSrcDir)/assets,$(exampleRenderBuildDir)/assets)
68+
$(call COPY,$(exampleRenderSrcDir)/assets,$(exampleRenderBuildDir)/assets,**)
6969

7070
# Package the built application and all its assets to the output directory
7171
package:
7272
$(RM) "$(outputDir)/$(exampleRenderOutputName)"
73-
$(packageScript) $(exampleRenderOutputName) $(shell basename $(exampleRenderApp)) $(outputDir) $(exampleRenderBuildDir) $(packagingFlags)
73+
$(call PACKAGE_SCRIPT, $(exampleRenderOutputName), $(shell basename $(exampleRenderApp)), $(outputDir), $(exampleRenderBuildDir), $(packagingFlags))

make/Platform.mk

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ ifeq ($(OS), Windows_NT)
1111
CXX ?= g++
1212
THEN := &&
1313
PATHSEP := \$(BLANK)
14-
MKDIR = $(scriptsDir)/mkdir.bat
14+
MKDIR = powershell -executionpolicy bypass $(scriptsDir)/mkdir.ps1
1515
RM := rm -r -f
1616
EXE_NAME := .exe
1717
VOLK_OS := WIN32_KHR
18-
COPY = $(scriptsDir)/copy.bat $1 $2 $3
19-
COPY_DIR = $(scriptsDir)/copy.bat --copy-directory $1 $2
18+
COPY = powershell -executionpolicy bypass $(scriptsDir)/copy.ps1 $1 $2 $3
2019
VALIDATION_LAYERS_INSTALL_DIR := explicit_layer.d
21-
BUILD_FLAGS_SCRIPT = $(scriptsDir)/buildflags.bat
22-
COMBINE_LIBS = powershell $(scriptsDir)/combinelibs.ps1 --src_libs $1 --src_objs $2 --output_dir $3 --output_name $4
20+
BUILD_FLAGS_SCRIPT = powershell -executionpolicy bypass $(scriptsDir)/buildflags.ps1 --Target $1 --CXXFlags $2 --Dirs $3
21+
COMBINE_LIBS = powershell -executionpolicy bypass $(scriptsDir)/combinelibs.ps1 --src_libs $1 --src_objs $2 --output_dir $3 --output_name $4
22+
PACKAGE_SCRIPT = powershell -executionpolicy bypass $(scriptsDir)/package.ps1 --pkg-name $1 --exe-name $2 --output-dir $3 --build-dir $4 $5
2323
else
2424
COMBINE_LIBS = $(scriptsDir)/combinelibs.sh --src_libs $1 --src_objs $2 --output_dir $3 --output_name $4
2525
# Check for MacOS/Linux
@@ -45,5 +45,6 @@ else
4545
COPY = cp -r $1$(PATHSEP)$3 $2
4646
COPY_DIR = $(call COPY,$1,$2,$3)
4747
VALIDATION_LAYERS_INSTALL_DIR := lib/explicit_layer.d
48-
BUILD_FLAGS_SCRIPT = $(scriptsDir)/buildflags.sh
48+
BUILD_FLAGS_SCRIPT = $(scriptsDir)/buildflags.sh $1 "$2" "$3"
49+
PACKAGE_SCRIPT = $(scriptsDir)/package.sh $1 $2 $3 $4 $5
4950
endif

scripts/buildflags.bat

Lines changed: 0 additions & 40 deletions
This file was deleted.

scripts/buildflags.ps1

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright (c) 2022 Jonathan Moallem (@J-Mo63) & Aryeh Zinn (@Raelr)
2+
#
3+
# This code is released under an unmodified zlib license.
4+
# For conditions of distribution and use, please see:
5+
# https://opensource.org/licenses/Zlib
6+
7+
[string[]] $Dirs = @()
8+
[string] $CXXFlags = @()
9+
[string] $Target = @()
10+
11+
[string] $current_arg = @()
12+
13+
foreach ($arg in $args)
14+
{
15+
[string] $val = $arg
16+
17+
[string] $val = $arg
18+
if ($val.Contains("--")) {
19+
if ($current_arg -ne $val) { $current_arg = $val }
20+
continue
21+
}
22+
23+
if ($current_arg -eq "--Target") { $Target += $val }
24+
if ($current_arg -eq "--CXXFlags") { $CXXFlags += ' ' + $val }
25+
if ($current_arg -eq "--Dirs") { $Dirs += $val }
26+
}
27+
28+
[string] $Contents = @()
29+
30+
if (Test-Path $Target) { $Contents = Get-Content -Path $Target -Raw }
31+
32+
if ($Contents.Trim() -ne $CXXFlags.Trim())
33+
{
34+
foreach($i in $Dirs) { if (Test-Path $i) { Remove-Item -Path $i -Recurse } }
35+
Set-Content -Path $Target -Value $CXXFlags.Trim()
36+
}

scripts/copy.bat

Lines changed: 0 additions & 36 deletions
This file was deleted.

scripts/copy.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2022 Jonathan Moallem (@J-Mo63) & Aryeh Zinn (@Raelr)
2+
#
3+
# This code is released under an unmodified zlib license.
4+
# For conditions of distribution and use, please see:
5+
# https://opensource.org/licenses/Zlib
6+
#
7+
8+
param( [String] $Source, [String] $Destination, [String] $Filter)
9+
10+
Get-ChildItem $Source | Copy-Item -Filter $Filter -Destination $Destination -Recurse -Force

0 commit comments

Comments
 (0)