File tree Expand file tree Collapse file tree 2 files changed +30
-4
lines changed
generate/templates/templates Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Original file line number Diff line number Diff line change 11{
22 "variables" : {
3+ "variables" : {
4+ "target%" : "none" ,
5+ },
36 "is_electron%" : "<!(node ./utils/isBuildingForElectron.js <(node_root_dir))" ,
47 "is_IBMi%" : "<!(node -p \" os.platform() == 'aix' && os.type() == 'OS400' ? 1 : 0\" )" ,
58 "electron_openssl_root%" : "<!(node ./utils/getElectronOpenSSLRoot.js <(module_root_dir))" ,
69 "electron_openssl_static%" : "<!(node -p \" process.platform !== 'linux' || process.env.NODEGIT_OPENSSL_STATIC_LINK === '1' ? 1 : 0\" )" ,
10+ "cxx_version%" : "<!(node ./utils/defaultCxxStandard.js <(target))" ,
11+ "has_cxxflags%" : "<!(node -p \" process.env.CXXFLAGS ? 1 : 0\" )" ,
712 "macOS_deployment_target" : "10.11"
813 },
914
122127 "GCC_ENABLE_CPP_EXCEPTIONS" : "YES" ,
123128 "MACOSX_DEPLOYMENT_TARGET" : "<(macOS_deployment_target)" ,
124129 'CLANG_CXX_LIBRARY' : 'libc++' ,
125- 'CLANG_CXX_LANGUAGE_STANDARD' :'c++14 ' ,
130+ 'CLANG_CXX_LANGUAGE_STANDARD' :'c++<(cxx_version) ' ,
126131
127132 "WARNING_CFLAGS" : [
128133 "-Wno-unused-variable" ,
150155 "msvs_settings" : {
151156 "VCCLCompilerTool" : {
152157 "AdditionalOptions" : [
158+ "/std:c++<(cxx_version)" ,
153159 "/EHsc"
154160 ]
155161 },
172178 ]
173179 }],
174180 ["OS=='linux' or OS.endswith('bsd') or <(is_IBMi) == 1" , {
175- "cflags" : [
176- "-std=c++14"
177- ],
178181 "conditions" : [
182+ ["<(has_cxxflags) == 0" , {
183+ "cflags_cc" : [
184+ "-std=c++<(cxx_version)"
185+ ],
186+ }],
179187 ["<(is_electron) == 1 and <(electron_openssl_static) == 1" , {
180188 "include_dirs" : [
181189 "<(electron_openssl_root)/include"
Original file line number Diff line number Diff line change 1+ const targetSpecified = process . argv [ 2 ] !== 'none' ;
2+
3+ let isNode18OrElectron20AndUp = false ;
4+ if ( targetSpecified ) {
5+ // Assume electron if target is specified.
6+ // If building node 18 / 19 via target, will need to specify C++ standard manually
7+ const majorVersion = process . argv [ 2 ] . split ( '.' ) [ 0 ] ;
8+ isNode18OrElectron20AndUp = majorVersion >= 20 ;
9+ } else {
10+ // Node 18 === 108
11+ isNode18OrElectron20AndUp = Number . parseInt ( process . versions . modules ) >= 108 ;
12+ }
13+
14+ const defaultCxxStandard = isNode18OrElectron20AndUp
15+ ? '17'
16+ : '14' ;
17+
18+ process . stdout . write ( defaultCxxStandard ) ;
You can’t perform that action at this time.
0 commit comments