Skip to content

Commit 90bc20c

Browse files
authored
Merge pull request #5 from atom-community/Release-optimizations
2 parents fefbaf0 + 2b6943d commit 90bc20c

File tree

2 files changed

+47
-11
lines changed

2 files changed

+47
-11
lines changed

binding.gyp

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@
6767
],
6868

6969
"variables": {
70-
"tests": 0
70+
"tests": 0,
71+
"STANDARD": 17,
72+
"MACOSX_DEPLOYMENT_TARGET": "10.15"
7173
},
7274

7375
"conditions": [
@@ -100,25 +102,24 @@
100102
"conditions": [
101103
['OS=="mac"', {
102104
'cflags': [
103-
'-mmacosx-version-min=10.8'
105+
"-mmacosx-version-min=<(MACOSX_DEPLOYMENT_TARGET)"
104106
],
105107
"xcode_settings": {
106108
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
107-
'MACOSX_DEPLOYMENT_TARGET': '10.8',
109+
'MACOSX_DEPLOYMENT_TARGET': '<(MACOSX_DEPLOYMENT_TARGET)',
108110
}
109111
}]
110112
]
111113
}]
112114
}]
113115
],
114-
115116
"target_defaults": {
116-
"cflags_cc": ["-std=c++11"],
117+
"cflags_cc": [ "-std=c++<(STANDARD)" ],
117118
"conditions": [
118119
['OS=="mac"', {
119120
"xcode_settings": {
120121
'CLANG_CXX_LIBRARY': 'libc++',
121-
'CLANG_CXX_LANGUAGE_STANDARD':'c++11',
122+
'CLANG_CXX_LANGUAGE_STANDARD':'c++(STANDARD)',
122123
}
123124
}],
124125
['OS=="win"', {
@@ -129,6 +130,40 @@
129130
"NOMINMAX"
130131
],
131132
}]
132-
]
133-
}
133+
],
134+
'default_configuration': 'Release',
135+
'configurations': {
136+
# Release Settings
137+
'Release': {
138+
'defines': [ 'NDEBUG' ],
139+
"cflags": [ "-fno-exceptions", "-O3" ],
140+
"cflags_cc": [ "-fno-exceptions", "-O3", "-std=c++<(STANDARD)" ],
141+
"xcode_settings": {
142+
'GCC_OPTIMIZATION_LEVEL': '3', # stop gyp from defaulting to -Os
143+
"CLANG_CXX_LIBRARY": "libc++",
144+
"CLANG_CXX_LANGUAGE_STANDARD": "c++<(STANDARD)",
145+
'MACOSX_DEPLOYMENT_TARGET': "<(MACOSX_DEPLOYMENT_TARGET)"
146+
}, # XCODE
147+
"msvs_settings": {
148+
"VCCLCompilerTool": {
149+
'ExceptionHandling': 0, # /EHsc
150+
'MultiProcessorCompilation': 'true',
151+
'RuntimeTypeInfo': 'false',
152+
'Optimization': 3, # full optimizations /O2 == /Og /Oi /Ot /Oy /Ob2 /GF /Gy
153+
'StringPooling': 'true', # pool string literals
154+
"AdditionalOptions": [
155+
# C++ standard
156+
"/std:c++<(STANDARD)",
157+
158+
# Optimizations
159+
"/O2",
160+
# "/Ob3", # aggressive inline
161+
"/GL", # whole Program Optimization # /LTCG is implied with /GL.
162+
"/DNDEBUG" # turn off asserts
163+
],
164+
}
165+
} # MSVC
166+
}, # Release
167+
}, # configurations
168+
} # target-defaults
134169
}

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
"browser": "./browser",
77
"scripts": {
88
"build:node": "node-gyp rebuild",
9-
"build:browser": "script/build-browser-version.sh",
9+
"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",
1111
"test:native": "node ./script/test-native.js",
1212
"test:node": "mocha test/js/*.js",
13-
"test:browser": "SUPERSTRING_USE_BROWSER_VERSION=1 mocha test/js/*.js",
14-
"test": "npm run test:node && npm run test:browser",
13+
"test:browser": "cross-env SUPERSTRING_USE_BROWSER_VERSION=1 mocha test/js/*.js || echo 'the browser tests are unsupported'",
14+
"test": "npm run test:node && npm run test:native && npm run test:browser",
1515
"benchmark": "node benchmark/marker-index.benchmark.js",
1616
"prepublishOnly": "git submodule update --init --recursive && npm run build:browser",
1717
"standard": "standard --recursive src test"
@@ -35,6 +35,7 @@
3535
},
3636
"devDependencies": {
3737
"chai": "^2.0.0",
38+
"cross-env": "^7.0.3",
3839
"mocha": "^2.3.4",
3940
"random-seed": "^0.2.0",
4041
"standard": "^4.5.4",

0 commit comments

Comments
 (0)