Skip to content

Commit 5b35426

Browse files
committed
moved to 1.81
1 parent c16efc8 commit 5b35426

File tree

3 files changed

+93
-60
lines changed

3 files changed

+93
-60
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Boost C++ for iOS and Mac OS X (Intel & Apple Silicon M1) & Catalyst - arm64 / x86_64
22

3-
Supported version: 1.80.0 (use the appropriate tag to select the version)
3+
Supported version: 1.81.0 (use the appropriate tag to select the version)
44

55
This repo provides a universal script for building static Boost C++ libraries for use in iOS and Mac OS X & Catalyst applications.
6-
The latest supported Boost version is taken from: https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.tar.bz2
6+
The latest supported Boost version is taken from: https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.bz2
77

88
## Building libraries
9-
atomic, chrono, container, context, contract, coroutine, date_time, exception, fiber, filesystem, graph, iostreams, json, locale, log, math, nowide, program_options, random, regex, serialization, stacktrace, system, test, thread, timer, type_erasure, wave
9+
atomic, chrono, container, context, contract, coroutine, date_time, exception, fiber, filesystem, graph, iostreams, json, locale, log, math, nowide, program_options, random, regex, serialization, stacktrace, system, test, thread, timer, type_erasure, url, wave
1010

1111
## Not building libraries
1212
graph_parallel, mpi, python
@@ -25,7 +25,7 @@ graph_parallel, mpi, python
2525
- Manually
2626
```
2727
# clone the repo
28-
git clone -b 1.80.0 https://github.com/apotocki/boost-iosx
28+
git clone -b 1.81.0 https://github.com/apotocki/boost-iosx
2929
3030
# build libraries
3131
cd boost-iosx
@@ -37,14 +37,14 @@ graph_parallel, mpi, python
3737
- Use cocoapods. Add the following lines into your project's Podfile:
3838
```
3939
use_frameworks!
40-
pod 'boost-iosx', '~> 1.80.0'
40+
pod 'boost-iosx', '~> 1.81.0'
4141
# or optionally more precisely e.g.:
42-
# pod 'boost-iosx', :git => 'https://github.com/apotocki/boost-iosx', :tag => '1.80.0.2'
42+
# pod 'boost-iosx', :git => 'https://github.com/apotocki/boost-iosx', :tag => '1.81.0.1'
4343
```
4444
If you want to use particular boost libraries, specify them as in the following example for log and program_options libraries:
4545
```
46-
pod 'boost-iosx/log', '~> 1.80.0'
47-
pod 'boost-iosx/program_options', '~> 1.80.0'
46+
pod 'boost-iosx/log', '~> 1.81.0'
47+
pod 'boost-iosx/program_options', '~> 1.81.0'
4848
# note: Some libraries have dependencies on other Boost libraries. In that case, you should explicitly add all their dependencies to your Podfile.
4949
```
5050
Then install new dependencies:

boost-iosx.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "boost-iosx"
3-
s.version = "1.80.0.2"
3+
s.version = "1.81.0.1"
44
s.summary = "Boost C++ libraries"
55
s.homepage = "https://github.com/apotocki/boost-iosx"
66
s.license = "Boost Software License"

scripts/build.sh

Lines changed: 84 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
set -e
33
################## SETUP BEGIN
44
THREAD_COUNT=$(sysctl hw.ncpu | awk '{print $2}')
5-
HOST_ARC=$( uname -m )
65
XCODE_ROOT=$( xcode-select -print-path )
7-
BOOST_VER=1.80.0
6+
BOOST_VER=1.81.0
87
################## SETUP END
98
DEVSYSROOT=$XCODE_ROOT/Platforms/iPhoneOS.platform/Developer
109
SIMSYSROOT=$XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer
@@ -14,34 +13,28 @@ BOOST_NAME=boost_${BOOST_VER//./_}
1413
BUILD_DIR="$( cd "$( dirname "./" )" >/dev/null 2>&1 && pwd )"
1514
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
1615

17-
if [ ! -f "$BUILD_DIR/frameworks.built" ]; then
16+
if [[ ! -f "$BUILD_DIR/frameworks.built" ]]; then
1817

19-
if [[ $HOST_ARC == arm* ]]; then
20-
BOOST_ARC=arm
21-
elif [[ $HOST_ARC == x86* ]]; then
22-
BOOST_ARC=x86
23-
else
24-
BOOST_ARC=unknown
25-
fi
26-
27-
28-
if [ ! -f $BOOST_NAME.tar.bz2 ]; then
18+
if [[ ! -f $BOOST_NAME.tar.bz2 ]]; then
2919
curl -L https://boostorg.jfrog.io/artifactory/main/release/$BOOST_VER/source/$BOOST_NAME.tar.bz2 -o $BOOST_NAME.tar.bz2
20+
if [[ -d boost ]]; then
21+
rm -rf boost
22+
fi
3023
fi
31-
if [ ! -d boost ]; then
24+
if [[ ! -d boost ]]; then
3225
echo "extracting $BOOST_NAME.tar.bz2 ..."
3326
tar -xf $BOOST_NAME.tar.bz2
3427
mv $BOOST_NAME boost
3528
fi
3629

37-
if [ ! -f boost/b2 ]; then
30+
if [[ ! -f boost/b2 ]]; then
3831
pushd boost
3932
./bootstrap.sh
4033
popd
4134
fi
4235

4336
############### ICU
44-
if [ ! -d $SCRIPT_DIR/Pods/icu4c-iosx/product ]; then
37+
if [[ ! -d $SCRIPT_DIR/Pods/icu4c-iosx/product ]]; then
4538
pushd $SCRIPT_DIR
4639
pod repo update
4740
pod install --verbose
@@ -69,70 +62,88 @@ echo patching boost...
6962
#fi
7063
#patch -p0 <$SCRIPT_DIR/0001-json-array-erase-relocate.patch
7164

72-
if [ ! -f tools/build/src/tools/features/instruction-set-feature.jam.orig ]; then
65+
if [[ ! -f tools/build/src/tools/features/instruction-set-feature.jam.orig ]]; then
7366
cp -f tools/build/src/tools/features/instruction-set-feature.jam tools/build/src/tools/features/instruction-set-feature.jam.orig
7467
else
7568
cp -f tools/build/src/tools/features/instruction-set-feature.jam.orig tools/build/src/tools/features/instruction-set-feature.jam
7669
fi
7770
patch tools/build/src/tools/features/instruction-set-feature.jam $SCRIPT_DIR/instruction-set-feature.jam.patch
7871

7972

80-
81-
#LIBS_TO_BUILD="--with-regex"
82-
LIBS_TO_BUILD="--with-atomic --with-chrono --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-fiber --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-wave"
73+
LIBS_TO_BUILD="--with-atomic --with-chrono --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-fiber --with-filesystem --with-graph --with-iostreams --with-json --with-locale --with-log --with-math --with-nowide --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-wave --with-url"
8374

8475
B2_BUILD_OPTIONS="-j$THREAD_COUNT -sICU_PATH=\"$ICU_PATH\" address-model=64 release link=static runtime-link=shared define=BOOST_SPIRIT_THREADSAFE cxxflags=\"-std=c++20\""
8576

8677

8778
if true; then
88-
if [ -d bin.v2 ]; then
79+
if [[ -d bin.v2 ]]; then
8980
rm -rf bin.v2
9081
fi
91-
if [ -d stage ]; then
82+
if [[ -d stage ]]; then
9283
rm -rf stage
9384
fi
9485
fi
9586

96-
if true; then
87+
function boost_arc()
88+
{
89+
if [[ $1 == arm* ]]; then
90+
echo "arm"
91+
elif [[ $1 == x86* ]]; then
92+
echo "x86"
93+
else
94+
echo "unknown"
95+
fi
96+
}
97+
98+
function boost_abi()
99+
{
100+
if [[ $1 == arm64 ]]; then
101+
echo "aapcs"
102+
elif [[ $1 == x86_64 ]]; then
103+
echo "sysv"
104+
else
105+
echo "unknown"
106+
fi
107+
}
108+
109+
build_macos_libs()
110+
{
97111
if [[ -f tools/build/src/user-config.jam ]]; then
98112
rm -f tools/build/src/user-config.jam
99113
fi
100-
cp $ICU_PATH/frameworks/icudata.xcframework/macos-*$HOST_ARC*/libicudata.a $ICU_PATH/lib/
101-
cp $ICU_PATH/frameworks/icui18n.xcframework/macos-*$HOST_ARC*/libicui18n.a $ICU_PATH/lib/
102-
cp $ICU_PATH/frameworks/icuuc.xcframework/macos-*$HOST_ARC*/libicuuc.a $ICU_PATH/lib/
103-
./b2 -j8 --stagedir=stage/macosx toolset=darwin architecture=$BOOST_ARC $B2_BUILD_OPTIONS $LIBS_TO_BUILD
114+
cat >> tools/build/src/user-config.jam <<EOF
115+
using darwin : : clang++ -arch $1 -isysroot $MACSYSROOT/SDKs/MacOSX.sdk
116+
: <striper> <root>$MACSYSROOT
117+
: <architecture>$(boost_arc $1)
118+
;
119+
EOF
120+
cp $ICU_PATH/frameworks/icudata.xcframework/macos-*/libicudata.a $ICU_PATH/lib/
121+
cp $ICU_PATH/frameworks/icui18n.xcframework/macos-*/libicui18n.a $ICU_PATH/lib/
122+
cp $ICU_PATH/frameworks/icuuc.xcframework/macos-*/libicuuc.a $ICU_PATH/lib/
123+
./b2 -j8 --stagedir=stage/macosx-$1 toolset=darwin architecture=$(boost_arc $1) abi=$(boost_abi $1) $B2_BUILD_OPTIONS $LIBS_TO_BUILD
104124
rm -rf bin.v2
105-
fi
125+
}
106126

107-
# <binary-format>mach-o <threading>multi <abi>sysv
108127
build_catalyst_libs()
109128
{
110129
if [[ -f tools/build/src/user-config.jam ]]; then
111130
rm -f tools/build/src/user-config.jam
112131
fi
113132
cat >> tools/build/src/user-config.jam <<EOF
114-
using darwin : catalyst : clang++ -arch $1 --target=$2-apple-ios13.4-macabi -isysroot $MACSYSROOT/SDKs/MacOSX.sdk -I$MACSYSROOT/SDKs/MacOSX.sdk/System/iOSSupport/usr/include/ -isystem $MACSYSROOT/SDKs/MacOSX.sdk/System/iOSSupport/usr/include -iframework $MACSYSROOT/SDKs/MacOSX.sdk/System/iOSSupport/System/Library/Frameworks
133+
using darwin : catalyst : clang++ -arch $1 --target=$2 -isysroot $MACSYSROOT/SDKs/MacOSX.sdk -I$MACSYSROOT/SDKs/MacOSX.sdk/System/iOSSupport/usr/include/ -isystem $MACSYSROOT/SDKs/MacOSX.sdk/System/iOSSupport/usr/include -iframework $MACSYSROOT/SDKs/MacOSX.sdk/System/iOSSupport/System/Library/Frameworks
115134
: <striper> <root>$MACSYSROOT
116-
: <architecture>$3
135+
: <architecture>$(boost_arc $1)
117136
;
118137
EOF
119138
cp $ICU_PATH/frameworks/icudata.xcframework/ios-*-maccatalyst/libicudata.a $ICU_PATH/lib/
120139
cp $ICU_PATH/frameworks/icui18n.xcframework/ios-*-maccatalyst/libicui18n.a $ICU_PATH/lib/
121140
cp $ICU_PATH/frameworks/icuuc.xcframework/ios-*-maccatalyst/libicuuc.a $ICU_PATH/lib/
122-
./b2 --stagedir=stage/catalyst-$1 abi=$4 toolset=darwin-catalyst architecture=$3 $B2_BUILD_OPTIONS $LIBS_TO_BUILD
141+
./b2 --stagedir=stage/catalyst-$1 toolset=darwin-catalyst architecture=$(boost_arc $1) abi=$(boost_abi $1) $B2_BUILD_OPTIONS $LIBS_TO_BUILD
123142
rm -rf bin.v2
124143
}
125144

126-
if true; then
127-
if [ -d stage/catalyst/lib ]; then
128-
rm -rf stage/catalyst/lib
129-
fi
130-
mkdir -p stage/catalyst/lib
131-
build_catalyst_libs arm64 arm arm aapcs
132-
build_catalyst_libs x86_64 x86_64 x86 sysv
133-
fi
134-
135-
if true; then
145+
build_ios_libs()
146+
{
136147
if [[ -f tools/build/src/user-config.jam ]]; then
137148
rm -f tools/build/src/user-config.jam
138149
fi
@@ -147,7 +158,8 @@ cp $ICU_PATH/frameworks/icui18n.xcframework/ios-arm64/libicui18n.a $ICU_PATH/lib
147158
cp $ICU_PATH/frameworks/icuuc.xcframework/ios-arm64/libicuuc.a $ICU_PATH/lib/
148159
./b2 --stagedir=stage/ios toolset=darwin-ios 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
149160
rm -rf bin.v2
150-
fi
161+
}
162+
151163

152164
build_sim_libs()
153165
{
@@ -157,36 +169,56 @@ fi
157169
cat >> tools/build/src/user-config.jam <<EOF
158170
using darwin : iossim : clang++ -arch $1 -fembed-bitcode-marker -isysroot $SIMSYSROOT/SDKs/iPhoneSimulator.sdk -mios-simulator-version-min=13.4
159171
: <striper> <root>$SIMSYSROOT
160-
: <architecture>$2 <target-os>iphone
172+
: <architecture>$(boost_arc $1) <target-os>iphone
161173
;
162174
EOF
163175
cp $ICU_PATH/frameworks/icudata.xcframework/ios-*-simulator/libicudata.a $ICU_PATH/lib/
164176
cp $ICU_PATH/frameworks/icui18n.xcframework/ios-*-simulator/libicui18n.a $ICU_PATH/lib/
165177
cp $ICU_PATH/frameworks/icuuc.xcframework/ios-*-simulator/libicuuc.a $ICU_PATH/lib/
166-
./b2 --stagedir=stage/iossim-$1 toolset=darwin-iossim abi=$3 architecture=$2 target-os=iphone define=BOOST_TEST_NO_MAIN $B2_BUILD_OPTIONS $LIBS_TO_BUILD
178+
./b2 --stagedir=stage/iossim-$1 toolset=darwin-iossim architecture=$(boost_arc $1) abi=$(boost_abi $1) target-os=iphone define=BOOST_TEST_NO_MAIN $B2_BUILD_OPTIONS $LIBS_TO_BUILD
167179
rm -rf bin.v2
168180
}
169181

170182
if true; then
171-
if [ -d stage/iossim/lib ]; then
183+
if [ -d stage/macosx/lib ]; then
184+
rm -rf stage/macosx/lib
185+
fi
186+
187+
build_macos_libs x86_64
188+
build_macos_libs arm64
189+
mkdir -p stage/macosx/lib
190+
fi
191+
192+
if true; then
193+
if [[ -d stage/catalyst/lib ]]; then
194+
rm -rf stage/catalyst/lib
195+
fi
196+
build_catalyst_libs arm64 arm-apple-ios13.4-macabi
197+
build_catalyst_libs x86_64 x86_64-apple-ios13.4-macabi
198+
mkdir -p stage/catalyst/lib
199+
fi
200+
201+
if true; then
202+
if [[ -d stage/iossim/lib ]]; then
172203
rm -rf stage/iossim/lib
173204
fi
205+
build_sim_libs arm64
206+
build_sim_libs x86_64
174207
mkdir -p stage/iossim/lib
175-
build_sim_libs arm64 arm aapcs
176-
build_sim_libs x86_64 x86 sysv
177208
fi
178209

210+
build_ios_libs
211+
179212
echo installing boost...
180-
if [ -d "$BUILD_DIR/frameworks" ]; then
213+
if [[ -d "$BUILD_DIR/frameworks" ]]; then
181214
rm -rf "$BUILD_DIR/frameworks"
182215
fi
183216

184217
mkdir "$BUILD_DIR/frameworks"
185218

186-
187-
188219
build_xcframework()
189220
{
221+
lipo -create stage/macosx-arm64/lib/lib$1.a stage/macosx-x86_64/lib/lib$1.a -output stage/macosx/lib/lib$1.a
190222
lipo -create stage/catalyst-arm64/lib/lib$1.a stage/catalyst-x86_64/lib/lib$1.a -output stage/catalyst/lib/lib$1.a
191223
lipo -create stage/iossim-arm64/lib/lib$1.a stage/iossim-x86_64/lib/lib$1.a -output stage/iossim/lib/lib$1.a
192224

@@ -232,6 +264,7 @@ build_xcframework boost_unit_test_framework
232264
build_xcframework boost_thread
233265
build_xcframework boost_timer
234266
build_xcframework boost_type_erasure
267+
build_xcframework boost_url
235268
build_xcframework boost_wave
236269

237270
mkdir "$BUILD_DIR/frameworks/Headers"

0 commit comments

Comments
 (0)