Skip to content

Commit

Permalink
tools: refactor v8_pch config
Browse files Browse the repository at this point in the history
Avoid repetition by defining a new GYP target.

PR-URL: #47364
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
  • Loading branch information
targos committed May 30, 2023
1 parent 13e95e2 commit 568a705
Showing 1 changed file with 23 additions and 48 deletions.
71 changes: 23 additions & 48 deletions tools/v8_gypfiles/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -244,6 +261,7 @@
'torque_generated_initializers',
'v8_base_without_compiler',
'v8_shared_internal_headers',
'v8_pch',
],
'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)',
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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'],
}, {
Expand All @@ -780,21 +783,14 @@
'v8_libbase',
'v8_shared_internal_headers',
'v8_turboshaft',
'v8_pch',
],
'conditions': [
['v8_enable_turbofan==1', {
'dependencies': ['v8_compiler_sources'],
}, {
'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
{
Expand All @@ -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',
Expand Down Expand Up @@ -870,6 +857,7 @@
'v8_internal_headers',
'v8_maybe_icu',
'v8_zlib',
'v8_pch',
],
'includes': ['inspector.gypi'],
'direct_dependent_settings': {
Expand Down Expand Up @@ -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': {
Expand Down Expand Up @@ -1548,6 +1530,7 @@
'v8_libplatform',
'v8_maybe_icu',
'v8_turboshaft',
'v8_pch',
# "build/win:default_exe_manifest",
],
'sources': [
Expand All @@ -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' ],
Expand Down

0 comments on commit 568a705

Please sign in to comment.