Skip to content

Commit

Permalink
fix: use correct c++ version on OSX for Node.js 20+ (#32)
Browse files Browse the repository at this point in the history
For some reason this is not an issue on Linux, so as to avoid a breaking
change, only use C++17 on OS X if the Node.js version is at least v20.
  • Loading branch information
mmarchini authored Aug 15, 2023
1 parent 0724941 commit 969efb4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
node-version: [16, 18, 20]
steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ on:
jobs:
build:
if: ${{ github.repository == 'Netflix-Skunkworks/spectator-js-nodejsmetrics' }}
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
node-version: [16, 18, 20]
steps:
- uses: actions/checkout@v2
Expand Down
10 changes: 9 additions & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{
'variables': {
'osx_cpp_version': "14",
'conditions': [
[ 'OS=="mac" and node_module_version >= 115', {
'osx_cpp_version': "17"
}]
]
},
'targets': [
{
'target_name': 'spectator_internals',
Expand All @@ -10,7 +18,7 @@
'conditions': [
[ 'OS=="mac"', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS' : ['-stdlib=libc++', '-v', '-std=c++14', '-Wall', '-Wextra', '-Wno-unused-parameter', '-g', '-O2' ],
'OTHER_CPLUSPLUSFLAGS' : ['-stdlib=libc++', '-v', '-std=c++<(osx_cpp_version)', '-Wall', '-Wextra', '-Wno-unused-parameter', '-g', '-O2' ],
'OTHER_LDFLAGS': ['-stdlib=libc++'],
'MACOSX_DEPLOYMENT_TARGET': '10.12',
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO'
Expand Down

0 comments on commit 969efb4

Please sign in to comment.