Skip to content

Commit 1f16f26

Browse files
committed
Build macOS libraries from pre-built libraries
1 parent 01aaffb commit 1f16f26

File tree

11 files changed

+114
-641
lines changed

11 files changed

+114
-641
lines changed

.github/workflows/ci-build-release-wheels.yaml

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -112,30 +112,8 @@ jobs:
112112
- name: checkout
113113
uses: actions/checkout@v3
114114

115-
- name: Dependencies cache
116-
uses: actions/cache@v3
117-
id: cache-deps
118-
with:
119-
path: .pulsar-mac-build/deps/install
120-
key: ${{matrix.py.version_long}}-${{ hashFiles('dependencies.yaml') }}-${{ hashFiles('pkg/mac/*') }}
121-
122-
- name: Build dependencies
123-
if: steps.cache-deps.outputs.cache-hit != 'true'
124-
run: pkg/mac/build-dependencies.sh ${{matrix.py.version}} ${{matrix.py.version_long}}
125-
126-
- name: Pulsar C++ cache
127-
uses: actions/cache@v3
128-
id: cache-cpp
129-
with:
130-
path: .pulsar-mac-build/cpp/install
131-
key: ${{ hashFiles('dependencies.yaml') }}-${{ hashFiles('pulsar-client-cpp-version.txt') }}-${{ hashFiles('pkg/mac/*') }}
132-
133-
- name: Build Pulsar C++ client
134-
if: steps.cache-cpp.outputs.cache-hit != 'true'
135-
run: pkg/mac/build-pulsar-cpp.sh
136-
137115
- name: Build and test Mac wheels
138-
run: pkg/mac/build-mac-wheels.sh ${{matrix.py.version}}
116+
run: pkg/mac/build-mac-wheels.sh ${{matrix.py.version}} ${{matrix.py.version_long}}
139117

140118
- name: Upload artifacts
141119
uses: actions/upload-artifact@v3

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

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -169,38 +169,9 @@ jobs:
169169
- name: checkout
170170
uses: actions/checkout@v3
171171

172-
- name: Dependencies cache
173-
uses: actions/cache@v3
174-
id: cache-deps
175-
with:
176-
path: .pulsar-mac-build/deps/install
177-
key: ${{matrix.py.version_long}}-${{ hashFiles('dependencies.yaml') }}-${{ hashFiles('pkg/mac/*') }}
178-
179-
- name: Build dependencies
180-
if: steps.cache-deps.outputs.cache-hit != 'true'
181-
run: |
182-
python3 -m venv venv
183-
source venv/bin/activate
184-
python3 -m pip install pyyaml setuptools
185-
pkg/mac/build-dependencies.sh ${{matrix.py.version}} ${{matrix.py.version_long}}
186-
187-
- name: Pulsar C++ cache
188-
uses: actions/cache@v3
189-
id: cache-cpp
190-
with:
191-
path: .pulsar-mac-build/cpp/install
192-
key: ${{ hashFiles('dependencies.yaml') }}-${{ hashFiles('pulsar-client-cpp-version.txt') }}-${{ hashFiles('pkg/mac/*') }}
193-
194-
- name: Build Pulsar C++ client
195-
if: steps.cache-cpp.outputs.cache-hit != 'true'
196-
run: |
197-
source venv/bin/activate
198-
pkg/mac/build-pulsar-cpp.sh
199-
200172
- name: Build and test Mac wheels
201173
run: |
202-
source venv/bin/activate
203-
pkg/mac/build-mac-wheels.sh ${{matrix.py.version}}
174+
pkg/mac/build-mac-wheels.sh ${{matrix.py.version}} ${{matrix.py.version_long}}
204175
205176
windows-wheels:
206177
name: "Python ${{ matrix.python.version }} Wheel on Windows x64"

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ vcpkg_installed/
2222
lib_pulsar.so
2323
tests/test.log
2424
.tests-container-id.txt
25-
25+
include/
26+
lib/

CMakeLists.txt

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,9 @@ if (MSVC)
3838
endif ()
3939

4040
if (LINK_STATIC)
41-
if (MSVC)
42-
find_library(PULSAR_LIBRARY NAMES pulsarWithDeps.lib)
43-
else ()
44-
find_library(PULSAR_LIBRARY NAMES libpulsar.a)
45-
endif ()
41+
find_library(PULSAR_LIBRARY NAMES pulsarwithdeps pulsarWithDeps.lib)
4642
add_definitions("-DPULSAR_STATIC")
47-
else()
43+
elseif (NOT PULSAR_LIBRARY)
4844
find_library(PULSAR_LIBRARY NAMES pulsar libpulsar)
4945
endif()
5046
message(STATUS "PULSAR_LIBRARY: ${PULSAR_LIBRARY}")
@@ -88,43 +84,11 @@ set(PYTHON_WRAPPER_LIBS ${PYTHON_WRAPPER_LIBS} Python3::Module)
8884
message(STATUS "All libraries: ${PYTHON_WRAPPER_LIBS}")
8985

