Skip to content

Commit a6b6334

Browse files
committed
fix: move the standard options to the target defaults
1 parent 66cce2c commit a6b6334

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

binding.gyp

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
{
2+
"variables": {
3+
"tests": 0,
4+
"STANDARD": 17,
5+
"MACOSX_DEPLOYMENT_TARGET": "10.15"
6+
},
7+
28
"targets": [
39
{
410
"target_name": "superstring",
@@ -66,12 +72,6 @@
6672
}
6773
],
6874

69-
"variables": {
70-
"tests": 0,
71-
"STANDARD": 17,
72-
"MACOSX_DEPLOYMENT_TARGET": "10.15"
73-
},
74-
7575
"conditions": [
7676
# If --tests is passed to node-gyp configure, we'll build a standalone
7777
# executable that runs tests on the patch.
@@ -117,7 +117,9 @@
117117
['OS=="mac"', {
118118
"xcode_settings": {
119119
'CLANG_CXX_LIBRARY': 'libc++',
120-
'CLANG_CXX_LANGUAGE_STANDARD':'c++(STANDARD)',
120+
'CLANG_CXX_LANGUAGE_STANDARD':'c++<(STANDARD)',
121+
"CLANG_CXX_LIBRARY": "libc++",
122+
'MACOSX_DEPLOYMENT_TARGET': "<(MACOSX_DEPLOYMENT_TARGET)"
121123
}
122124
}],
123125
['OS=="win"', {
@@ -127,6 +129,16 @@
127129
"defines": [
128130
"NOMINMAX"
129131
],
132+
"msvs_settings": {
133+
"VCCLCompilerTool": {
134+
'ExceptionHandling': 0, # /EHsc
135+
'MultiProcessorCompilation': 'true',
136+
"AdditionalOptions": [
137+
# C++ standard
138+
"/std:c++<(STANDARD)",
139+
]
140+
}
141+
}
130142
}]
131143
],
132144
'default_configuration': 'Release',
@@ -135,24 +147,16 @@
135147
'Release': {
136148
'defines': [ 'NDEBUG' ],
137149
"cflags": [ "-fno-exceptions", "-O3" ],
138-
"cflags_cc": [ "-fno-exceptions", "-O3", "-std=c++<(STANDARD)" ],
150+
"cflags_cc": [ "-fno-exceptions", "-O3" ],
139151
"xcode_settings": {
140152
'GCC_OPTIMIZATION_LEVEL': '3', # stop gyp from defaulting to -Os
141-
"CLANG_CXX_LIBRARY": "libc++",
142-
"CLANG_CXX_LANGUAGE_STANDARD": "c++<(STANDARD)",
143-
'MACOSX_DEPLOYMENT_TARGET': "<(MACOSX_DEPLOYMENT_TARGET)"
144153
}, # XCODE
145154
"msvs_settings": {
146155
"VCCLCompilerTool": {
147-
'ExceptionHandling': 0, # /EHsc
148-
'MultiProcessorCompilation': 'true',
149156
'RuntimeTypeInfo': 'false',
150157
'Optimization': 3, # full optimizations /O2 == /Og /Oi /Ot /Oy /Ob2 /GF /Gy
151158
'StringPooling': 'true', # pool string literals
152159
"AdditionalOptions": [
153-
# C++ standard
154-
"/std:c++<(STANDARD)",
155-
156160
# Optimizations
157161
"/O2",
158162
# "/Ob3", # aggressive inline

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"build:node": "node-gyp rebuild",
99
"build:browser": "bash -c script/build-browser-version.sh || echo 'the browser build is unsupported'",
1010
"build": "npm run build:node && npm run build:browser",
11-
"test:native": "node-gyp build --debug --tests && node script/test-native.js",
11+
"test:native": "node-gyp rebuild --debug --tests && node script/test-native.js",
1212
"test:node": "mocha test/js/*.js",
1313
"test:browser": "cross-env SUPERSTRING_USE_BROWSER_VERSION=1 mocha test/js/*.js || echo 'the browser tests are unsupported'",
1414
"test": "npm run test:node && npm run test:native && npm run test:browser",

0 commit comments

Comments
 (0)