Skip to content

Commit bfee50e

Browse files
committed
enable prebuildify
1 parent 52c9203 commit bfee50e

35 files changed

+594
-52
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Prebuild Linux ARM64
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- develop
8+
push:
9+
tags:
10+
- '*'
11+
12+
jobs:
13+
prebuild:
14+
runs-on: ubuntu-24.04-arm
15+
container:
16+
image: ${{ matrix.docker_image }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
node-version: [22.X]
21+
architecture: [arm64]
22+
ros_distribution:
23+
- humble
24+
- jazzy
25+
- kilted
26+
include:
27+
# Humble Hawksbill (May 2022 - May 2027)
28+
- docker_image: ubuntu:jammy
29+
ros_distribution: humble
30+
ubuntu_codename: jammy
31+
# Jazzy Jalisco (May 2024 - May 2029)
32+
- docker_image: ubuntu:noble
33+
ros_distribution: jazzy
34+
ubuntu_codename: noble
35+
# Kilted Kaiju (May 2025 - Dec 2026)
36+
- docker_image: ubuntu:noble
37+
ros_distribution: kilted
38+
ubuntu_codename: noble
39+
40+
steps:
41+
- name: Setup Node.js ${{ matrix.node-version }} on ${{ matrix.architecture }}
42+
uses: actions/setup-node@v5
43+
with:
44+
node-version: ${{ matrix.node-version }}
45+
architecture: ${{ matrix.architecture }}
46+
47+
- name: Setup ROS2
48+
uses: ros-tooling/[email protected]
49+
with:
50+
required-ros-distributions: ${{ matrix.ros_distribution }}
51+
52+
- name: Install test-msgs on Linux
53+
shell: bash
54+
run: |
55+
sudo apt install ros-${{ matrix.ros_distribution }}-test-msgs
56+
57+
- uses: actions/checkout@v5
58+
59+
- name: Install dependencies
60+
shell: bash
61+
run: |
62+
source /opt/ros/${{ matrix.ros_distribution }}/setup.bash
63+
npm i
64+
65+
- name: Generate prebuilt binary
66+
shell: bash
67+
run: |
68+
source /opt/ros/${{ matrix.ros_distribution }}/setup.bash
69+
npm run prebuild
70+
71+
- name: Upload prebuilt binary
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: prebuilt-linux-arm64-node${{ matrix.node-version }}-${{ matrix.ubuntu_codename }}-${{ matrix.ros_distribution }}
75+
path: prebuilds/linux-arm64/*.node
76+
if-no-files-found: error
77+
78+
- name: Test loading prebuilt
79+
shell: bash
80+
run: |
81+
source /opt/ros/${{ matrix.ros_distribution }}/setup.bash
82+
node -e "
83+
const rclnodejs = require('./index.js');
84+
console.log('Successfully loaded rclnodejs with prebuilt binary');
85+
console.log('Platform:', process.platform, 'Arch:', process.arch);
86+
console.log('ROS_DISTRO:', process.env.ROS_DISTRO);
87+
"
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Prebuild Linux x64
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- develop
8+
push:
9+
tags:
10+
- '*'
11+
12+
jobs:
13+
prebuild:
14+
runs-on: ubuntu-latest
15+
container:
16+
image: ${{ matrix.docker_image }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
node-version: [22.X]
21+
architecture: [x64]
22+
ros_distribution:
23+
- humble
24+
- jazzy
25+
- kilted
26+
include:
27+
# Humble Hawksbill (May 2022 - May 2027)
28+
- docker_image: ubuntu:jammy
29+
ros_distribution: humble
30+
ubuntu_codename: jammy
31+
# Jazzy Jalisco (May 2024 - May 2029)
32+
- docker_image: ubuntu:noble
33+
ros_distribution: jazzy
34+
ubuntu_codename: noble
35+
# Kilted Kaiju (May 2025 - Dec 2026)
36+
- docker_image: ubuntu:noble
37+
ros_distribution: kilted
38+
ubuntu_codename: noble
39+
40+
steps:
41+
- name: Setup Node.js ${{ matrix.node-version }} on ${{ matrix.architecture }}
42+
uses: actions/setup-node@v5
43+
with:
44+
node-version: ${{ matrix.node-version }}
45+
architecture: ${{ matrix.architecture }}
46+
47+
- name: Setup ROS2
48+
uses: ros-tooling/[email protected]
49+
with:
50+
required-ros-distributions: ${{ matrix.ros_distribution }}
51+
52+
- name: Install test-msgs on Linux
53+
shell: bash
54+
run: |
55+
sudo apt install ros-${{ matrix.ros_distribution }}-test-msgs
56+
57+
- uses: actions/checkout@v5
58+
59+
- name: Install dependencies
60+
shell: bash
61+
run: |
62+
source /opt/ros/${{ matrix.ros_distribution }}/setup.bash
63+
npm i
64+
65+
- name: Generate prebuilt binary
66+
shell: bash
67+
run: |
68+
source /opt/ros/${{ matrix.ros_distribution }}/setup.bash
69+
npm run prebuild
70+
71+
- name: Upload prebuilt binary
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: prebuilt-linux-x64-node${{ matrix.node-version }}-${{ matrix.ubuntu_codename }}-${{ matrix.ros_distribution }}
75+
path: prebuilds/linux-x64/*.node
76+
if-no-files-found: error
77+
78+
- name: Test loading prebuilt
79+
shell: bash
80+
run: |
81+
source /opt/ros/${{ matrix.ros_distribution }}/setup.bash
82+
node -e "
83+
const rclnodejs = require('./index.js');
84+
console.log('Successfully loaded rclnodejs with prebuilt binary');
85+
console.log('Platform:', process.platform, 'Arch:', process.arch);
86+
console.log('ROS_DISTRO:', process.env.ROS_DISTRO);
87+
"

binding.gyp

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,6 @@
104104
'defines': [
105105
'OS_WINDOWS'
106106
],
107-
'conditions': [
108-
[
109-
'node_major_version >= 23', {
110-
'cflags_cc': [
111-
'-std=c++20'
112-
]
113-
}
114-
],
115-
[
116-
'node_major_version < 23', {
117-
'cflags_cc': [
118-
'-std=c++17'
119-
]
120-
}
121-
]
122-
],
123107
'include_dirs': [
124108
'./src/third_party/dlfcn-win32/',
125109
],
@@ -129,6 +113,7 @@
129113
'msvs_settings': {
130114
'VCCLCompilerTool': {
131115
'ExceptionHandling': '2', # /EHsc
116+
'AdditionalOptions': ['/std:c++20']
132117
},
133118
'VCLinkerTool': {
134119
'AdditionalDependencies': ['psapi.lib'],
@@ -147,7 +132,7 @@
147132
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
148133
'CLANG_CXX_LIBRARY': 'libc++',
149134
'MACOS_DEPLOYMENT_TARGET': '10.12',
150-
'CLANG_CXX_LANGUAGE_STANDARD': 'c++17'
135+
'CLANG_CXX_LANGUAGE_STANDARD': 'c++20'
151136
}
152137
}
153138
],

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const {
3737
} = require('./lib/parameter.js');
3838
const path = require('path');
3939
const QoS = require('./lib/qos.js');
40-
const rclnodejs = require('bindings')('rclnodejs');
40+
const rclnodejs = require('./lib/native_loader.js');
4141
const tsdGenerator = require('./rostsd_gen/index.js');
4242
const validator = require('./lib/validator.js');
4343
const Time = require('./lib/time.js');

lib/action/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
'use strict';
1616

17-
const rclnodejs = require('bindings')('rclnodejs');
17+
const rclnodejs = require('../native_loader.js');
1818
const ActionInterfaces = require('./interfaces.js');
1919
const ActionUuid = require('./uuid.js');
2020
const ClientGoalHandle = require('./client_goal_handle.js');

lib/action/graph.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
'use strict';
1616

17-
const rclnodejs = require('bindings')('rclnodejs');
17+
const rclnodejs = require('../native_loader.js');
1818

1919
/**
2020
* Get a list of action names and types for action clients associated with a node.

lib/action/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
'use strict';
1616

17-
const rclnodejs = require('bindings')('rclnodejs');
17+
const rclnodejs = require('../native_loader.js');
1818
const ActionInterfaces = require('./interfaces.js');
1919
const ActionUuid = require('./uuid.js');
2020
const DistroUtils = require('../distro.js');

lib/action/server_goal_handle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
'use strict';
1616

17-
const rclnodejs = require('bindings')('rclnodejs');
17+
const rclnodejs = require('../native_loader.js');
1818
const ActionInterfaces = require('./interfaces.js');
1919
const Deferred = require('./deferred.js');
2020
const { GoalEvent } = require('./response.js');

lib/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
'use strict';
1616

17-
const rclnodejs = require('bindings')('rclnodejs');
17+
const rclnodejs = require('./native_loader.js');
1818
const DistroUtils = require('./distro.js');
1919
const Entity = require('./entity.js');
2020
const debug = require('debug')('rclnodejs:client');

lib/clock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
'use strict';
1616

17-
const rclnodejs = require('bindings')('rclnodejs');
17+
const rclnodejs = require('./native_loader.js');
1818
const Time = require('./time.js');
1919
const ClockType = require('./clock_type.js');
2020

0 commit comments

Comments
 (0)