Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/workflows/ci-mobile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#
# GitHub Actions workflow for building cpprestsdk on iOS and Android
#
# Note: Please do not include any non-mobile targets in this workflow because
# we don't want a failure in one of several dozens Linux distributions
# hide a problem in the only 2 targets our mobile developers care about!
#
name: Mobile

on: [push]

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest,macos-latest]
flavor: [Release] # Only use one of Debug/Release (capitalized) for now to save on minutes
fail-fast: false

runs-on: ${{ matrix.os }}

steps:
- name: Checkout Sources
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Update Submodules
run: git submodule update --init
- name: Build (iOS)
timeout-minutes: 30
run: |
set -x
mkdir -p bins/ios/cpprestsdk
pushd Build_iOS
BOOST_VERSION="1.71.0" OPENSSL_VERSION="1.1.1d" ./configure.sh -build_type ${{ matrix.flavor }}
ls -alFR .
if [ -f build.${{ matrix.flavor }}.ios/lib/libcpprest.a ]; then mv build.${{ matrix.flavor }}.ios/lib ${GITHUB_WORKSPACE}/bins/ios/cpprestsdk/; mv build.${{ matrix.flavor }}.ios/include ${GITHUB_WORKSPACE}/bins/ios/cpprestsdk/; fi
if [ -d openssl ]; then mv openssl ${GITHUB_WORKSPACE}/bins/ios/; fi
if [ -d boost.xcframework ]; then mv boost.xcframework ${GITHUB_WORKSPACE}/bins/ios/; fi
if: matrix.os == 'macos-latest'
- name: Build (Android)
timeout-minutes: 25
run: |
set -x
export NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle
echo "::set-env name=NDK_ROOT::$NDK_ROOT"
mkdir -p bins/android/cpprestsdk
pushd Build_android
mkdir build
pushd build
../configure.sh --boost 1.69.0 --openssl 1.1.0j --ndk ${NDK_ROOT}
ls -alFR .
mv ${GITHUB_WORKSPACE}/Release/include ${GITHUB_WORKSPACE}/bins/android/cpprestsdk/ || true
if [ -f build.armv7.debug/Release/Binaries/libcpprest.a ]; then mkdir -p ${GITHUB_WORKSPACE}/bins/android/cpprestsdk/libs/armeabi-v7a/Debug; mv build.armv7.debug/Release/Binaries/libcpprest.a ${GITHUB_WORKSPACE}/bins/android/cpprestsdk/libs/armeabi-v7a/Debug/; fi
if [ -f build.armv7.release/Release/Binaries/libcpprest.a ]; then mkdir -p ${GITHUB_WORKSPACE}/bins/android/cpprestsdk/libs/armeabi-v7a/Release; mv build.armv7.release/Release/Binaries/libcpprest.a ${GITHUB_WORKSPACE}/bins/android/cpprestsdk/libs/armeabi-v7a/Release/; fi
if [ -f build.x86.debug/Release/Binaries/libcpprest.a ]; then mkdir -p ${GITHUB_WORKSPACE}/bins/android/cpprestsdk/libs/x86/Debug; mv build.x86.debug/Release/Binaries/libcpprest.a ${GITHUB_WORKSPACE}/bins/android/cpprestsdk/libs/x86/Debug/; fi
if [ -f build.x86.release/Release/Binaries/libcpprest.a ]; then mkdir -p ${GITHUB_WORKSPACE}/bins/android/cpprestsdk/libs/x86/Release; mv build.x86.release/Release/Binaries/libcpprest.a ${GITHUB_WORKSPACE}/bins/android/cpprestsdk/libs/x86/Release/; fi
if [ -d openssl ]; then mv openssl ${GITHUB_WORKSPACE}/bins/android/; fi
if [ -d Boost-for-Android/build/out ]; then mv Boost-for-Android/build/out ${GITHUB_WORKSPACE}/bins/android/boost; fi
if: matrix.os == 'ubuntu-latest'
- name: Prepare Binaries
timeout-minutes: 5
run: |
# It is about 30 times faster to zip artifacts first instead of letting
# upload artifact action send about 44K boost headers over the network.
# The artifact with binaries from both platforms takes about 345M, which
# is why we only create and upload them for tagged commits.
set -x
mkdir binaries
mkdir binaries/ios
mkdir binaries/android
if [ -d bins/android/cpprestsdk ]; then (cd bins/android && zip -r ${GITHUB_WORKSPACE}/binaries/android/cpprestsdk.zip cpprestsdk); fi
if [ -d bins/android/openssl ]; then (cd bins/android && zip -r ${GITHUB_WORKSPACE}/binaries/android/openssl.zip openssl); fi
if [ -d bins/android/boost ]; then (cd bins/android && zip -r ${GITHUB_WORKSPACE}/binaries/android/boost.zip boost); fi
if [ -d bins/ios/cpprestsdk ]; then (cd bins/ios && zip -r ${GITHUB_WORKSPACE}/binaries/ios/cpprestsdk.zip cpprestsdk); fi
if [ -d bins/ios/openssl ]; then (cd bins/ios && zip -r ${GITHUB_WORKSPACE}/binaries/ios/openssl.zip openssl); fi
if [ -d bins/ios/boost.xcframework ]; then (cd bins/ios && zip -r ${GITHUB_WORKSPACE}/binaries/ios/boost.xcframework.zip boost.xcframework); fi
ls -alFR binaries
if: contains(github.ref, 'tags')
- name: Upload Binaries
timeout-minutes: 2
uses: actions/upload-artifact@v2
with:
name: binaries
path: ./binaries
if: contains(github.ref, 'tags')
5 changes: 2 additions & 3 deletions Build_android/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,11 @@ if [ "${DO_OPENSSL}" == "1" ]; then (
# -----
# Uses the build script from Moritz Wundke (formerly MysticTreeGames)
# https://github.com/moritz-wundke/Boost-for-Android
# (plus the patch https://github.com/o01eg/Boost-for-Android/tree/ndk-bump-21)

if [ "${DO_BOOST}" == "1" ]; then (
if [ ! -d 'Boost-for-Android' ]; then git clone https://github.com/o01eg/Boost-for-Android/; fi
if [ ! -d 'Boost-for-Android' ]; then git clone https://github.com/moritz-wundke/Boost-for-Android; fi
cd Boost-for-Android
git checkout 7626dd6f7cab7866dce20e685d4a1b11194366a7
git checkout c439278a9e7b33b8a176c172bb573c2f665d9179
PATH="$PATH:$NDK_DIR" \
CXXFLAGS="-std=gnu++11" \
./build-android.sh \
Expand Down
2 changes: 1 addition & 1 deletion Build_iOS/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# iOS folders that dependencies get stored in
boostoniphone/
boost
boost.framework/
boost.xcframework/
ios-cmake/
openssl/
OpenSSL-for-iPhone/
9 changes: 3 additions & 6 deletions Build_iOS/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,15 @@ git submodule update --init

## Build Boost

if [ ! -e $ABS_PATH/boost.framework ] && [ ! -d $ABS_PATH/boost ]; then
if [ ! -e $ABS_PATH/boost.xcframework ] && [ ! -d $ABS_PATH/boost ]; then
if [ ! -d "${ABS_PATH}/Apple-Boost-BuildScript" ]; then
git clone https://github.com/faithfracture/Apple-Boost-BuildScript ${ABS_PATH}/Apple-Boost-BuildScript
fi
pushd ${ABS_PATH}/Apple-Boost-BuildScript
git checkout 8c42427b4ebc7865eb99b0a0b9607888af2c6abc
git checkout 27ca8978bf3ee029f699356a7d044a5a1fc0cd84
BOOST_LIBS="thread chrono filesystem regex system random" ./boost.sh -ios -tvos --boost-version $BOOST_VERSION
popd
mv ${ABS_PATH}/Apple-Boost-BuildScript/build/boost/${BOOST_VERSION}/ios/framework/boost.framework ${ABS_PATH}
mv ${ABS_PATH}/boost.framework/Versions/A/Headers ${ABS_PATH}/boost.headers
mkdir -p ${ABS_PATH}/boost.framework/Versions/A/Headers
mv ${ABS_PATH}/boost.headers ${ABS_PATH}/boost.framework/Versions/A/Headers/boost
mv ${ABS_PATH}/Apple-Boost-BuildScript/dist/boost.xcframework ${ABS_PATH}
fi

## Build OpenSSL
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ The C++ REST SDK is a Microsoft project for cloud-based client-server communicat
[![openSUSE Tumbleweed package](https://repology.org/badge/version-for-repo/opensuse_tumbleweed/cpprestsdk.svg)](https://repology.org/metapackage/cpprestsdk)</br>
[![Debian Testing package](https://repology.org/badge/version-for-repo/debian_testing/cpprestsdk.svg)](https://repology.org/metapackage/cpprestsdk)</br>

[![Build Status](https://dev.azure.com/vclibs/cpprestsdk/_apis/build/status/Microsoft.cpprestsdk.Ubuntu)](https://dev.azure.com/vclibs/cpprestsdk/_build/latest?definitionId=1)
[![Build Status](https://dev.azure.com/vclibs/cpprestsdk/_apis/build/status/Microsoft.cpprestsdk.Ubuntu)](https://dev.azure.com/vclibs/cpprestsdk/_build/latest?definitionId=1)</br>
[![Build Status: Mobile](https://github.com/microsoft/cpprestsdk/workflows/Mobile/badge.svg)](https://github.com/microsoft/cpprestsdk/actions)

With [vcpkg](https://github.com/Microsoft/vcpkg) on Windows
```
Expand Down
16 changes: 14 additions & 2 deletions Release/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,21 @@ set(CPPREST_VERSION_REVISION 16)

enable_testing()

set(WERROR ON CACHE BOOL "Treat Warnings as Errors.")
if(IOS)
# We disable warnings as errors on iOS because of command-line warning:
# clang: warning: overriding '-mios-simulator-version-min=8.0' option with '--target=arm64-apple-ios13.5' [-Woverriding-t-option]
# which for some reason can't be disabled from cmake the usual way.
set(WERROR OFF CACHE BOOL "Treat Warnings as Errors.")
# We exclude compression on iOS for now because of the problem I described
# in greater details in this StackOverflow post:
# https://stackoverflow.com/questions/58628377/catalina-c-using-cmath-headers-yield-error-no-member-named-signbit-in-th/59780819#59780819
set(CPPREST_EXCLUDE_COMPRESSION ON CACHE BOOL "Exclude compression functionality.")
else()
set(WERROR ON CACHE BOOL "Treat Warnings as Errors.")
set(CPPREST_EXCLUDE_COMPRESSION OFF CACHE BOOL "Exclude compression functionality.")
endif()

set(CPPREST_EXCLUDE_WEBSOCKETS OFF CACHE BOOL "Exclude websockets functionality.")
set(CPPREST_EXCLUDE_COMPRESSION OFF CACHE BOOL "Exclude compression functionality.")
set(CPPREST_EXCLUDE_BROTLI ON CACHE BOOL "Exclude Brotli compression functionality.")
set(CPPREST_EXPORT_DIR cmake/cpprestsdk CACHE STRING "Directory to install CMake config files.")
set(CPPREST_INSTALL_HEADERS ON CACHE BOOL "Install header files.")
Expand Down
4 changes: 2 additions & 2 deletions Release/cmake/cpprest_find_boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ function(cpprest_find_boost)
set(Boost_INCLUDE_DIR "${IOS_SOURCE_DIR}/boost/include" CACHE INTERNAL "")
else()
set(IOS_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../Build_iOS")
set(Boost_LIBRARIES "${IOS_SOURCE_DIR}/boost.framework/boost" CACHE INTERNAL "")
set(Boost_INCLUDE_DIR "${IOS_SOURCE_DIR}/boost.framework/Headers" CACHE INTERNAL "")
set(Boost_LIBRARIES "${IOS_SOURCE_DIR}/boost.xcframework/boost" CACHE INTERNAL "")
set(Boost_INCLUDE_DIR "${IOS_SOURCE_DIR}/boost.xcframework/Headers" CACHE INTERNAL "")
endif()
elseif(ANDROID)
set(Boost_COMPILER "-clang")
Expand Down