Skip to content

Commit 5ef4c11

Browse files
committed
Revert "Release Windows packages (#5)"
This reverts commit 5c87deb.
1 parent 493889d commit 5ef4c11

File tree

6 files changed

+98
-170
lines changed

6 files changed

+98
-170
lines changed

.github/workflows/ci-build-binary-artifacts.yaml

Lines changed: 78 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,82 @@ concurrency:
2828
cancel-in-progress: true
2929

3030
jobs:
31+
32+
package-linux:
33+
name: Build ${{matrix.pkg.name}} ${{matrix.cpu.platform}}
34+
runs-on: ubuntu-22.04
35+
timeout-minutes: 500
36+
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
pkg:
41+
- { name: 'RPM', type: 'rpm', path: 'pkg/rpm/RPMS' }
42+
- { name: 'Deb', type: 'deb', path: 'pkg/deb/BUILD/DEB' }
43+
- { name: 'Alpine', type: 'apk', path: 'pkg/apk/build' }
44+
cpu:
45+
- { arch: 'x86_64', platform: 'x86_64' }
46+
- { arch: 'aarch64', platform: 'arm64' }
47+
48+
steps:
49+
- name: checkout
50+
uses: actions/checkout@v3
51+
52+
- name: Set up QEMU
53+
uses: docker/setup-qemu-action@v2
54+
55+
- name: Package Pulsar source
56+
run: build-support/generate-source-archive.sh
57+
58+
- uses: docker/setup-buildx-action@v2
59+
- run: build-support/copy-deps-versionfile.sh
60+
61+
- name: Build dependencies Docker image
62+
uses: docker/build-push-action@v3
63+
with:
64+
context: ./pkg/${{matrix.pkg.type}}
65+
load: true
66+
tags: build:latest
67+
platforms: linux/${{matrix.cpu.platform}}
68+
build-args: PLATFORM=${{matrix.cpu.arch}}
69+
cache-from: type=gha
70+
cache-to: type=gha,mode=max
71+
72+
- name: Build packages
73+
run: pkg/${{matrix.pkg.type}}/docker-build-${{matrix.pkg.type}}-${{matrix.cpu.platform}}.sh build:latest
74+
75+
- name: Zip artifact
76+
run: zip -r ${{matrix.pkg.type}}-${{matrix.cpu.platform}}.zip ${{matrix.pkg.path}}
77+
78+
- name: Upload binaries to release
79+
uses: svenstaro/upload-release-action@v2
80+
with:
81+
repo_token: ${{ secrets.GITHUB_TOKEN }}
82+
file: ${{matrix.pkg.type}}-${{matrix.cpu.platform}}.zip
83+
asset_name: ${{matrix.pkg.type}}-${{matrix.cpu.platform}}.zip
84+
tag: ${{ github.ref }}
85+
overwrite: true
86+
3187
package-windows:
3288
timeout-minutes: 120
3389
name: Build CPP Client on ${{ matrix.name }}
3490
runs-on: ${{ matrix.os }}
3591
env:
3692
VCPKG_ROOT: '${{ github.workspace }}/vcpkg'
37-
INSTALL_DIR: 'C:\pulsar-cpp'
3893
strategy:
3994
fail-fast: false
4095
matrix:
4196
include:
4297
- name: 'Windows x64'
4398
os: windows-2022
44-
triplet: x64-windows-static
99+
triplet: x64-windows
45100
vcpkg_dir: 'C:\vcpkg'
46101
suffix: 'windows-win64'
47102
generator: 'Visual Studio 17 2022'
48103
arch: '-A x64'
49104
- name: 'Windows x86'
50105
os: windows-2022
51-
triplet: x86-windows-static
106+
triplet: x86-windows
52107
vcpkg_dir: 'C:\vcpkg'
53108
suffix: 'windows-win32'
54109
generator: 'Visual Studio 17 2022'
@@ -90,7 +145,7 @@ jobs:
90145
run: |
91146
${{ env.VCPKG_ROOT }}\vcpkg.exe install --triplet ${{ matrix.triplet }} > dependencies.txt
92147
93-
- name: Build and package
148+
- name: Configure and build
94149
shell: bash
95150
run: |
96151
BUILD_DIR=./build
@@ -99,15 +154,30 @@ jobs:
99154
-G "${{ matrix.generator }}" ${{ matrix.arch }} \
100155
-DBUILD_TESTS=OFF \
101156
-DVCPKG_TRIPLET=${{ matrix.triplet }} \
102-
-DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} \
103157
-S .
104158
cmake --build $BUILD_DIR --parallel --config Release
105-
cmake --install $BUILD_DIR
106-
cp dependencies.txt ${{ env.INSTALL_DIR }}
159+
160+
- name: Package
161+
shell: bash
162+
run: |
163+
BUILD_DIR=./build
164+
PACKAGE_DIR=./package
165+
LIB_DIR=$PACKAGE_DIR/lib/Release
166+
VCPKG_INSTALLED_DIR=$PACKAGE_DIR/vcpkg_installed
167+
mkdir -p $PACKAGE_DIR
168+
mkdir -p $LIB_DIR
169+
mkdir -p $VCPKG_INSTALLED_DIR/${{ matrix.triplet }}
170+
171+
cp dependencies.txt $PACKAGE_DIR
172+
cp -r ./include $PACKAGE_DIR
173+
cp -r $BUILD_DIR/include/ $PACKAGE_DIR
174+
cp -r $BUILD_DIR/lib/Release/*.lib $LIB_DIR
175+
cp -r $BUILD_DIR/lib/Release/*.dll $LIB_DIR
176+
cp -r ./vcpkg_installed/${{ matrix.triplet }}/* $VCPKG_INSTALLED_DIR/${{ matrix.triplet }}
107177
108178
- name: Zip artifact
109179
shell: bash
110-
run: 7z a -tzip Windows-${{ matrix.triplet }}.zip ${{ env.INSTALL_DIR }}/*
180+
run: 7z a -tzip Windows-${{ matrix.triplet }}.zip ./package
111181

112182
- name: Upload binaries to release
113183
uses: svenstaro/upload-release-action@v2

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

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ jobs:
8181
runs-on: ${{ matrix.os }}
8282
env:
8383
VCPKG_ROOT: '${{ github.workspace }}/vcpkg'
84-
INSTALL_DIR: 'C:\pulsar-cpp'
8584
strategy:
8685
fail-fast: false
8786
matrix:
@@ -157,49 +156,24 @@ jobs:
157156
cmake --build ./build-0 --parallel --config Release
158157
fi
159158
160-
- name: Install static vcpkg packages
161-
run: |
162-
${{ env.VCPKG_ROOT }}\vcpkg.exe install --triplet "${{ matrix.triplet }}-static"
163-
164-
- name: Configure (LINK_STATIC=ON)
159+
- name: Configure (dynamic library only)
165160
shell: bash
166161
run: |
167162
if [ "$RUNNER_OS" == "Windows" ]; then
168163
cmake \
169164
-B ./build-1 \
170165
-G "${{ matrix.generator }}" ${{ matrix.arch }} \
171166
-DBUILD_TESTS=OFF \
172-
-DVCPKG_TRIPLET="${{ matrix.triplet }}-static" \
173-
-DCMAKE_INSTALL_PREFIX="${{ env.INSTALL_DIR }}" \
167+
-DVCPKG_TRIPLET=${{ matrix.triplet }} \
168+
-DBUILD_STATIC_LIB=OFF \
174169
-S .
175170
fi
176171
177-
- name: Install
172+
- name: Compile
178173
shell: bash
179174
run: |
180175
if [ "$RUNNER_OS" == "Windows" ]; then
181176
cmake --build ./build-1 --parallel --config Release
182-
cmake --install ./build-1
183-
fi
184-
185-
- name: Test examples
186-
shell: bash
187-
run: |
188-
if [ "$RUNNER_OS" == "Windows" ]; then
189-
cd win-examples
190-
cmake \
191-
-G "${{ matrix.generator }}" ${{ matrix.arch }} \
192-
-DLINK_STATIC=OFF \
193-
-DCMAKE_PREFIX_PATH=${{ env.INSTALL_DIR }} \
194-
-B build-dynamic
195-
cmake --build build-dynamic --config Release
196-
cmake \
197-
-G "${{ matrix.generator }}" ${{ matrix.arch }} \
198-
-DLINK_STATIC=ON \
199-
-DCMAKE_PREFIX_PATH=${{ env.INSTALL_DIR }} \
200-
-B build-static
201-
cmake --build build-static --config Release
202-
./build-static/Release/win-example.exe
203177
fi
204178
205179
package:

CMakeLists.txt

Lines changed: 15 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ message(STATUS "Pulsar Client version macro: ${PULSAR_CLIENT_VERSION_MACRO}")
3333
set(PVM_COMMENT "This is generated from Version.h.in by CMAKE. DO NOT EDIT DIRECTLY")
3434
configure_file(templates/Version.h.in include/pulsar/Version.h @ONLY)
3535

36-
option(LINK_STATIC "Link against static libraries" OFF)
3736
if (VCPKG_TRIPLET)
3837
message(STATUS "Use vcpkg, triplet is ${VCPKG_TRIPLET}")
3938
set(CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/vcpkg_installed/${VCPKG_TRIPLET}")
@@ -45,13 +44,7 @@ if (VCPKG_TRIPLET)
4544
set(ZLIB_ROOT ${VCPKG_DEBUG_ROOT})
4645
set(OPENSSL_ROOT_DIR ${VCPKG_DEBUG_ROOT})
4746
endif ()
48-
if (VCPKG_TRIPLET MATCHES ".*-static")
49-
set(LINK_STATIC ON)
50-
else ()
51-
set(LINK_STATIC OFF)
52-
endif ()
5347
endif()
54-
MESSAGE(STATUS "LINK_STATIC: " ${LINK_STATIC})
5548

5649
find_program(CCACHE_PROGRAM ccache)
5750
if(CCACHE_PROGRAM)
@@ -76,6 +69,9 @@ MESSAGE(STATUS "BUILD_WIRESHARK: " ${BUILD_WIRESHARK})
7669
option(BUILD_PERF_TOOLS "Build Pulsar CLI perf producer/consumer" OFF)
7770
MESSAGE(STATUS "BUILD_PERF_TOOLS: " ${BUILD_PERF_TOOLS})
7871

72+
option(LINK_STATIC "Link against static libraries" OFF)
73+
MESSAGE(STATUS "LINK_STATIC: " ${LINK_STATIC})
74+
7975
option(USE_LOG4CXX "Build with Log4cxx support" OFF)
8076
MESSAGE(STATUS "USE_LOG4CXX: " ${USE_LOG4CXX})
8177

@@ -97,7 +93,7 @@ set(CMAKE_C_STANDARD 11)
9793
# https://stackoverflow.com/questions/10046114/in-cmake-how-can-i-test-if-the-compiler-is-clang
9894
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
9995
add_definitions(-DWIN32_LEAN_AND_MEAN -DNOGDI -D_WIN32_WINNT=0x0501 -D_CRT_SECURE_NO_WARNINGS)
100-
add_compile_options(/wd4244 /wd4267 /wd4018 /wd4715 /wd4251 /wd4275 /wd4819)
96+
add_compile_options(/wd4244 /wd4267 /wd4018 /wd4715 /wd4251 /wd4275)
10197
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
10298
# ?? Don't have this to test with
10399
else() # GCC or Clang are mostly compatible:
@@ -172,7 +168,7 @@ if (NOT ZLIB_INCLUDE_DIRS OR NOT ZLIB_LIBRARIES)
172168
message(FATAL_ERROR "Could not find zlib")
173169
endif ()
174170

175-
if (LINK_STATIC AND NOT VCPKG_TRIPLET)
171+
if (LINK_STATIC)
176172
find_library(LIB_ZSTD NAMES libzstd.a)
177173
message(STATUS "ZStd: ${LIB_ZSTD}")
178174
find_library(LIB_SNAPPY NAMES libsnappy.a)
@@ -199,29 +195,6 @@ if (LINK_STATIC AND NOT VCPKG_TRIPLET)
199195
if (MSVC)
200196
add_definitions(-DCURL_STATICLIB)
201197
endif()
202-
elseif (LINK_STATIC AND VCPKG_TRIPLET)
203-
find_package(protobuf REQUIRED)
204-
message(STATUS "Found protobuf static library: " ${Protobuf_LIBRARIES})
205-
find_library(ZLIB_LIBRARIES NAMES zlib z)
206-
if (ZLIB_LIBRARIES)
207-
message(STATUS "Found zlib static library: " ${ZLIB_LIBRARIES})
208-
else ()
209-
message(FATAL_ERROR "Failed to find zlib static library")
210-
endif ()
211-
find_library(CURL_LIBRARIES NAMES libcurl)
212-
if (CURL_LIBRARIES)
213-
message(STATUS "Found libcurl: ${CURL_LIBRARIES}")
214-
else ()
215-
message(FATAL_ERROR "Cannot find libcurl")
216-
endif ()
217-
find_library(LIB_ZSTD zstd)
218-
if (LIB_ZSTD)
219-
message(STATUS "Found ZSTD library: ${LIB_ZSTD}")
220-
endif ()
221-
find_library(LIB_SNAPPY NAMES snappy)
222-
if (LIB_SNAPPY)
223-
message(STATUS "Found Snappy library: ${LIB_SNAPPY}")
224-
endif ()
225198
else()
226199
if (MSVC AND (${CMAKE_BUILD_TYPE} STREQUAL Debug))
227200
find_library(LIB_ZSTD zstdd HINTS "${VCPKG_DEBUG_ROOT}/lib")
@@ -238,7 +211,7 @@ else()
238211
find_library(LOG4CXX_LIBRARY_PATH log4cxx)
239212
find_path(LOG4CXX_INCLUDE_PATH log4cxx/logger.h)
240213
endif (USE_LOG4CXX)
241-
endif ()
214+
endif (LINK_STATIC)
242215

243216
if (Boost_MAJOR_VERSION EQUAL 1 AND Boost_MINOR_VERSION LESS 69)
244217
# Boost System does not require linking since 1.69
@@ -247,15 +220,15 @@ if (Boost_MAJOR_VERSION EQUAL 1 AND Boost_MINOR_VERSION LESS 69)
247220
endif()
248221

249222
if (MSVC)
250-
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} date_time)
223+
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} date_time)
251224
endif()
252225

253226
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
254227
# GCC 4.8.2 implementation of std::regex is buggy
255228
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} regex)
256229
set(CMAKE_CXX_FLAGS " -DPULSAR_USE_BOOST_REGEX")
257230
MESSAGE(STATUS "Using Boost::Regex")
258-
elseif (CMAKE_COMPILER_IS_GNUCC)
231+
else()
259232
MESSAGE(STATUS "Using std::regex")
260233
# Turn on color error messages and show additional help with errors (only available in GCC v4.9+):
261234
add_compile_options(-fdiagnostics-show-option -fdiagnostics-color)
@@ -322,7 +295,7 @@ include_directories(
322295

323296
set(COMMON_LIBS
324297
${COMMON_LIBS}
325-
${CMAKE_THREAD_LIBS_INIT}
298+
Threads::Threads
326299
${Boost_REGEX_LIBRARY}
327300
${Boost_SYSTEM_LIBRARY}
328301
${Boost_DATE_TIME_LIBRARY}
@@ -334,25 +307,13 @@ set(COMMON_LIBS
334307
${CMAKE_DL_LIBS}
335308
)
336309

337-
if (MSVC)
338-
set(COMMON_LIBS
339-
${COMMON_LIBS}
340-
${Boost_DATE_TIME_LIBRARY}
341-
wldap32.lib
342-
Normaliz.lib)
343-
if (LINK_STATIC)
344-
# add external dependencies of libcurl
345-
set(COMMON_LIBS ${COMMON_LIBS} ws2_32.lib crypt32.lib)
346-
# the default compile options have /MD, which cannot be used to build DLLs that link static libraries
347-
string(REGEX REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
348-
string(REGEX REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
349-
string(REGEX REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
350-
message(STATUS "CMAKE_CXX_FLAGS_DEBUG: " ${CMAKE_CXX_FLAGS_DEBUG})
351-
message(STATUS "CMAKE_CXX_FLAGS_RELEASE: " ${CMAKE_CXX_FLAGS_RELEASE})
352-
message(STATUS "CMAKE_CXX_FLAGS_RELWITHDEBINFO: " ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
353-
endif ()
354-
else()
310+
if (NOT MSVC)
355311
set(COMMON_LIBS ${COMMON_LIBS} m)
312+
else()
313+
set(COMMON_LIBS
314+
${COMMON_LIBS}
315+
wldap32.lib
316+
Normaliz.lib)
356317
endif()
357318

358319
if (USE_LOG4CXX)

lib/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ endif(NOT LIBRARY_VERSION)
4646
if (MSVC)
4747
find_package(dlfcn-win32 REQUIRED)
4848
set(CMAKE_DL_LIBS dlfcn-win32::dl psapi.lib)
49-
get_target_property(dlfcn-win32_LIBRARY dlfcn-win32::dl IMPORTED_LOCATION_RELEASE)
50-
message(STATUS "dlfcn-win32_LIBRARY: " ${dlfcn-win32_LIBRARY})
5149
endif(MSVC)
5250

5351

@@ -90,7 +88,7 @@ endif()
9088
# required dependencies except ssl
9189
if (LINK_STATIC AND BUILD_STATIC_LIB)
9290
if (MSVC)
93-
set(COMMON_LIBS ${COMMON_LIBS} ${dlfcn-win32_LIBRARY})
91+
9492
# This function is to remove either "debug" or "optimized" library names
9593
# out of the COMMON_LIBS list and return the sanitized list of libraries
9694
function(remove_libtype LIBLIST LIBTYPE OUTLIST)

0 commit comments

Comments
 (0)