From 3521f8abd8e3ae3f1c22e01b107f57cde20641c6 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Fri, 26 Oct 2018 08:40:16 -0400 Subject: [PATCH] build,win: limit LTCG only to the main `node` tagert --- common.gypi | 10 ---------- node.gyp | 24 ++++++++++++++++++++++-- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/common.gypi b/common.gypi index bd91033dbbd3df..c0cb5f4c2d9c91 100644 --- a/common.gypi +++ b/common.gypi @@ -151,9 +151,6 @@ 'OmitFramePointers': 'false', 'BasicRuntimeChecks': 3, # /RTC1 'MultiProcessorCompilation': 'true', - 'AdditionalOptions': [ - '/bigobj', # prevent error C1128 in VS2015 - ], }, 'VCLinkerTool': { 'LinkIncremental': 2, # enable incremental linking @@ -229,12 +226,7 @@ ] }, 'VCLinkerTool': { - 'OptimizeReferences': 2, # /OPT:REF - 'EnableCOMDATFolding': 2, # /OPT:ICF 'LinkIncremental': 1, # disable incremental linking - 'AdditionalOptions': [ - '/LTCG:INCREMENTAL', # incremental link-time code generation - ] } } }, { @@ -258,8 +250,6 @@ 'EnableIntrinsicFunctions': 'true', 'RuntimeTypeInfo': 'false', 'MultiProcessorCompilation': 'true', - 'AdditionalOptions': [ - ], } } } diff --git a/node.gyp b/node.gyp index 6c5be4fe67f0f4..dbd8b8a8d5eafb 100644 --- a/node.gyp +++ b/node.gyp @@ -244,9 +244,29 @@ ], # - "C4244: conversion from 'type1' to 'type2', possible loss of data" - # Ususaly safe. Disable for `dep`, enable for `src` + # Disabled for `/deps/`, so re-enable for `/src/`. 'msvs_disabled_warnings!': [4244], - + 'configurations': { + 'Release': { + 'msvs_settings': { + 'conditions': [ + ['node_with_ltcg=="true"', { + 'VCLinkerTool': { + 'OptimizeReferences': 2, # /OPT:REF + 'EnableCOMDATFolding': 2, # /OPT:ICF + 'AdditionalOptions': [ + '/LTCG:INCREMENTAL', # incremental link-time code generation + ] + } + }, { + 'VCLinkerTool': { + 'LinkIncremental': 2 # enable incremental linking + }, + }], + ] + }, + }, + }, 'conditions': [ [ 'node_intermediate_lib_type=="static_library" and node_shared=="true" and OS=="aix"', { # For AIX, shared lib is linked by static lib and .exp. In the