Skip to content

Commit

Permalink
version 1.84.0
Browse files Browse the repository at this point in the history
  • Loading branch information
apotocki committed Feb 2, 2024
1 parent 3e100f5 commit 270dcbe
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- name: Build
run: |
export ICU4C_RELEASE_LINK=https://github.com/apotocki/icu4c-iosx/releases/download/74.2.6
export ICU4C_RELEASE_LINK=https://github.com/apotocki/icu4c-iosx/releases/download/74.2.8
scripts/build.sh
for i in frameworks/*.xcframework/; do cd frameworks && zip -9 -r "$(basename -- $i).zip" $(basename -- $i) & done; wait
cd frameworks
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Boost C++ for iOS and Mac OS X (Intel & Apple Silicon M1) & Catalyst - arm64 / x86_64
# Boost C++ for iOS, visionOS, macOS (Intel & Apple Silicon M1) & Catalyst - arm64 / x86_64

Supported version: 1.84.0 (use the appropriate tag to select the version)

Expand All @@ -16,10 +16,11 @@ graph_parallel, mpi, python
2) ```xcode-select -p``` must point to Xcode app developer directory (by default e.g. /Applications/Xcode.app/Contents/Developer). If it points to CommandLineTools directory you should execute:
```sudo xcode-select --reset``` or ```sudo xcode-select -s /Applications/Xcode.app/Contents/Developer```
3) You should not have your own user-config.jam file in your home directory!
4) For the creation of visionOS related artifacts and their integration into the resulting xcframeworks, XROS.platform and XRSimulator.platform should be available in the folder: /Applications/Xcode.app/Contents/Developer/Platforms

## Building notes
1) Libraries 'locale' and 'regex' are being built with ICU backend. ICU build scripts are being taken from https://github.com/apotocki/icu4c-iosx and run with the help of 'pod' utility.
2) 'test' library is building for iOS with BOOST_TEST_NO_MAIN flag.
1) The 'locale' and 'regex' libraries are built using the ICU backend. ICU build scripts are taken from https://github.com/apotocki/icu4c-iosx and run using the 'pod' utility.
2) The 'test' library is built for iOS with the BOOST_TEST_NO_MAIN flag.

## How to build?
- Manually
Expand All @@ -39,13 +40,13 @@ graph_parallel, mpi, python
use_frameworks!
pod 'boost-iosx', '~> 1.84.0'
# or optionally more precisely e.g.:
# pod 'boost-iosx', :git => 'https://github.com/apotocki/boost-iosx', :tag => '1.84.0.4'
# pod 'boost-iosx', :git => 'https://github.com/apotocki/boost-iosx', :tag => '1.84.0.5'
```
If you want to use particular boost libraries, specify them as in the following example for log and program_options libraries:
```
pod 'boost-iosx/log', '~> 1.84.0'
pod 'boost-iosx/program_options', '~> 1.84.0'
# note: Some libraries have dependencies on other Boost libraries. In that case, you should explicitly add all their dependencies to your Podfile.
# note: Some libraries depend on other Boost libraries. In this case, you should explicitly add all their dependencies to your Podfile.
```
Then install new dependencies:
```
Expand Down
6 changes: 4 additions & 2 deletions boost-iosx.podspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
Pod::Spec.new do |s|
s.name = "boost-iosx"
s.version = "1.84.0.4"
s.summary = "Boost C++ libraries"
s.version = "1.84.0.5"
s.summary = "Boost C++ libraries for macOS, iOS, and visionOS, including both arm64 and x86_64 builds for macOS, Mac Catalyst, iOS Simulator, and visionOS Simulator."
s.homepage = "https://github.com/apotocki/boost-iosx"
s.license = "Boost Software License"
s.author = { "Alexander Pototskiy" => "alex.a.potocki@gmail.com" }
s.social_media_url = "https://www.linkedin.com/in/alexander-pototskiy"
s.osx.deployment_target = "11.0"
s.ios.deployment_target = "13.4"
s.visionos.deployment_target = "1.0"
s.osx.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' }
s.ios.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' }
s.visionos.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' }
s.static_framework = true
s.prepare_command = "sh scripts/build.sh"
s.source = { :git => "https://github.com/apotocki/boost-iosx.git", :tag => "#{s.version}" }
Expand Down
79 changes: 70 additions & 9 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ IOS_VERSION=13.4
IOS_SIM_VERSION=13.4
CATALYST_VERSION=13.4
################## SETUP END
DEVSYSROOT=$XCODE_ROOT/Platforms/iPhoneOS.platform/Developer
SIMSYSROOT=$XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer
IOSSYSROOT=$XCODE_ROOT/Platforms/iPhoneOS.platform/Developer
IOSSIMSYSROOT=$XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer
MACSYSROOT=$XCODE_ROOT/Platforms/MacOSX.platform/Developer
XROSSYSROOT=$XCODE_ROOT/Platforms/XROS.platform/Developer
XROSSIMSYSROOT=$XCODE_ROOT/Platforms/XRSimulator.platform/Developer

BOOST_NAME=boost_${BOOST_VER//./_}
BUILD_DIR="$( cd "$( dirname "./" )" >/dev/null 2>&1 && pwd )"
Expand Down Expand Up @@ -47,7 +49,7 @@ fi

############### ICU
if true; then
#export ICU4C_RELEASE_LINK=https://github.com/apotocki/icu4c-iosx/releases/download/74.2.6
#export ICU4C_RELEASE_LINK=https://github.com/apotocki/icu4c-iosx/releases/download/74.2.8
if [[ ! -d $SCRIPT_DIR/Pods/icu4c-iosx/product ]]; then
if [[ ! -z "${ICU4C_RELEASE_LINK}" ]]; then
if [[ -d $SCRIPT_DIR/Pods/icu4c-iosx ]]; then
Expand Down Expand Up @@ -198,8 +200,8 @@ if [[ -f tools/build/src/user-config.jam ]]; then
rm -f tools/build/src/user-config.jam
fi
cat >> tools/build/src/user-config.jam <<EOF
using darwin : ios : clang++ -arch arm64 -fembed-bitcode -isysroot $DEVSYSROOT/SDKs/iPhoneOS.sdk -mios-version-min=$IOS_VERSION
: <striper> <root>$DEVSYSROOT
using darwin : ios : clang++ -arch arm64 -fembed-bitcode -isysroot $IOSSYSROOT/SDKs/iPhoneOS.sdk -mios-version-min=$IOS_VERSION
: <striper> <root>$IOSSYSROOT
: <architecture>arm <target-os>iphone
;
EOF
Expand All @@ -212,15 +214,34 @@ fi
rm -rf bin.v2
}

build_xros_libs()
{
if [[ -f tools/build/src/user-config.jam ]]; then
rm -f tools/build/src/user-config.jam
fi
cat >> tools/build/src/user-config.jam <<EOF
using darwin : xros : clang++ -arch arm64 -fembed-bitcode -isysroot $XROSSYSROOT/SDKs/XROS.sdk
: <striper> <root>$XROSSYSROOT
: <architecture>arm <target-os>iphone
;
EOF
if [[ ! -z "${ICU_PATH}" ]]; then
cp $ICU_PATH/frameworks/icudata.xcframework/xros-arm64/libicudata.a $ICU_PATH/lib/
cp $ICU_PATH/frameworks/icui18n.xcframework/xros-arm64/libicui18n.a $ICU_PATH/lib/
cp $ICU_PATH/frameworks/icuuc.xcframework/xros-arm64/libicuuc.a $ICU_PATH/lib/
fi
./b2 --stagedir=stage/xros toolset=darwin-xros instruction-set=arm64 architecture=arm binary-format=mach-o abi=aapcs target-os=iphone define=_LITTLE_ENDIAN define=BOOST_TEST_NO_MAIN $B2_BUILD_OPTIONS $LIBS_TO_BUILD
rm -rf bin.v2
}

build_sim_libs()
{
if [[ -f tools/build/src/user-config.jam ]]; then
rm -f tools/build/src/user-config.jam
fi
cat >> tools/build/src/user-config.jam <<EOF
using darwin : iossim : clang++ -arch $1 -fembed-bitcode-marker -isysroot $SIMSYSROOT/SDKs/iPhoneSimulator.sdk $2
: <striper> <root>$SIMSYSROOT
using darwin : iossim : clang++ -arch $1 -fembed-bitcode-marker -isysroot $IOSSIMSYSROOT/SDKs/iPhoneSimulator.sdk $2
: <striper> <root>$IOSSIMSYSROOT
: <architecture>$(boost_arc $1) <target-os>iphone
;
EOF
Expand All @@ -233,6 +254,26 @@ fi
rm -rf bin.v2
}

build_xrossim_libs()
{
if [[ -f tools/build/src/user-config.jam ]]; then
rm -f tools/build/src/user-config.jam
fi
cat >> tools/build/src/user-config.jam <<EOF
using darwin : xrossim : clang++ -arch $1 -fembed-bitcode-marker -isysroot $XROSSIMSYSROOT/SDKs/XRSimulator.sdk $2
: <striper> <root>$XROSSIMSYSROOT
: <architecture>$(boost_arc $1) <target-os>iphone
;
EOF
if [[ ! -z "${ICU_PATH}" ]]; then
cp $ICU_PATH/frameworks/icudata.xcframework/xros-*-simulator/libicudata.a $ICU_PATH/lib/
cp $ICU_PATH/frameworks/icui18n.xcframework/xros-*-simulator/libicui18n.a $ICU_PATH/lib/
cp $ICU_PATH/frameworks/icuuc.xcframework/xros-*-simulator/libicuuc.a $ICU_PATH/lib/
fi
./b2 --stagedir=stage/xrossim-$1 toolset=darwin-xrossim architecture=$(boost_arc $1) abi=$(boost_abi $1) target-os=iphone define=BOOST_TEST_NO_MAIN $B2_BUILD_OPTIONS $LIBS_TO_BUILD
rm -rf bin.v2
}

if true; then
if [ -d stage/macosx/lib ]; then
rm -rf stage/macosx/lib
Expand Down Expand Up @@ -261,7 +302,19 @@ if true; then
mkdir -p stage/iossim/lib
fi

if [ -d $XROSSIMSYSROOT/SDKs/XRSimulator.sdk ]; then
if [[ -d stage/xrossim/lib ]]; then
rm -rf stage/xrossim/lib
fi
build_xrossim_libs arm64
build_xrossim_libs x86_64
mkdir -p stage/xrossim/lib
fi

build_ios_libs
if [ -d $XROSSYSROOT ]; then
build_xros_libs
fi

echo installing boost...
if [[ -d "$BUILD_DIR/frameworks" ]]; then
Expand All @@ -275,8 +328,16 @@ build_xcframework()
lipo -create stage/macosx-arm64/lib/lib$1.a stage/macosx-x86_64/lib/lib$1.a -output stage/macosx/lib/lib$1.a
lipo -create stage/catalyst-arm64/lib/lib$1.a stage/catalyst-x86_64/lib/lib$1.a -output stage/catalyst/lib/lib$1.a
lipo -create stage/iossim-arm64/lib/lib$1.a stage/iossim-x86_64/lib/lib$1.a -output stage/iossim/lib/lib$1.a

xcodebuild -create-xcframework -library stage/macosx/lib/lib$1.a -library stage/catalyst/lib/lib$1.a -library stage/ios/lib/lib$1.a -library stage/iossim/lib/lib$1.a -output "$BUILD_DIR/frameworks/$1.xcframework"
LIBARGS="-library stage/macosx/lib/lib$1.a -library stage/catalyst/lib/lib$1.a -library stage/ios/lib/lib$1.a -library stage/iossim/lib/lib$1.a"

if [ -d $XROSSIMSYSROOT/SDKs/XRSimulator.sdk ]; then
lipo -create stage/xrossim-arm64/lib/lib$1.a stage/xrossim-x86_64/lib/lib$1.a -output stage/xrossim/lib/lib$1.a
LIBARGS="$LIBARGS -library stage/xrossim/lib/lib$1.a"
fi
if [ -d $XROSSYSROOT/SDKs/XROS.sdk ]; then
LIBARGS="$LIBARGS -library stage/xros/lib/lib$1.a"
fi
xcodebuild -create-xcframework $LIBARGS -output "$BUILD_DIR/frameworks/$1.xcframework"
}

if true; then
Expand Down

0 comments on commit 270dcbe

Please sign in to comment.