File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change 11const targetSpecified = process . argv [ 2 ] !== 'none' ;
22
3- let isNode18OrElectron20AndUp = false ;
3+ let cxxStandard = '14' ;
4+
45if ( targetSpecified ) {
56 // Assume electron if target is specified.
67 // If building node 18 / 19 via target, will need to specify C++ standard manually
78 const majorVersion = process . argv [ 2 ] . split ( '.' ) [ 0 ] ;
8- isNode18OrElectron20AndUp = majorVersion >= 20 ;
9+ if ( Number . parseInt ( majorVersion ) >= 32 ) {
10+ cxxStandard = '20' ;
11+ } else if ( Number . parseInt ( majorVersion ) >= 21 ) {
12+ cxxStandard = '17' ;
13+ }
914} else {
15+ const abiVersion = Number . parseInt ( process . versions . modules ) ?? 0 ;
1016 // Node 18 === 108
11- isNode18OrElectron20AndUp = Number . parseInt ( process . versions . modules ) >= 108 ;
17+ if ( abiVersion >= 131 ) {
18+ cxxStandard = '20' ;
19+ } else if ( abiVersion >= 108 ) {
20+ cxxStandard = '17' ;
21+ }
1222}
1323
14- const defaultCxxStandard = isNode18OrElectron20AndUp
15- ? '17'
16- : '14' ;
17-
18- process . stdout . write ( defaultCxxStandard ) ;
24+ process . stdout . write ( cxxStandard ) ;
You can’t perform that action at this time.
0 commit comments