tools: refactor v8_pch config

Avoid repetition by defining a new GYP target.

PR-URL: https://github.com/nodejs/node/pull/47364
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
Michaël Zasso 2023-05-28 14:01:50 +02:00 committed by GitHub
parent 7f6f17efbf
commit d81151e100
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,6 +43,23 @@
},
},
'targets': [
{
'target_name': 'v8_pch',
'type': 'none',
'toolsets': ['host', 'target'],
'conditions': [
['OS=="win"', {
'direct_dependent_settings': {
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
'sources': [
'<(_msvs_precompiled_header)',
'<(_msvs_precompiled_source)',
],
},
}],
],
}, # v8_pch
{
'target_name': 'run_torque',
'type': 'none',
@ -244,6 +261,7 @@
'torque_generated_initializers',
'v8_base_without_compiler',
'v8_shared_internal_headers',
'v8_pch',
],
'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)',
@ -318,14 +336,6 @@
'<(V8_ROOT)/src/builtins/builtins-intl-gen.cc',
],
}],
['OS=="win"', {
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
'sources': [
'<(_msvs_precompiled_header)',
'<(_msvs_precompiled_source)',
],
}],
],
}, # v8_initializers
{
@ -750,16 +760,9 @@
'v8_internal_headers',
'v8_libbase',
'v8_shared_internal_headers',
'v8_pch',
],
'conditions': [
['OS=="win"', {
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
'sources': [
'<(_msvs_precompiled_header)',
'<(_msvs_precompiled_source)',
],
}],
['v8_enable_turbofan==1', {
'dependencies': ['v8_compiler_sources'],
}, {
@ -780,6 +783,7 @@
'v8_libbase',
'v8_shared_internal_headers',
'v8_turboshaft',
'v8_pch',
],
'conditions': [
['v8_enable_turbofan==1', {
@ -787,14 +791,6 @@
}, {
'sources': ['<(V8_ROOT)/src/compiler/turbofan-disabled.cc'],
}],
['OS=="win"', {
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
'sources': [
'<(_msvs_precompiled_header)',
'<(_msvs_precompiled_source)',
],
}],
],
}, # v8_compiler
{
@ -809,20 +805,11 @@
'v8_base_without_compiler',
'v8_libbase',
'v8_shared_internal_headers',
'v8_pch',
],
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_source_set.\\"v8_turboshaft.*?sources = ")',
],
'conditions': [
['OS=="win"', {
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
'sources': [
'<(_msvs_precompiled_header)',
'<(_msvs_precompiled_source)',
],
}],
],
}, # v8_turboshaft
{
'target_name': 'v8_compiler_for_mksnapshot',
@ -870,6 +857,7 @@
'v8_internal_headers',
'v8_maybe_icu',
'v8_zlib',
'v8_pch',
],
'includes': ['inspector.gypi'],
'direct_dependent_settings': {
@ -1027,12 +1015,6 @@
],
}],
['OS=="win"', {
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
'msvs_precompiled_source': '<(V8_ROOT)/../../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.
'msvs_settings': {
@ -1548,6 +1530,7 @@
'v8_libplatform',
'v8_maybe_icu',
'v8_turboshaft',
'v8_pch',
# "build/win:default_exe_manifest",
],
'sources': [
@ -1557,14 +1540,6 @@
['want_separate_host_toolset', {
'toolsets': ['host'],
}],
['OS=="win"', {
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
'sources': [
'<(_msvs_precompiled_header)',
'<(_msvs_precompiled_source)',
],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],