Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build a universal binary to support M1 (Apple silicon) #181

Merged
merged 4 commits into from
Sep 28, 2021
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
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ jobs:
include:
- os: ubuntu-latest
build-group: linux-x64
- os: macos-latest
build-group: darwin-x64
# At the time of writing macos-latest is mac 10; we need 11 to build a universal binary.
- os: macos-11
build-group: darwin-x64+arm64
- os: windows-latest
build-group: win32-x64
runs-on: ${{ matrix.os }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# At the time of writing macos-latest is mac 10; we need 11 to build a universal binary.
os: [ubuntu-latest, macos-11, windows-latest]
node: [10, 12, 14]
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} / Node ${{ matrix.node }}
Expand Down
8 changes: 7 additions & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@
'-mmacosx-version-min=10.8'
, '-std=c++11'
, '-stdlib=libc++'
, '-arch x86_64'
, '-arch arm64'
]
, 'OTHER_LDFLAGS': [
'-stdlib=libc++'
, '-arch x86_64'
, '-arch arm64'
]
, 'OTHER_LDFLAGS': ['-stdlib=libc++']
, 'GCC_ENABLE_CPP_RTTI': 'YES'
, 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'
, 'MACOSX_DEPLOYMENT_TARGET': '10.8'
Expand Down
3 changes: 3 additions & 0 deletions deps/rocksdb/rocksdb.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@
, '-stdlib=libc++'
, '-fno-omit-frame-pointer'
, '-momit-leaf-frame-pointer'
, '-arch x86_64'
, '-arch arm64'
]
# , 'OTHER_LDFLAGS': ['-stdlib=libc++']
, 'GCC_ENABLE_CPP_RTTI': 'YES'
Expand Down Expand Up @@ -376,6 +378,7 @@
, 'rocksdb/util/compression_context_cache.cc'
, 'rocksdb/util/concurrent_task_limiter_impl.cc'
, 'rocksdb/util/crc32c.cc'
, 'rocksdb/util/crc32c_arm64.cc'
, 'rocksdb/util/dynamic_bloom.cc'
, 'rocksdb/util/hash.cc'
, 'rocksdb/util/murmurhash.cc'
Expand Down
4 changes: 4 additions & 0 deletions deps/snappy/snappy.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
'-Wno-sign-compare'
, '-Wno-unused-function'
]
, 'OTHER_CFLAGS': [
'-arch x86_64'
, '-arch arm64'
]
}
}]
]
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"rebuild": "npm run install --build-from-source",
"prebuild": "prebuildify -t 8.14.0 --napi --strip",
"prebuild-linux-x64": "prebuildify-cross -i centos7-devtoolset7 -i alpine -t 8.14.0 --napi --strip",
"prebuild-darwin-x64": "prebuildify -t 8.14.0 --napi --strip",
"prebuild-darwin-x64+arm64": "prebuildify -t 8.14.0 --napi --strip --arch x64+arm64",
"prebuild-win32-x64": "prebuildify -t 8.14.0 --napi --strip",
"download-prebuilds": "prebuildify-ci download",
"hallmark": "hallmark --fix",
Expand All @@ -24,7 +24,7 @@
"dependencies": {
"abstract-leveldown": "^7.0.0",
"napi-macros": "^2.0.0",
"node-gyp-build": "^4.2.3"
"node-gyp-build": "^4.3.0"
},
"devDependencies": {
"async-each": "^1.0.3",
Expand All @@ -40,7 +40,7 @@
"mkfiletree": "^2.0.0",
"node-gyp": "^7.1.2",
"nyc": "^15.0.0",
"prebuildify": "^4.1.1",
"prebuildify": "^4.2.1",
"prebuildify-ci": "^1.0.4",
"prebuildify-cross": "^4.0.1",
"readfiletree": "^1.0.0",
Expand Down