Skip to content

Commit d81151e

Browse files
authored
tools: refactor v8_pch config
Avoid repetition by defining a new GYP target. PR-URL: #47364 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent 7f6f17e commit d81151e

File tree

1 file changed

+23
-48
lines changed

1 file changed

+23
-48
lines changed

tools/v8_gypfiles/v8.gyp

+23-48
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,23 @@
4343
},
4444
},
4545
'targets': [
46+
{
47+
'target_name': 'v8_pch',
48+
'type': 'none',
49+
'toolsets': ['host', 'target'],
50+
'conditions': [
51+
['OS=="win"', {
52+
'direct_dependent_settings': {
53+
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
54+
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
55+
'sources': [
56+
'<(_msvs_precompiled_header)',
57+
'<(_msvs_precompiled_source)',
58+
],
59+
},
60+
}],
61+
],
62+
}, # v8_pch
4663
{
4764
'target_name': 'run_torque',
4865
'type': 'none',
@@ -244,6 +261,7 @@
244261
'torque_generated_initializers',
245262
'v8_base_without_compiler',
246263
'v8_shared_internal_headers',
264+
'v8_pch',
247265
],
248266
'include_dirs': [
249267
'<(SHARED_INTERMEDIATE_DIR)',
@@ -318,14 +336,6 @@
318336
'<(V8_ROOT)/src/builtins/builtins-intl-gen.cc',
319337
],
320338
}],
321-
['OS=="win"', {
322-
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
323-
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
324-
'sources': [
325-
'<(_msvs_precompiled_header)',
326-
'<(_msvs_precompiled_source)',
327-
],
328-
}],
329339
],
330340
}, # v8_initializers
331341
{
@@ -750,16 +760,9 @@
750760
'v8_internal_headers',
751761
'v8_libbase',
752762
'v8_shared_internal_headers',
763+
'v8_pch',
753764
],
754765
'conditions': [
755-
['OS=="win"', {
756-
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
757-
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
758-
'sources': [
759-
'<(_msvs_precompiled_header)',
760-
'<(_msvs_precompiled_source)',
761-
],
762-
}],
763766
['v8_enable_turbofan==1', {
764767
'dependencies': ['v8_compiler_sources'],
765768
}, {
@@ -780,21 +783,14 @@
780783
'v8_libbase',
781784
'v8_shared_internal_headers',
782785
'v8_turboshaft',
786+
'v8_pch',
783787
],
784788
'conditions': [
785789
['v8_enable_turbofan==1', {
786790
'dependencies': ['v8_compiler_sources'],
787791
}, {
788792
'sources': ['<(V8_ROOT)/src/compiler/turbofan-disabled.cc'],
789793
}],
790-
['OS=="win"', {
791-
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
792-
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
793-
'sources': [
794-
'<(_msvs_precompiled_header)',
795-
'<(_msvs_precompiled_source)',
796-
],
797-
}],
798794
],
799795
}, # v8_compiler
800796
{
@@ -809,20 +805,11 @@
809805
'v8_base_without_compiler',
810806
'v8_libbase',
811807
'v8_shared_internal_headers',
808+
'v8_pch',
812809
],
813810
'sources': [
814811
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_source_set.\\"v8_turboshaft.*?sources = ")',
815812
],
816-
'conditions': [
817-
['OS=="win"', {
818-
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
819-
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
820-
'sources': [
821-
'<(_msvs_precompiled_header)',
822-
'<(_msvs_precompiled_source)',
823-
],
824-
}],
825-
],
826813
}, # v8_turboshaft
827814
{
828815
'target_name': 'v8_compiler_for_mksnapshot',
@@ -870,6 +857,7 @@
870857
'v8_internal_headers',
871858
'v8_maybe_icu',
872859
'v8_zlib',
860+
'v8_pch',
873861
],
874862
'includes': ['inspector.gypi'],
875863
'direct_dependent_settings': {
@@ -1027,12 +1015,6 @@
10271015
],
10281016
}],
10291017
['OS=="win"', {
1030-
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
1031-
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
1032-
'sources': [
1033-
'<(_msvs_precompiled_header)',
1034-
'<(_msvs_precompiled_source)',
1035-
],
10361018
# This will prevent V8's .cc files conflicting with the inspector's
10371019
# .cpp files in the same shard.
10381020
'msvs_settings': {
@@ -1548,6 +1530,7 @@
15481530
'v8_libplatform',
15491531
'v8_maybe_icu',
15501532
'v8_turboshaft',
1533+
'v8_pch',
15511534
# "build/win:default_exe_manifest",
15521535
],
15531536
'sources': [
@@ -1557,14 +1540,6 @@
15571540
['want_separate_host_toolset', {
15581541
'toolsets': ['host'],
15591542
}],
1560-
['OS=="win"', {
1561-
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
1562-
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
1563-
'sources': [
1564-
'<(_msvs_precompiled_header)',
1565-
'<(_msvs_precompiled_source)',
1566-
],
1567-
}],
15681543
# Avoid excessive LTO
15691544
['enable_lto=="true"', {
15701545
'ldflags': [ '-fno-lto' ],

0 commit comments

Comments
 (0)