Skip to content

Commit 4cd73cf

Browse files
committed
tools: refactor v8_pch config
Avoid repetition by defining a new GYP target.
1 parent 7ce2232 commit 4cd73cf

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
{
@@ -745,16 +755,9 @@
745755
'v8_internal_headers',
746756
'v8_libbase',
747757
'v8_shared_internal_headers',
758+
'v8_pch',
748759
],
749760
'conditions': [
750-
['OS=="win"', {
751-
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
752-
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
753-
'sources': [
754-
'<(_msvs_precompiled_header)',
755-
'<(_msvs_precompiled_source)',
756-
],
757-
}],
758761
['v8_enable_turbofan==1', {
759762
'dependencies': ['v8_compiler_sources'],
760763
}, {
@@ -775,21 +778,14 @@
775778
'v8_libbase',
776779
'v8_shared_internal_headers',
777780
'v8_turboshaft',
781+
'v8_pch',
778782
],
779783
'conditions': [
780784
['v8_enable_turbofan==1', {
781785
'dependencies': ['v8_compiler_sources'],
782786
}, {
783787
'sources': ['<(V8_ROOT)/src/compiler/turbofan-disabled.cc'],
784788
}],
785-
['OS=="win"', {
786-
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
787-
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
788-
'sources': [
789-
'<(_msvs_precompiled_header)',
790-
'<(_msvs_precompiled_source)',
791-
],
792-
}],
793789
],
794790
}, # v8_compiler
795791
{
@@ -804,20 +800,11 @@
804800
'v8_base_without_compiler',
805801
'v8_libbase',
806802
'v8_shared_internal_headers',
803+
'v8_pch',
807804
],
808805
'sources': [
809806
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_source_set.\\"v8_turboshaft.*?sources = ")',
810807
],
811-
'conditions': [
812-
['OS=="win"', {
813-
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
814-
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
815-
'sources': [
816-
'<(_msvs_precompiled_header)',
817-
'<(_msvs_precompiled_source)',
818-
],
819-
}],
820-
],
821808
}, # v8_turboshaft
822809
{
823810
'target_name': 'v8_compiler_for_mksnapshot',
@@ -865,6 +852,7 @@
865852
'v8_internal_headers',
866853
'v8_maybe_icu',
867854
'v8_zlib',
855+
'v8_pch',
868856
],
869857
'includes': ['inspector.gypi'],
870858
'direct_dependent_settings': {
@@ -1022,12 +1010,6 @@
10221010
],
10231011
}],
10241012
['OS=="win"', {
1025-
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
1026-
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
1027-
'sources': [
1028-
'<(_msvs_precompiled_header)',
1029-
'<(_msvs_precompiled_source)',
1030-
],
10311013
# This will prevent V8's .cc files conflicting with the inspector's
10321014
# .cpp files in the same shard.
10331015
'msvs_settings': {
@@ -1539,6 +1521,7 @@
15391521
'v8_libplatform',
15401522
'v8_maybe_icu',
15411523
'v8_turboshaft',
1524+
'v8_pch',
15421525
# "build/win:default_exe_manifest",
15431526
],
15441527
'sources': [
@@ -1548,14 +1531,6 @@
15481531
['want_separate_host_toolset', {
15491532
'toolsets': ['host'],
15501533
}],
1551-
['OS=="win"', {
1552-
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
1553-
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
1554-
'sources': [
1555-
'<(_msvs_precompiled_header)',
1556-
'<(_msvs_precompiled_source)',
1557-
],
1558-
}],
15591534
],
15601535
}, # mksnapshot
15611536
{

0 commit comments

Comments
 (0)