Skip to content

Commit 0522d41

Browse files
committed
build: compile with C++20 support
1 parent 6135ae3 commit 0522d41

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

common_node.gypi

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
'target_defaults': {
3+
'conditions': [
4+
# Override common.gypi config to use C++20 for Node.js core only.
5+
['OS in "linux freebsd openbsd solaris android aix os400 cloudabi"', {
6+
'cflags_cc!': ['-std=gnu++17'],
7+
'cflags_cc': ['-std=gnu++20'],
8+
}],
9+
['OS=="mac" and clang==1', {
10+
'xcode_settings': {
11+
'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++20', # -std=gnu++20
12+
},
13+
}],
14+
],
15+
},
16+
}

tools/gyp_node.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ def run_gyp(args):
2020
a_path = node_root if sys.platform == 'win32' else os.path.abspath(node_root)
2121
args.append(os.path.join(a_path, 'node.gyp'))
2222
common_fn = os.path.join(a_path, 'common.gypi')
23+
common_node_fn = os.path.join(a_path, 'common_node.gypi')
2324
options_fn = os.path.join(a_path, 'config.gypi')
2425

2526
if os.path.exists(common_fn):
2627
args.extend(['-I', common_fn])
2728

29+
if os.path.exists(common_node_fn):
30+
args.extend(['-I', common_node_fn])
31+
2832
if os.path.exists(options_fn):
2933
args.extend(['-I', options_fn])
3034

0 commit comments

Comments
 (0)