Skip to content
Closed
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
build: compile with C++20 support
  • Loading branch information
targos committed May 5, 2024
commit d3f9303fe64a62072eb8e934c98fea2800b473b1
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ endif
with-code-cache test-code-cache:
$(warning '$@' target is a noop)

out/Makefile: config.gypi common.gypi node.gyp \
out/Makefile: config.gypi common.gypi common_node.gypi node.gyp \
deps/uv/uv.gyp deps/llhttp/llhttp.gyp deps/zlib/zlib.gyp \
deps/simdutf/simdutf.gyp deps/ada/ada.gyp \
tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \
Expand Down
16 changes: 16 additions & 0 deletions common_node.gypi
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
'target_defaults': {
'conditions': [
# Override common.gypi config to use C++20 for Node.js core only.
['OS in "linux freebsd openbsd solaris android aix os400 cloudabi"', {
'cflags_cc!': ['-std=gnu++17'],
'cflags_cc': ['-std=gnu++20'],
}],
['OS=="mac" and clang==1', {
'xcode_settings': {
'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++20', # -std=gnu++20
},
}],
],
},
}
2 changes: 2 additions & 0 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@
'<@(deps_files)',
# node.gyp is added by default, common.gypi is added for change detection
'common.gypi',
'common_node.gypi',
],

'variables': {
Expand Down Expand Up @@ -1347,6 +1348,7 @@
'<@(library_files)',
'<@(deps_files)',
'common.gypi',
'common_node.gypi',
],
'direct_dependent_settings': {
'ldflags': [ '-Wl,-brtl' ],
Expand Down
1 change: 1 addition & 0 deletions tools/create_android_makefiles
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export GYP_DEFINES

./deps/npm/node_modules/node-gyp/gyp/gyp \
-Icommon.gypi \
-Icommon_node.gypi \
-Iconfig.gypi \
--depth=. \
-Dcomponent=static_library \
Expand Down
4 changes: 4 additions & 0 deletions tools/gyp_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ def run_gyp(args):
a_path = node_root if sys.platform == 'win32' else os.path.abspath(node_root)
args.append(os.path.join(a_path, 'node.gyp'))
common_fn = os.path.join(a_path, 'common.gypi')
common_node_fn = os.path.join(a_path, 'common_node.gypi')
options_fn = os.path.join(a_path, 'config.gypi')

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

if os.path.exists(common_node_fn):
args.extend(['-I', common_node_fn])

if os.path.exists(options_fn):
args.extend(['-I', options_fn])

Expand Down