Skip to content

Commit 5abd107

Browse files
committed
linux arm64
1 parent 029fac8 commit 5abd107

File tree

1 file changed

+8
-31
lines changed

1 file changed

+8
-31
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ jobs:
2424
node_arch: x64
2525
cmake_arch: x86_64
2626

27+
# Linux ARM64 builds (native)
28+
- os: ubuntu-24.04-arm
29+
arch: arm64
30+
node_arch: arm64
31+
cmake_arch: arm64
32+
2733
# macOS builds
2834
- os: macos-latest
2935
arch: arm64
@@ -65,25 +71,6 @@ jobs:
6571
libboost-all-dev \
6672
pkg-config
6773

68-
# 3a. Linux ARM64 交叉编译设置
69-
- name: Setup Linux ARM64 cross-compilation
70-
if: runner.os == 'Linux' && matrix.arch == 'arm64'
71-
run: |
72-
sudo apt-get install -y \
73-
gcc-aarch64-linux-gnu \
74-
g++-aarch64-linux-gnu \
75-
gfortran-aarch64-linux-gnu
76-
# 添加 ARM64 架构支持
77-
sudo dpkg --add-architecture arm64
78-
sudo apt-get update
79-
sudo apt-get install -y \
80-
libfftw3-dev:arm64 \
81-
libboost-all-dev:arm64
82-
# 设置交叉编译环境变量
83-
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
84-
echo "CXX=aarch64-linux-gnu-g++" >> $GITHUB_ENV
85-
echo "FC=aarch64-linux-gnu-gfortran" >> $GITHUB_ENV
86-
8774
# 3. 安装系统依赖 - macOS
8875
- name: Install macOS dependencies
8976
if: runner.os == 'macOS'
@@ -209,18 +196,8 @@ jobs:
209196
# 清理可能存在的CMake缓存
210197
rm -rf build/
211198

212-
if [ "${{ matrix.arch }}" = "arm64" ] && [ "${{ runner.os }}" = "Linux" ]; then
213-
# Linux ARM64 交叉编译
214-
npx cmake-js compile --arch=${{ matrix.cmake_arch }} \
215-
--CDCMAKE_SYSTEM_NAME=Linux \
216-
--CDCMAKE_SYSTEM_PROCESSOR=aarch64 \
217-
--CDCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
218-
--CDCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
219-
--CDCMAKE_Fortran_COMPILER=aarch64-linux-gnu-gfortran
220-
else
221-
# 本地编译
222-
npx cmake-js compile --arch=${{ matrix.cmake_arch }}
223-
fi
199+
# 原生编译(支持所有架构)
200+
npx cmake-js compile --arch=${{ matrix.cmake_arch }}
224201

225202
# 8. 构建原生模块 - Windows MSYS2/MinGW-w64 (基于 build_mingw.sh)
226203
- name: Build native module (Windows MSYS2)

0 commit comments

Comments
 (0)