forked from 3MFConsortium/lib3mf
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathGenerateMacOSiOS.ps1
More file actions
102 lines (87 loc) · 2.37 KB
/
GenerateMacOSiOS.ps1
File metadata and controls
102 lines (87 loc) · 2.37 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
<#
.SYNOPSIS
Generate the MacOS, iOS, and iOS Simulator projects from the cmake scripts
.DESCRIPTION
Generate the MacOS, iOS, and iOS Simulator projects from the cmake scripts.
Use BuildMacOSiOSNuGet.ps1 to build and generate the nuget packages.
.EXAMPLE
GenerateMacOSiOS.ps1
GenerateMacOSiOS.ps1 -LIB3MF_VERSION_PATCH 21
#>
[CmdletBinding()]
param(
[switch]$Clean,
[switch]$NoMacOS,
[switch]$NoIOS,
[switch]$NoSimulator,
$LIB3MF_VERSION_PATCH = 0
)
$MACOS_OUTPUT_FOLDER = "macos"
$IOS_OUTPUT_FOLDER = "ios"
$IOS_SIMULATOR_OUTPUT_FOLDER = "ios_simulator"
function CleanFiles()
{
Remove-Item "$PSScriptRoot/../build" -Recurse -Force | Write-Host
}
function GenerateProjectMacOS()
{
Write-Host "Generate XCode Project"
New-Item -Path "$PSScriptRoot/../build" -Name $MACOS_OUTPUT_FOLDER -ItemType Directory -Force | Out-Null
Push-Location "$PSScriptRoot/../build/$MACOS_OUTPUT_FOLDER"
try
{
cmake -G Xcode "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" "-DLIB3MF_VERSION_PATCH=$LIB3MF_VERSION_PATCH" ../..
}
finally
{
Pop-Location
}
}
function GenerateProjectIOS()
{
Write-Host "Generate XCode Project"
New-Item -Path "$PSScriptRoot/../build" -Name $IOS_OUTPUT_FOLDER -ItemType Directory -Force | Out-Null
Push-Location "$PSScriptRoot/../build/$IOS_OUTPUT_FOLDER" | Out-Null
try
{
cmake -G Xcode ../.. "-DLIB3MF_VERSION_PATCH=$LIB3MF_VERSION_PATCH" -DCMAKE_TOOLCHAIN_FILE="$PSScriptRoot/ios.toolchain.cmake" -DIOS_PLATFORM=OS -DIOS_DEPLOYMENT_TARGET="9.0" | Write-Host
}
finally
{
Pop-Location | Out-Null
}
}
function GenerateProjectIOSSimulator()
{
Write-Host "Generate XCode Project"
New-Item -Path "$PSScriptRoot/../build" -Name $IOS_SIMULATOR_OUTPUT_FOLDER -ItemType Directory -Force | Out-Null
Push-Location "$PSScriptRoot/../build/$IOS_SIMULATOR_OUTPUT_FOLDER" | Out-Null
try
{
cmake -G Xcode ../.. -DCMAKE_TOOLCHAIN_FILE="$PSScriptRoot/ios.toolchain.cmake" -DIOS_PLATFORM=SIMULATOR64 -DIOS_DEPLOYMENT_TARGET="9.0" | Write-Host
}
finally
{
Pop-Location | Out-Null
}
}
function Main()
{
if ($Clean)
{
CleanFiles
}
if (!$NoMacOS)
{
GenerateProjectMacOS
}
if (!$NoIOS)
{
GenerateProjectIOS
}
if (!$NoSimulator)
{
GenerateProjectIOSSimulator
}
}
Main