forked from 3MFConsortium/lib3mf
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathBuildMacOSiOSNuGet.ps1
More file actions
122 lines (102 loc) · 2.45 KB
/
BuildMacOSiOSNuGet.ps1
File metadata and controls
122 lines (102 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<#
.SYNOPSIS
Build the MacOS, iOS, and iOS Simulator projects
.DESCRIPTION
Build the MacOS, iOS, and iOS Simulator projects as they were generated by GenerateMacOSiOS.ps1
.EXAMPLE
BuildMacOSiOSNuGet.ps1
#>
[CmdletBinding()]
param(
[switch]$NoNuGet,
[switch]$NoMacOS,
[switch]$NoIOS,
[switch]$NoSimulator,
[switch]$NoDebug,
[switch]$NoRelease,
[switch]$StripDebugSymbols
)
$MACOS_OUTPUT_FOLDER = "macos"
$IOS_OUTPUT_FOLDER = "ios"
$IOS_SIMULATOR_OUTPUT_FOLDER = "ios_simulator"
function BuildProject($path)
{
Write-Host "Build XCode Project"
Push-Location "$path"
try
{
if (!$NoDebug)
{
cmake --build . --target lib3MF_s --config Debug
}
if (!$NoRelease)
{
cmake --build . --target lib3MF_s --config Release
}
}
finally
{
Pop-Location
}
}
function GenerateNuGetMacOS()
{
nuget pack $PSScriptRoot/../build/macos/nuget/macos/lib3mf.macos.nuspec -OutputDirectory $PSScriptRoot/../build/nuget
}
function GenerateNuGetIOS()
{
nuget pack $PSScriptRoot/../build/ios/nuget/ios/lib3mf.ios.nuspec -OutputDirectory $PSScriptRoot/../build/nuget
}
function StripDebugSymbols($path)
{
Write-Host "Stripping debug symbols from $($path)"
$files = Get-ChildItem -Path $path -Recurse -Filter "*.a"
foreach ($file in $files)
{
Write-Host "`t`tStripping symbols:$($file.Name)"
strip -S $file.FullName -o $file.FullName
}
}
function Main()
{
if (!$NoMacOS)
{
BuildProject $PSScriptRoot/../build/$MACOS_OUTPUT_FOLDER
}
if (!$NoIOS)
{
BuildProject $PSScriptRoot/../build/$IOS_OUTPUT_FOLDER
}
if (!$NoSimulator)
{
BuildProject $PSScriptRoot/../build/$IOS_SIMULATOR_OUTPUT_FOLDER
}
if($StripDebugSymbols)
{
if (!$NoMacOS)
{
StripDebugSymbols $PSScriptRoot/../build/$MACOS_OUTPUT_FOLDER
}
if (!$NoIOS)
{
StripDebugSymbols $PSScriptRoot/../build/$IOS_OUTPUT_FOLDER
}
if (!$NoSimulator)
{
StripDebugSymbols $PSScriptRoot/../build/$IOS_SIMULATOR_OUTPUT_FOLDER
}
}
if (!$NoNuGet)
{
if (!$NoMacOS)
{
GenerateNuGetMacOS
}
# Only generate the iOS NuGet package if we built both IOS and Simulator
if (!$NoIOS -and !$NoSimulator)
{
GenerateNuGetIOS
}
}
}
Main