Skip to content

Commit e18a61a

Browse files
codebyterervagg
authored andcommitted
build: shrink bloated addon binaries on windows
PR-URL: #2060 Reviewed-By: Bartosz Sosnowski <[email protected]>
1 parent ca86ef2 commit e18a61a

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

addon.gypi

+22-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
'variables' : {
33
'node_engine_include_dir%': 'deps/v8/include',
4-
'node_host_binary%': 'node'
4+
'node_host_binary%': 'node',
5+
'node_with_ltcg%': 'true',
56
},
67
'target_defaults': {
78
'type': 'loadable_module',
@@ -126,6 +127,26 @@
126127
'library_dirs': [ '<(node_root_dir)/$(ConfigurationName)' ],
127128
'libraries': [ '<@(node_engine_libs)' ],
128129
}],
130+
['node_with_ltcg=="true"', {
131+
'msvs_settings': {
132+
'VCCLCompilerTool': {
133+
'WholeProgramOptimization': 'true' # /GL, whole program optimization, needed for LTCG
134+
},
135+
'VCLibrarianTool': {
136+
'AdditionalOptions': [
137+
'/LTCG:INCREMENTAL', # incremental link-time code generation
138+
]
139+
},
140+
'VCLinkerTool': {
141+
'OptimizeReferences': 2, # /OPT:REF
142+
'EnableCOMDATFolding': 2, # /OPT:ICF
143+
'LinkIncremental': 1, # disable incremental linking
144+
'AdditionalOptions': [
145+
'/LTCG:INCREMENTAL', # incremental link-time code generation
146+
]
147+
}
148+
}
149+
}]
129150
],
130151
'libraries': [
131152
'-lkernel32.lib',

0 commit comments

Comments
 (0)