Add support for building for iOS (#1904)

* Add support for building for iOS

* Add iOS azure template

Co-authored-by: Thad House <thadhouse1@gmail.com>
This commit is contained in:
Thad House 2021-08-11 12:38:56 -07:00 коммит произвёл GitHub
Родитель 289a595e9c
Коммит 1b17a55c34
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 38 добавлений и 8 удалений

Просмотреть файл

@ -386,6 +386,13 @@ stages:
extraName: 'static'
extraBuildArgs: -Static -ExtraArtifactDir Static
- template: ./templates/build-config-user.yml
parameters:
image: macOS-10.15
platform: ios
arch: arm64
tls: openssl
- stage: merge_darwin
displayName: Merge Darwin (macOS)
dependsOn:

Просмотреть файл

@ -336,13 +336,13 @@ if(QUIC_TLS STREQUAL "openssl")
list(APPEND QUIC_COMMON_DEFINES QUIC_DISABLE_DEFERRED_CERT_TESTS)
endif()
if (CMAKE_GENERATOR_PLATFORM STREQUAL "")
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} SYSTEM_PROCESSOR)
else()
string(TOLOWER ${CMAKE_GENERATOR_PLATFORM} SYSTEM_PROCESSOR)
endif()
if(WIN32)
if (CMAKE_GENERATOR_PLATFORM STREQUAL "")
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} SYSTEM_PROCESSOR)
else()
string(TOLOWER ${CMAKE_GENERATOR_PLATFORM} SYSTEM_PROCESSOR)
endif()
# Generate the MsQuicEtw header file.
file(MAKE_DIRECTORY ${QUIC_BUILD_DIR}/inc)

Просмотреть файл

@ -108,7 +108,7 @@ param (
[string]$Arch = "",
[Parameter(Mandatory = $false)]
[ValidateSet("uwp", "windows", "linux", "macos", "android")] # For future expansion
[ValidateSet("uwp", "windows", "linux", "macos", "android", "ios")] # For future expansion
[string]$Platform = "",
[Parameter(Mandatory = $false)]
@ -219,6 +219,11 @@ if (!$IsWindows -And $Platform -eq "uwp") {
exit
}
if ($Platform -eq "ios" -and !$Static) {
$Static = $true
Write-Host "iOS can only be built as static"
}
# Root directory of the project.
$RootDir = Split-Path $PSScriptRoot -Parent
@ -295,6 +300,9 @@ function CMake-Generate {
} else {
$Arguments += " $Generator"
}
if ($Platform -eq "ios") {
$Arguments += " -DCMAKE_SYSTEM_NAME=iOS"
}
if($Static) {
$Arguments += " -DQUIC_BUILD_SHARED=off"
}

Просмотреть файл

@ -30,7 +30,7 @@ param (
[string]$Arch = "",
[Parameter(Mandatory = $false)]
[ValidateSet("uwp", "windows", "linux", "macos", "android", "")] # For future expansion
[ValidateSet("uwp", "windows", "linux", "macos", "android", "ios", "")] # For future expansion
[string]$Platform = "",
[Parameter(Mandatory = $false)]
@ -53,6 +53,15 @@ if ($Platform -eq "android") {
}
}
if ($Platform -eq "ios") {
if (!$IsMacOS) {
Write-Error "Can only build ios on macOS"
}
if ($Arch -eq "") {
$Arch = "arm64"
}
}
if ("" -eq $Arch) {
if ($IsMacOS) {
$RunningArch = uname -m

Просмотреть файл

@ -26,6 +26,9 @@ Abstract:
#ifdef _WIN32
#pragma warning(pop)
#endif
#ifdef __APPLE__
#include <TargetConditionals.h>
#endif
#ifdef QUIC_CLOG
#include "selfsign_openssl.c.clog.h"
#endif
@ -476,6 +479,9 @@ CxPlatFreeSelfSignedCert(
#ifdef _WIN32
DeleteFileA(Params->CertFilepath);
DeleteFileA(Params->PrivateKeyFilepath);
#elif TARGET_OS_IOS
UNREFERENCED_PARAMETER(CredConfig);
UNREFERENCED_PARAMETER(Params);
#else
char RmCmd[32] = {0};
strncpy(RmCmd, "rm -rf ", 7 + 1);