Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build,win: configuration tweaks for faster build with MSVC #25931

Merged
merged 7 commits into from
Feb 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 35 additions & 92 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
'node_use_bundled_v8%': 'true',
'node_module_version%': '',
'node_with_ltcg%': '',
'node_use_pch%': 'false',
'node_shared_openssl%': 'false',

'node_tag%': '',
Expand All @@ -38,7 +37,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.11',
'v8_embedder_string': '-node.13',

##### V8 defaults for Node.js #####

Expand Down Expand Up @@ -137,13 +136,17 @@
'Debug': {
'variables': {
'v8_enable_handle_zapping': 1,
'conditions': [
['node_shared != "true"', {
'MSVC_runtimeType': 1, # MultiThreadedDebug (/MTd)
}, {
'MSVC_runtimeType': 3, # MultiThreadedDebugDLL (/MDd)
}],
],
},
'defines': [ 'DEBUG', '_DEBUG', 'V8_ENABLE_CHECKS' ],
'cflags': [ '-g', '-O0' ],
'conditions': [
['target_arch=="x64"', {
'msvs_configuration_platform': 'x64',
}],
['OS=="aix"', {
'cflags': [ '-gxcoff' ],
'ldflags': [ '-Wl,-bbigtoc' ],
Expand All @@ -152,31 +155,14 @@
'cflags': [ '-fPIE' ],
'ldflags': [ '-fPIE', '-pie' ]
}],
['node_shared=="true"', {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 3, # MultiThreadedDebugDLL (/MDd)
}
}
}],
['node_shared=="false"', {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 1 # MultiThreadedDebug (/MTd)
}
}
}]
],
'msvs_settings': {
'VCCLCompilerTool': {
'Optimization': 0, # /Od, no optimization
'BasicRuntimeChecks': 3, # /RTC1
'MinimalRebuild': 'false',
'OmitFramePointers': 'false',
'BasicRuntimeChecks': 3, # /RTC1
'MultiProcessorCompilation': 'true',
'AdditionalOptions': [
'/bigobj', # prevent error C1128 in VS2015
],
'Optimization': 0, # /Od, no optimization
'RuntimeLibrary': '<(MSVC_runtimeType)',
},
'VCLinkerTool': {
'LinkIncremental': 2, # enable incremental linking
Expand All @@ -189,12 +175,19 @@
'Release': {
'variables': {
'v8_enable_handle_zapping': 0,
'pgo_generate': ' -fprofile-generate ',
'pgo_use': ' -fprofile-use -fprofile-correction ',
'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ',
'conditions': [
['node_shared != "true"', {
'MSVC_runtimeType': 0 # MultiThreaded (/MT)
}, {
'MSVC_runtimeType': 2 # MultiThreadedDLL (/MD)
}],
],
},
'cflags': [ '-O3' ],
'conditions': [
['target_arch=="x64"', {
'msvs_configuration_platform': 'x64',
}],
['OS=="solaris"', {
# pull in V8's postmortem metadata
'ldflags': [ '-Wl,-z,allextract' ]
Expand All @@ -203,11 +196,6 @@
'cflags': [ '-fno-omit-frame-pointer' ],
}],
['OS=="linux"', {
'variables': {
'pgo_generate': ' -fprofile-generate ',
'pgo_use': ' -fprofile-use -fprofile-correction ',
'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ',
},
'conditions': [
['enable_pgo_generate=="true"', {
'cflags': ['<(pgo_generate)'],
Expand All @@ -227,62 +215,17 @@
'cflags': [ '-fPIE' ],
'ldflags': [ '-fPIE', '-pie' ]
}],
['node_shared=="true"', {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 2 # MultiThreadedDLL (/MD)
}
}
}],
['node_shared=="false"', {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 0 # MultiThreaded (/MT)
}
}
}],
['node_with_ltcg=="true"', {
'msvs_settings': {
'VCCLCompilerTool': {
'WholeProgramOptimization': 'true' # /GL, whole program optimization, needed for LTCG
},
'VCLibrarianTool': {
'AdditionalOptions': [
'/LTCG: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
]
}
}
}, {
'msvs_settings': {
'VCCLCompilerTool': {
'WholeProgramOptimization': 'false'
},
'VCLinkerTool': {
'LinkIncremental': 2 # enable incremental linking
}
}
}]
],
'msvs_settings': {
'VCCLCompilerTool': {
'Optimization': 3, # /Ox, full optimization
'FavorSizeOrSpeed': 1, # /Ot, favor speed over size
'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
'OmitFramePointers': 'true',
'EnableFunctionLevelLinking': 'true',
'EnableIntrinsicFunctions': 'true',
'FavorSizeOrSpeed': 1, # /Ot, favor speed over size
'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
'OmitFramePointers': 'true',
'Optimization': 3, # /Ox, full optimization
'RuntimeLibrary': '<(MSVC_runtimeType)',
'RuntimeTypeInfo': 'false',
'MultiProcessorCompilation': 'true',
'AdditionalOptions': [
],
}
}
}
Expand All @@ -301,13 +244,14 @@
'cflags!': ['-Werror'],
'msvs_settings': {
'VCCLCompilerTool': {
'StringPooling': 'true', # pool string literals
'DebugInformationFormat': 1, # /Z7 embed info in .obj files
'WarningLevel': 3,
'BufferSecurityCheck': 'true',
'DebugInformationFormat': 1, # /Z7 embed info in .obj files
'ExceptionHandling': 0, # /EHsc
'MultiProcessorCompilation': 'true',
'StringPooling': 'true', # pool string literals
'SuppressStartupBanner': 'true',
'WarnAsError': 'false',
'WarningLevel': 3, # /W3
},
'VCLinkerTool': {
'conditions': [
Expand All @@ -329,11 +273,6 @@
}],
],
'GenerateDebugInformation': 'true',
'GenerateMapFile': 'true', # /MAP
'MapExports': 'true', # /MAPINFO:EXPORTS
'RandomizedBaseAddress': 2, # enable ASLR
'DataExecutionPrevention': 2, # enable DEP
'AllowIsolation': 'true',
'SuppressStartupBanner': 'true',
},
},
Expand All @@ -351,7 +290,12 @@
# - "C4244: conversion from 'type1' to 'type2', possible loss of data"
# Ususaly safe. Disable for `dep`, enable for `src`
'msvs_disabled_warnings': [4351, 4355, 4800, 4251, 4275, 4244, 4267],
'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin

