diff --git a/.azure/azure-pipelines.ci.yml b/.azure/azure-pipelines.ci.yml index 6fabac908..057b89f64 100644 --- a/.azure/azure-pipelines.ci.yml +++ b/.azure/azure-pipelines.ci.yml @@ -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: diff --git a/CMakeLists.txt b/CMakeLists.txt index 33d020c21..bea869761 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 9e2d8c062..51b0bf005 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -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" } diff --git a/scripts/get-buildconfig.ps1 b/scripts/get-buildconfig.ps1 index 74999ae2b..c746de760 100644 --- a/scripts/get-buildconfig.ps1 +++ b/scripts/get-buildconfig.ps1 @@ -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 diff --git a/src/platform/selfsign_openssl.c b/src/platform/selfsign_openssl.c index ddb31b62d..6d95cce54 100644 --- a/src/platform/selfsign_openssl.c +++ b/src/platform/selfsign_openssl.c @@ -26,6 +26,9 @@ Abstract: #ifdef _WIN32 #pragma warning(pop) #endif +#ifdef __APPLE__ +#include +#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);