9086
if (LINK_STATIC AND NOT MSVC)
91-
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
92-
93-
# We need to include all the static libs individually because we cannot easily create a universal2 libpulsar.a
94-
# with all the deps included.
95-
find_package(OpenSSL REQUIRED)
96-
message("OPENSSL_LIBRARIES: " ${OPENSSL_LIBRARIES})
97-
98-
find_package(Protobuf REQUIRED)
99-
message("Protobuf_LIBRARIES: " ${Protobuf_LIBRARIES})
100-
101-
find_package(curl REQUIRED)
102-
message("CURL_LIBRARIES: " ${CURL_LIBRARIES})
103-
104-
find_package(zlib)
105-
message("ZLIB_LIBRARIES: " ${ZLIB_LIBRARIES})
106-
107-
find_library(LIB_ZSTD NAMES libzstd.a)
108-
message(STATUS "ZStd: ${LIB_ZSTD}")
109-
find_library(LIB_SNAPPY NAMES libsnappy.a)
110-
message(STATUS "LIB_SNAPPY: ${LIB_SNAPPY}")
111-
112-
set(PYTHON_WRAPPER_LIBS ${PYTHON_WRAPPER_LIBS}
113-
${OPENSSL_LIBRARIES}
114-
${Protobuf_LIBRARIES}
115-
${ZLIB_LIBRARIES}
116-
${LIB_ZSTD}
117-
${LIB_SNAPPY}
118-
${CURL_LIBRARIES}
119-
)
120-
12187
if (APPLE)
12288
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup")
123-
target_link_libraries(_pulsar -Wl,-all_load ${PYTHON_WRAPPER_LIBS})
89+
target_link_libraries(_pulsar ${PYTHON_WRAPPER_LIBS})
12490
else ()
125-
if (NOT MSVC)
126-
set (CMAKE_SHARED_LINKER_FLAGS " -static-libgcc -static-libstdc++")
127-
endif()
91+
set (CMAKE_SHARED_LINKER_FLAGS " -static-libgcc -static-libstdc++")
12892
target_link_libraries(_pulsar ${PYTHON_WRAPPER_LIBS})
12993
endif ()
13094
elseif (LINK_STATIC) # MSVC

build-support/dep-url.sh

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,38 +38,15 @@ download_dependency() {
3838
VERSION=$(grep $DEP $DEP_FILE | sed 's/://' | awk '{print $2}')
3939

4040
case $DEP in
41-
"cmake")
42-
URL=https://github.com/Kitware/CMake/releases/download/v${VERSION}/cmake-${VERSION}-linux-${ARCH}.tar.gz
43-
;;
4441
"pulsar-cpp")
4542
URL=$(pulsar_cpp_base_url $VERSION)/apache-pulsar-client-cpp-${VERSION}.tar.gz
4643
;;
4744
"pybind11")
4845
URL=https://github.com/pybind/pybind11/archive/refs/tags/v${VERSION}.tar.gz
4946
;;
50-
"boost")
51-
VERSION_UNDERSCORE=$(echo $VERSION | sed 's/\./_/g')
52-
URL=https://github.com/boostorg/boost/archive/refs/tags/boost-${VERSION}.tar.gz
53-
;;
54-
"protobuf")
55-
URL=https://github.com/google/protobuf/releases/download/v${VERSION}/protobuf-cpp-${VERSION}.tar.gz
56-
;;
57-
"zlib")
58-
URL=https://github.com/madler/zlib/archive/v${VERSION}.tar.gz
59-
;;
60-
"zstd")
61-
URL=https://github.com/facebook/zstd/releases/download/v${VERSION}/zstd-${VERSION}.tar.gz
62-
;;
63-
"snappy")
64-
URL=https://github.com/google/snappy/archive/refs/tags/${VERSION}.tar.gz
65-
;;
6647
"openssl")
6748
URL=https://github.com/openssl/openssl/archive/OpenSSL_$(echo $VERSION | sed 's/\./_/g').tar.gz
6849
;;
69-
"curl")
70-
VERSION_UNDERSCORE=$(echo $VERSION | sed 's/\./_/g')
71-
URL=https://github.com/curl/curl/releases/download/curl-${VERSION_UNDERSCORE}/curl-${VERSION}.tar.gz
72-
;;
7350
*)
7451
echo "Unknown dependency $DEP for version $VERSION"
7552
exit 1

dependencies.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,7 @@
1717
# under the License.
1818
#
1919

20-
cmake: 3.24.2
2120
pulsar-cpp: 3.7.0
2221
pybind11: 2.10.1
23-
boost: 1.80.0
24-
protobuf: 3.20.0
25-
zlib: 1.2.13
26-
zstd: 1.5.2
27-
snappy: 1.1.9
22+
# The OpenSSL dependency is only used when building Python from source
2823
openssl: 1.1.1q
29-
curl: 8.4.0

0 commit comments

Comments
 (0)