Skip to content

Commit

Permalink
build: shrink bloated addon binaries on windows
Browse files Browse the repository at this point in the history
PR-URL: #2060
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
  • Loading branch information
codebytere authored and rvagg committed Mar 13, 2020
1 parent ca86ef2 commit e18a61a
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion addon.gypi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
'variables' : {
'node_engine_include_dir%': 'deps/v8/include',
'node_host_binary%': 'node'
'node_host_binary%': 'node',
'node_with_ltcg%': 'true',
},
'target_defaults': {
'type': 'loadable_module',
Expand Down Expand Up @@ -126,6 +127,26 @@
'library_dirs': [ '<(node_root_dir)/$(ConfigurationName)' ],
'libraries': [ '<@(node_engine_libs)' ],
}],
['node_with_ltcg=="true"', {
'msvs_settings': {
'VCCLCompilerTool': {
'WholeProgramOptimization': 'true' # /GL, whole program optimization, needed for LTCG
},
'VCLibrarianTool': {
'AdditionalOptions': [
'/LTCG:INCREMENTAL', # incremental link-time code generation
]
},
'VCLinkerTool': {
'OptimizeReferences': 2, # /OPT:REF
'EnableCOMDATFolding': 2, # /OPT:ICF
'LinkIncremental': 1, # disable incremental linking
'AdditionalOptions': [
'/LTCG:INCREMENTAL', # incremental link-time code generation
]
}
}
}]
],
'libraries': [
'-lkernel32.lib',
Expand Down

0 comments on commit e18a61a

Please sign in to comment.