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 1
1
{
2
2
"variables" : {
3
+ "variables" : {
4
+ "target%" : "none" ,
5
+ },
3
6
"is_electron%" : "<!(node ./utils/isBuildingForElectron.js <(node_root_dir))" ,
4
7
"is_IBMi%" : "<!(node -p \" os.platform() == 'aix' && os.type() == 'OS400' ? 1 : 0\" )" ,
5
8
"electron_openssl_root%" : "<!(node ./utils/getElectronOpenSSLRoot.js <(module_root_dir))" ,
6
9
"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\" )" ,
7
12
"macOS_deployment_target" : "10.11"
8
13
},
9
14
122
127
"GCC_ENABLE_CPP_EXCEPTIONS" : "YES" ,
123
128
"MACOSX_DEPLOYMENT_TARGET" : "<(macOS_deployment_target)" ,
124
129
'CLANG_CXX_LIBRARY' : 'libc++' ,
125
- 'CLANG_CXX_LANGUAGE_STANDARD' :'c++14 ' ,
130
+ 'CLANG_CXX_LANGUAGE_STANDARD' :'c++<(cxx_version) ' ,
126
131
127
132
"WARNING_CFLAGS" : [
128
133
"-Wno-unused-variable" ,
150
155
"msvs_settings" : {
151
156
"VCCLCompilerTool" : {
152
157
"AdditionalOptions" : [
158
+ "/std:c++<(cxx_version)" ,
153
159
"/EHsc"
154
160
]
155
161
},
172
178
]
173
179
}],
174
180
["OS=='linux' or OS.endswith('bsd') or <(is_IBMi) == 1" , {
175
- "cflags" : [
176
- "-std=c++14"
177
- ],
178
181
"conditions" : [
182
+ ["<(has_cxxflags) == 0" , {
183
+ "cflags_cc" : [
184
+ "-std=c++<(cxx_version)"
185
+ ],
186
+ }],
179
187
["<(is_electron) == 1 and <(electron_openssl_static) == 1" , {
180
188
"include_dirs" : [
181
189
"<(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