23
23
# Requires -PSEdition Core
24
24
25
25
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
+
26
34
[Parameter (HelpMessage = " Configuration type to build, default to Debug" )]
27
35
[ValidateSet (' Debug' , ' Release' )]
28
36
[string []] $Configurations = ' Debug' ,
@@ -33,23 +41,10 @@ param (
33
41
34
42
$ErrorActionPreference = " Stop"
35
43
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
-
49
44
[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 {
53
48
[IO.Path ]::Combine($RepoRoot , " Result.$SystemName .x64.$Configurations " )
54
49
}
55
50
@@ -63,26 +58,53 @@ $ContentsToProcess = @(
63
58
Name = " Resources"
64
59
IsDirectory = $true
65
60
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
+ }
78
77
}
79
78
)
80
79
},
81
80
@ {
82
81
Name = " Tetragrama"
83
82
IsDirectory = $true
84
83
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
+ }
86
108
)
87
109
}
88
110
)
0 commit comments