glTF-SDK/macbuild.ps1

131 строка
2.2 KiB
PowerShell

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
<#
.SYNOPSIS
Build the macOS projects from the command line.
.DESCRIPTION
Builds the xcode projects generated by macinit.ps1
.PARAMETER NoNuGet
Disable build of NuGet packages
.EXAMPLE
macbuild.ps1
#>
[CmdletBinding()]
param(
[switch]$NoNuGet,
[switch]$NoMacOS,
[switch]$NoIOS,
[switch]$NoSimulator,
[switch]$NoDebug,
[switch]$NoRelease
)
$ErrorActionPreference = "stop"
function BuildMacOS()
{
Write-Host "Build macOS"
Push-Location "$PSScriptRoot/Built/Int/cmake_macos"
try
{
if (!$NoDebug)
{
cmake --build . --target install --config Debug
}
if (!$NoRelease)
{
cmake --build . --target install --config Release
}
}
finally
{
Pop-Location
}
}
function BuildIOS()
{
Write-Host "Build iOS"
Push-Location "$PSScriptRoot/Built/Int/cmake_ios"
try
{
if (!$NoDebug)
{
cmake --build . --target install --config Debug
}
if (!$NoRelease)
{
cmake --build . --target install --config Release
}
}
finally
{
Pop-Location
}
}
function BuildIOSSimulator()
{
Write-Host "Build iOS Simulator"
Push-Location "$PSScriptRoot/Built/Int/cmake_ios_simulator"
try
{
if (!$NoDebug)
{
cmake --build . --target install --config Debug
}
if (!$NoRelease)
{
cmake --build . --target install --config Release
}
}
finally
{
Pop-Location
}
}
function BuildMacOSNuGet()
{
nuget pack $PSScriptRoot/GLTFSDK/GLTFSDK.macOS.CPP.nuspec -OutputDirectory $PSScriptRoot/Built/Out/NuGet
}
function BuildIOSNuGet()
{
nuget pack $PSScriptRoot/GLTFSDK/GLTFSDK.iOS.CPP.nuspec -OutputDirectory $PSScriptRoot/Built/Out/NuGet
}
function Main()
{
if (!$NoMacOS)
{
BuildMacOS
}
if (!$NoIOS)
{
BuildIOS
}
if (!$NoSimulator)
{
BuildIOSSimulator
}
if (!$NoNuGet)
{
BuildMacOSNuGet
BuildIOSNuGet
}
}
Main