Skip to content

Commit df1da0d

Browse files
committed
Remove the dependencies on macOS frameworks
1 parent 796759e commit df1da0d

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

.github/workflows/ci-pr-validation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
clang++ win-examples/example.cc -o dynamic.out -std=c++11 -arch ${{ matrix.arch }} -I $PULSAR_DIR/include -L $PULSAR_DIR/lib -Wl,-rpath $PULSAR_DIR/lib -lpulsar
7171
./dynamic.out
7272
echo "Build with static library"
73-
clang++ win-examples/example.cc -o static.out -std=c++11 -arch ${{ matrix.arch }} -I $PULSAR_DIR/include $PULSAR_DIR/lib/libpulsarwithdeps.a -framework SystemConfiguration -framework CoreServices -framework CoreFoundation
73+
clang++ win-examples/example.cc -o static.out -std=c++11 -arch ${{ matrix.arch }} -I $PULSAR_DIR/include $PULSAR_DIR/lib/libpulsarwithdeps.a
7474
./static.out
7575
7676
check-completion:

pkg/mac/build-static-library.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,32 @@
2121
set -e
2222
cd `dirname $0`/../..
2323

24+
if [[ -z $ARCH ]]; then
25+
ARCH=$(uname -m)
26+
echo "Use default ARCH: $ARCH"
27+
fi
2428
if [[ $ARCH == "x86_64" ]]; then
2529
export VCPKG_TRIPLET=x64-osx
26-
cp -f vcpkg-triplets/x64-osx.cmake vcpkg/triplets/x64-osx.cmake
2730
elif [[ $ARCH == "arm64" ]]; then
2831
export VCPKG_TRIPLET=arm64-osx
29-
cp -f vcpkg-triplets/arm64-osx.cmake vcpkg/triplets/community/arm64-osx.cmake
3032
else
3133
echo "Invalid ARCH: $ARCH"
3234
exit 1
3335
fi
34-
CMAKE_OSX_ARCHITECTURES=$ARCH
36+
37+
# Apply the patch to disable IPv6 when building curl, otherwise curl will depend on some
38+
# frameworks (CoreFoundation, CoreServices, SystemConfiguration) that cannot be bundled
39+
# into the static library `libpulsarwithdeps.a`.
40+
# It requires the extra link options like `-framework CoreFoundation -framework CoreServices -framework SystemConfiguration`.
41+
sed -i.bak 's/set(OPTIONS "")/set(OPTIONS -DENABLE_IPV6=OFF)/' vcpkg/ports/curl/portfile.cmake
3542

3643
INSTALL_DIR=$PWD/pkg/mac/.install
3744
set -x
3845
cmake -B build-osx \
3946
-DINTEGRATE_VCPKG=ON \
47+
-DVCPKG_OVERLAY_TRIPLETS=$PWD/vcpkg-triplets \
4048
-DVCPKG_TARGET_TRIPLET=$VCPKG_TRIPLET \
41-
-DCMAKE_OSX_ARCHITECTURES=$CMAKE_OSX_ARCHITECTURES \
49+
-DCMAKE_OSX_ARCHITECTURES=$ARCH \
4250
-DCMAKE_BUILD_TYPE=Release \
4351
-DBUILD_TESTS=OFF \
4452
-DBUILD_PERF_TOOLS=OFF \

0 commit comments

Comments
 (0)