Skip to content

Commit f4dd52e

Browse files
Updating post build for macOS Intel / Silicon architecture (#369)
* updated post build for macos arch * updated macos pipeline builds * fixed script type * fixed typo again
1 parent d84a634 commit f4dd52e

File tree

3 files changed

+79
-34
lines changed

3 files changed

+79
-34
lines changed

.github/workflows/macOS-build.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,27 @@ on:
77
branches: [ master, develop ]
88

99
jobs:
10-
macOS-Build:
10+
macOS-Intel-Build:
1111
runs-on: macos-13
1212
strategy:
1313
matrix:
1414
buildConfiguration: [Debug, Release]
1515

16-
steps:
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v2
19+
20+
- name: CMake Build
21+
run: .\Scripts\BuildEngine.ps1 -Configurations ${{matrix.buildConfiguration}}
22+
shell: pwsh
23+
24+
macOS-Silicon-Build:
25+
runs-on: macos-latest
26+
strategy:
27+
matrix:
28+
buildConfiguration: [Debug, Release]
29+
30+
steps:
1731
- name: Checkout repository
1832
uses: actions/checkout@v2
1933

CMakeLists.txt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,24 @@ add_custom_target (AssembleContent ALL
111111
DEPENDS BuildLauncher
112112
)
113113

114+
115+
set (SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
116+
if ((${CMAKE_SYSTEM_NAME} STREQUAL "Windows") OR (${CMAKE_SYSTEM_NAME} STREQUAL "Linux"))
117+
set (SYSTEM_ARCHITECTURE "x64")
118+
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
119+
if (MACOSX_ARCHITECTURE_ARM64)
120+
set (SYSTEM_ARCHITECTURE "osx-arm64")
121+
else ()
122+
set (SYSTEM_ARCHITECTURE "osx-x64")
123+
endif ()
124+
endif ()
114125
add_custom_command (TARGET AssembleContent
115126
POST_BUILD
116-
COMMAND pwsh ${CMAKE_CURRENT_SOURCE_DIR}/Scripts/PostBuild.ps1 -Configurations $<IF:$<CONFIG:Debug>,Debug,Release> $<$<BOOL:${LAUNCHER_ONLY}>:-LauncherOnly>
127+
COMMAND pwsh ${CMAKE_CURRENT_SOURCE_DIR}/Scripts/PostBuild.ps1 -SystemName ${SYSTEM_NAME} -Architectures ${SYSTEM_ARCHITECTURE} -Configurations $<IF:$<CONFIG:Debug>,Debug,Release> $<$<BOOL:${LAUNCHER_ONLY}>:-LauncherOnly>
117128
)
118129

119130
# Copying Examples dir
120131
#
121132
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Examples/projectConfig.json)
122133
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Examples/projectConfig.json DESTINATION ${CMAKE_BINARY_DIR}/Examples)
123134
endif ()
124-
125-

Scripts/PostBuild.ps1

Lines changed: 51 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@
2323
#Requires -PSEdition Core
2424

2525
param (
26+
[Parameter(HelpMessage="SystemName type to build, default to Windows")]
27+
[ValidateSet('Windows', 'Darwin', 'Linux')]
28+
[string[]] $SystemName = 'Windows',
29+
30+
[Parameter(HelpMessage="Architecture type to build, default to x64")]
31+
[ValidateSet('x64', 'arm64', 'osx-x64', 'osx-arm64')]
32+
[string[]] $Architectures = 'x64',
33+
2634
[Parameter(HelpMessage="Configuration type to build, default to Debug")]
2735
[ValidateSet('Debug', 'Release')]
2836
[string[]] $Configurations = 'Debug',
@@ -33,23 +41,10 @@ param (
3341

3442
$ErrorActionPreference = "Stop"
3543

36-
# Check the system name
37-
if ($IsLinux) {
38-
$SystemName = "Linux"
39-
}
40-
elseif ($IsMacOS) {
41-
$SystemName = "Darwin"
42-
}
43-
elseif ($IsWindows) {
44-
$SystemName = "Windows"
45-
}else{
46-
throw 'The OS is not supported'
47-
}
48-
4944
[string]$RepoRoot = [IO.Path]::Combine($PSScriptRoot, "..")
50-
[string]$OuputBuildDirectory = If($IsWindows) {
51-
[IO.Path]::Combine($RepoRoot, "Result.Windows.x64.MultiConfig")
52-
} Else {
45+
[string]$OuputBuildDirectory = If($IsWindows) {
46+
[IO.Path]::Combine($RepoRoot, "Result.Windows.x64.MultiConfig")
47+
} Else {
5348
[IO.Path]::Combine($RepoRoot, "Result.$SystemName.x64.$Configurations")
5449
}
5550

@@ -63,26 +58,53 @@ $ContentsToProcess = @(
6358
Name = "Resources"
6459
IsDirectory = $true
6560
Contents = @(
66-
67-
if ($IsWindows) {
68-
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Tetragrama\src\$Configurations\Shaders"}
69-
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Tetragrama\src\$Configurations\Settings"}
70-
}
71-
elseif ($IsMacOS) {
72-
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Tetragrama\src\$Configurations\Shaders"}
73-
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Tetragrama\src\$Configurations\Settings"}
74-
}
75-
else {
76-
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Tetragrama\src\Shaders"}
77-
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Tetragrama\src\Settings"}
61+
switch ($SystemName) {
62+
"Windows" {
63+
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Tetragrama\src\$Configurations\Shaders"}
64+
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Tetragrama\src\$Configurations\Settings"}
65+
}
66+
"Darwin" {
67+
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Tetragrama\src\$Configurations\Shaders"}
68+
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Tetragrama\src\$Configurations\Settings"}
69+
}
70+
"Linux" {
71+
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Tetragrama\src\Shaders"}
72+
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Tetragrama\src\Settings"}
73+
}
74+
Default {
75+
throw 'This system is not supported'
76+
}
7877
}
7978
)
8079
},
8180
@{
8281
Name = "Tetragrama"
8382
IsDirectory = $true
8483
Contents = @(
85-
@{ From = "$OuputBuildDirectory\Tetragrama\src\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\net6.0\Editor"}
84+
switch ($SystemName) {
85+
"Windows" {
86+
@{ From = "$OuputBuildDirectory\Tetragrama\src\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\net6.0\Editor"}
87+
}
88+
"Darwin" {
89+
switch ($Architectures) {
90+
"osx-x64" {
91+
@{ From = "$OuputBuildDirectory\Tetragrama\src\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\net6.0\$Architectures\Editor"}
92+
}
93+
"osx-arm64" {
94+
@{ From = "$OuputBuildDirectory\Tetragrama\src\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\net6.0\$Architectures\Editor"}
95+
}
96+
Default {
97+
throw 'This architecture is not supported'
98+
}
99+
}
100+
}
101+
"Linux" {
102+
@{ From = "$OuputBuildDirectory\Tetragrama\src\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\net6.0\Editor"}
103+
}
104+
Default {
105+
throw 'This system is not supported'
106+
}
107+
}
86108
)
87109
}
88110
)

0 commit comments

Comments
 (0)