Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
matrix:
os:
- ubuntu-24.04
- windows-2019
- macos-13
- windows-2022
- macos-15-intel
node_arch:
- x64
cpp_arch:
Expand All @@ -28,7 +28,7 @@ jobs:
- ""
include:
# Windows x86
- os: windows-2019
- os: windows-2022
node_arch: x64
target_arch: ia32
cpp_arch: amd64_x86
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
cmake: true
ninja: true
python: true
vcpkg: true
vcpkg: 608d1dbcd6969679f82b1ca6b89d58939c9b228e
architecture: ${{ matrix.cpp_arch }}

- name: Install Mac-OS Dependencies
Expand Down Expand Up @@ -239,7 +239,7 @@ jobs:
path: ./build-artifacts

- name: Install Dependencies
run: pnpm install
run: pnpm install --ignore-scripts

- name: Merge Artifacts
run: |
Expand Down Expand Up @@ -267,7 +267,7 @@ jobs:
- ubuntu-22.04-arm
- ubuntu-24.04-arm
- windows-2022
- macos-13
- macos-15-intel
node-version:
- 12
- 22
Expand Down
19 changes: 15 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ set_option_from_env(ZMQ_NO_SYNC_RESOLVE)
option(ZMQ_ENABLE_SANITIZER_UNDEFINED "Enable undefined behavior sanitizer" OFF)
set_option_from_env(ZMQ_ENABLE_SANITIZER_UNDEFINED)

option(ZMQ_SHARED "Use a system-installed shared libzmq" OFF)
set_option_from_env(ZMQ_SHARED)

if(${ZMQ_ENABLE_SANITIZER_UNDEFINED})
set(ENABLE_SANITIZER_UNDEFINED "ENABLE_SANITIZER_UNDEFINED")
endif()
Expand Down Expand Up @@ -114,8 +117,10 @@ if(APPLE)
"${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup")
endif()

run_vcpkg(VCPKG_URL "https://github.com/microsoft/vcpkg.git" VCPKG_REV
"608d1dbcd6969679f82b1ca6b89d58939c9b228e")
if(NOT ZMQ_SHARED)
run_vcpkg(VCPKG_URL "https://github.com/microsoft/vcpkg.git" VCPKG_REV
"608d1dbcd6969679f82b1ca6b89d58939c9b228e")
endif()

# Name of the addon
project(addon LANGUAGES C CXX)
Expand Down Expand Up @@ -146,8 +151,14 @@ if(ZMQ_NO_SYNC_RESOLVE)
endif()

# ZeroMQ
find_package(ZeroMQ CONFIG REQUIRED)
target_link_system_libraries(addon PRIVATE libzmq libzmq-static)
if(ZMQ_SHARED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(ZeroMQ REQUIRED IMPORTED_TARGET libzmq)
target_link_system_libraries(addon PRIVATE PkgConfig::ZeroMQ)
else()
find_package(ZeroMQ CONFIG REQUIRED)
target_link_system_libraries(addon PRIVATE libzmq libzmq-static)
endif()

# Node specific
target_include_system_directories(addon PRIVATE ${CMAKE_JS_INC})
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,16 @@ When building from source, you can also specify additional build options in a
<details>
<summary>👉🏻 Options</summary>

### System libzmq

Uses a shared `libzmq` installation discoverable through `pkg-config` instead of
building the vendored vcpkg dependency. Install `libzmq` and add the following
to your `.npmrc`:

```ini
zmq_shared=true
```

### Curve with Libsodium support

(Enabled by default)
Expand Down
3 changes: 1 addition & 2 deletions docker/alpine.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ FROM base AS builder
WORKDIR /app
COPY ./ ./
# build
RUN npm i -g pnpm && \
RUN npm i -g pnpm@10.8.0 && \
pnpm install && \
pnpm run build

Expand All @@ -20,4 +20,3 @@ COPY ./ ./
COPY --from=builder /app/build ./build
COPY --from=builder /app/node_modules ./node_modules


3 changes: 1 addition & 2 deletions docker/ubuntu.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ WORKDIR /app
COPY ./ ./

# build
RUN npm i -g pnpm && \
RUN npm i -g pnpm@10.8.0 && \
pnpm install && \
pnpm run build

Expand All @@ -27,4 +27,3 @@ COPY ./ ./
COPY --from=builder /app/build ./build
COPY --from=builder /app/node_modules ./node_modules


Loading