'conditions': [
[ 'target_arch=="x64"', {
'msvs_configuration_platform': 'x64',
}],
['asan == 1 and OS != "mac"', {
'cflags+': [
'-fno-omit-frame-pointer',
Expand Down Expand Up @@ -380,7 +324,6 @@
],
}],
['OS == "win"', {
'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
'defines': [
'WIN32',
# we don't really want VC++ warning us about
Expand Down
10 changes: 0 additions & 10 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,6 @@
dest='with_ltcg',
help='Use Link Time Code Generation. This feature is only available on Windows.')

parser.add_option('--with-pch',
action='store_true',
dest='with_pch',
help='Use Precompiled Headers (only available on Windows).')

intl_optgroup.add_option('--download',
action='store',
dest='download_list',
Expand Down Expand Up @@ -1070,11 +1065,6 @@ def configure_node(o):
if flavor != 'win' and options.with_ltcg:
raise Exception('Link Time Code Generation is only supported on Windows.')

if flavor == 'win':
o['variables']['node_use_pch'] = b(options.with_pch)
else:
o['variables']['node_use_pch'] = 'false'

if options.tag:
o['variables']['node_tag'] = '-' + options.tag
else:
Expand Down
93 changes: 28 additions & 65 deletions deps/v8/gypfiles/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
'dependencies': [
'v8_base',
],
'variables': {
'variables': {
'optimize': 'max',
},
'include_dirs': [
Expand Down Expand Up @@ -359,16 +359,20 @@
}],
# Platforms that don't have Compare-And-Swap support need to link atomic
# library to implement atomic memory access
[ 'v8_current_cpu == "mips" or v8_current_cpu == "mipsel" or '
'v8_current_cpu == "mips64" or v8_current_cpu == "mips64el" or '
'v8_current_cpu == "ppc" or v8_current_cpu == "ppc64" or '
'v8_current_cpu == "s390" or v8_current_cpu == "s390x"',
{
[ 'v8_current_cpu in ["mips", "mipsel", "mips64", "mips64el", "ppc", "ppc64", "s390", "s390x"]', {
'link_settings': {
'libraries': [ '-latomic', ],
},
},
],
['OS=="win"', {
'msvs_precompiled_header': '../../../tools/msvs/pch/v8_pch.h',
'msvs_precompiled_source': '../../../tools/msvs/pch/v8_pch.cc',
'sources': [
'<(_msvs_precompiled_header)',
'<(_msvs_precompiled_source)',
],
}],
],
}, # v8_initializers
{
Expand Down Expand Up @@ -1931,23 +1935,12 @@
],
}],
['OS=="win"', {
'variables': {
'gyp_generators': '<!(echo $GYP_GENERATORS)',
},
'msvs_disabled_warnings': [4351, 4355, 4800],
'conditions': [
['node_use_pch!="true"', {
# When building Official, the .lib is too large and exceeds the 2G
# limit. This breaks it into multiple pieces to avoid the limit.
# See http://crbug.com/485155.
'msvs_shard': 4,
}, {
'msvs_precompiled_header': 'tools/msvs/pch/pch_v8_base.h',
'msvs_precompiled_source': '../../../tools/msvs/pch/pch_v8_base.cc',
'sources': [
'../../../tools/msvs/pch/pch_v8_base.cc',
],
}],
'msvs_precompiled_header': '../../../tools/msvs/pch/v8_pch.h',
'msvs_precompiled_source': '../../../tools/msvs/pch/v8_pch.cc',
'sources': [
'<(_msvs_precompiled_header)',
'<(_msvs_precompiled_source)',
],
# This will prevent V8's .cc files conflicting with the inspector's
# .cpp files in the same shard.
Expand Down Expand Up @@ -2243,50 +2236,20 @@
'defines': [
'_CRT_RAND_S' # for rand_s()
],
'variables': {
'gyp_generators': '<!(echo $GYP_GENERATORS)',
},
'conditions': [
['gyp_generators=="make"', {
'variables': {
'build_env': '<!(uname -o)',
},
'conditions': [
['build_env=="Cygwin"', {
'sources': [
'../src/base/debug/stack_trace_posix.cc',
'../src/base/platform/platform-cygwin.cc',
'../src/base/platform/platform-posix.cc',
'../src/base/platform/platform-posix.h',
],
}, {
'sources': [
'../src/base/debug/stack_trace_win.cc',
'../src/base/platform/platform-win32.cc',
'../src/base/win32-headers.h',
],
}],
],
'link_settings': {
'libraries': [ '-lwinmm', '-lws2_32' ],
},
}, {
'sources': [
'../src/base/debug/stack_trace_win.cc',
'../src/base/platform/platform-win32.cc',
'../src/base/win32-headers.h',
],
'msvs_disabled_warnings': [4351, 4355, 4800],
'link_settings': {
'libraries': [
'-ldbghelp.lib',
'-lshlwapi.lib',
'-lwinmm.lib',
'-lws2_32.lib'
],
},
}],
'sources': [
'../src/base/debug/stack_trace_win.cc',
'../src/base/platform/platform-win32.cc',
'../src/base/win32-headers.h',
],
'msvs_disabled_warnings': [4351, 4355, 4800],
'link_settings': {
'libraries': [
'-ldbghelp.lib',
'-lshlwapi.lib',
'-lwinmm.lib',
'-lws2_32.lib'
],
},
}],
['OS=="qnx"', {
'link_settings': {
Expand Down
Loading