Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: BUILD.gn

Issue 1966933003: [gn] Refactoring - share common code in source sets (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixesz Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import("//build/config/android/config.gni") 5 import("//build/config/android/config.gni")
6 import("//build/config/arm.gni") 6 import("//build/config/arm.gni")
7 import("//build/config/mips.gni") 7 import("//build/config/mips.gni")
8 import("//build/config/sanitizers/sanitizers.gni") 8 import("//build/config/sanitizers/sanitizers.gni")
9 9
10 if (is_android) { 10 if (is_android) {
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 "DEBUG", 301 "DEBUG",
302 "TRACE_MAPS", 302 "TRACE_MAPS",
303 ] 303 ]
304 if (!v8_optimized_debug) { 304 if (!v8_optimized_debug) {
305 defines += [ "ENABLE_SLOW_DCHECKS" ] 305 defines += [ "ENABLE_SLOW_DCHECKS" ]
306 } 306 }
307 } 307 }
308 } 308 }
309 309
310 ############################################################################### 310 ###############################################################################
311 # Templates
312 #
313
314 template("v8_source_set") {
315 source_set(target_name) {
316 forward_variables_from(invoker, "*", ["configs"])
317 configs += invoker.configs
318 configs -= [ "//build/config/compiler:chromium_code" ]
319 configs += [ "//build/config/compiler:no_chromium_code" ]
320 configs += [
321 ":features",
322 ":toolchain",
323 ]
324
325 if (!is_debug || v8_optimized_debug) {
326 configs -= [ "//build/config/compiler:default_optimization" ]
327 configs += [ "//build/config/compiler:optimize_max" ]
328 }
329 }
330 }
331
332 ###############################################################################
311 # Actions 333 # Actions
312 # 334 #
313 335
314 action("js2c") { 336 action("js2c") {
315 visibility = [ ":*" ] # Only targets in this file can depend on this. 337 visibility = [ ":*" ] # Only targets in this file can depend on this.
316 338
317 script = "tools/js2c.py" 339 script = "tools/js2c.py"
318 340
319 # The script depends on this other script, this rule causes a rebuild if it 341 # The script depends on this other script, this rule causes a rebuild if it
320 # changes. 342 # changes.
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 "--startup_blob", 626 "--startup_blob",
605 rebase_path("$root_out_dir/snapshot_blob.bin", root_build_dir), 627 rebase_path("$root_out_dir/snapshot_blob.bin", root_build_dir),
606 ] 628 ]
607 } 629 }
608 } 630 }
609 631
610 ############################################################################### 632 ###############################################################################
611 # Source Sets (aka static libraries) 633 # Source Sets (aka static libraries)
612 # 634 #
613 635
614 source_set("v8_nosnapshot") { 636 v8_source_set("v8_nosnapshot") {
615 visibility = [ ":*" ] # Only targets in this file can depend on this. 637 visibility = [ ":*" ] # Only targets in this file can depend on this.
616 638
617 deps = [ 639 deps = [
618 ":js2c", 640 ":js2c",
619 ":js2c_experimental", 641 ":js2c_experimental",
620 ":js2c_experimental_extras", 642 ":js2c_experimental_extras",
621 ":js2c_extras", 643 ":js2c_extras",
622 ":v8_base", 644 ":v8_base",
623 ] 645 ]
624 646
625 sources = [ 647 sources = [
626 "$target_gen_dir/experimental-extras-libraries.cc", 648 "$target_gen_dir/experimental-extras-libraries.cc",
627 "$target_gen_dir/experimental-libraries.cc", 649 "$target_gen_dir/experimental-libraries.cc",
628 "$target_gen_dir/extras-libraries.cc", 650 "$target_gen_dir/extras-libraries.cc",
629 "$target_gen_dir/libraries.cc", 651 "$target_gen_dir/libraries.cc",
630 "src/snapshot/snapshot-empty.cc", 652 "src/snapshot/snapshot-empty.cc",
631 ] 653 ]
632 654
633 configs -= [ "//build/config/compiler:chromium_code" ] 655 configs = [
634 configs += [ "//build/config/compiler:no_chromium_code" ]
635 configs += [
636 ":internal_config", 656 ":internal_config",
637 ":features",
638 ":toolchain",
639 ] 657 ]
640 if (!is_debug || v8_optimized_debug) {
641 configs -= [ "//build/config/compiler:default_optimization" ]
642 configs += [ "//build/config/compiler:optimize_max" ]
643 }
644 } 658 }
645 659
646 source_set("v8_snapshot") { 660 v8_source_set("v8_snapshot") {
647 # Only targets in this file and the top-level visibility target can 661 # Only targets in this file and the top-level visibility target can
648 # depend on this. 662 # depend on this.
649 visibility = [ 663 visibility = [
650 ":*", 664 ":*",
651 "//:gn_visibility", 665 "//:gn_visibility",
652 ] 666 ]
653 667
654 deps = [ 668 deps = [
655 ":js2c", 669 ":js2c",
656 ":js2c_experimental", 670 ":js2c_experimental",
657 ":js2c_experimental_extras", 671 ":js2c_experimental_extras",
658 ":js2c_extras", 672 ":js2c_extras",
659 ":v8_base", 673 ":v8_base",
660 ] 674 ]
661 public_deps = [ 675 public_deps = [
662 # This should be public so downstream targets can declare the snapshot 676 # This should be public so downstream targets can declare the snapshot
663 # output file as their inputs. 677 # output file as their inputs.
664 ":run_mksnapshot", 678 ":run_mksnapshot",
665 ] 679 ]
666 680
667 sources = [ 681 sources = [
668 "$target_gen_dir/experimental-extras-libraries.cc", 682 "$target_gen_dir/experimental-extras-libraries.cc",
669 "$target_gen_dir/experimental-libraries.cc", 683 "$target_gen_dir/experimental-libraries.cc",
670 "$target_gen_dir/extras-libraries.cc", 684 "$target_gen_dir/extras-libraries.cc",
671 "$target_gen_dir/libraries.cc", 685 "$target_gen_dir/libraries.cc",
672 "$target_gen_dir/snapshot.cc", 686 "$target_gen_dir/snapshot.cc",
673 ] 687 ]
674 688
675 configs -= [ "//build/config/compiler:chromium_code" ] 689 configs = [
676 configs += [ "//build/config/compiler:no_chromium_code" ]
677 configs += [
678 ":internal_config", 690 ":internal_config",
679 ":features",
680 ":toolchain",
681 ] 691 ]
682 if (!is_debug || v8_optimized_debug) {
683 configs -= [ "//build/config/compiler:default_optimization" ]
684 configs += [ "//build/config/compiler:optimize_max" ]
685 }
686 } 692 }
687 693
688 if (v8_use_external_startup_data) { 694 if (v8_use_external_startup_data) {
689 source_set("v8_external_snapshot") { 695 v8_source_set("v8_external_snapshot") {
690 visibility = [ ":*" ] # Only targets in this file can depend on this. 696 visibility = [ ":*" ] # Only targets in this file can depend on this.
691 697
692 deps = [ 698 deps = [
693 ":js2c", 699 ":js2c",
694 ":js2c_experimental", 700 ":js2c_experimental",
695 ":js2c_experimental_extras", 701 ":js2c_experimental_extras",
696 ":js2c_extras", 702 ":js2c_extras",
697 ":v8_base", 703 ":v8_base",
698 ] 704 ]
699 public_deps = [ 705 public_deps = [
700 ":natives_blob", 706 ":natives_blob",
701 ":run_mksnapshot", 707 ":run_mksnapshot",
702 ] 708 ]
703 709
704 sources = [ 710 sources = [
705 "src/snapshot/natives-external.cc", 711 "src/snapshot/natives-external.cc",
706 "src/snapshot/snapshot-external.cc", 712 "src/snapshot/snapshot-external.cc",
707 ] 713 ]
708 714
709 configs -= [ "//build/config/compiler:chromium_code" ] 715 configs = [
710 configs += [ "//build/config/compiler:no_chromium_code" ]
711 configs += [
712 ":internal_config", 716 ":internal_config",
713 ":features",
714 ":toolchain",
715 ] 717 ]
716 if (!is_debug || v8_optimized_debug) {
717 configs -= [ "//build/config/compiler:default_optimization" ]
718 configs += [ "//build/config/compiler:optimize_max" ]
719 }
720 } 718 }
721 } 719 }
722 720
723 source_set("v8_base") { 721 v8_source_set("v8_base") {
724 visibility = [ ":*" ] # Only targets in this file can depend on this. 722 visibility = [ ":*" ] # Only targets in this file can depend on this.
725 723
726 sources = [ 724 sources = [
727 # TODO(fmeawad): This needs to be updated to support standalone V8 builds. 725 # TODO(fmeawad): This needs to be updated to support standalone V8 builds.
728 "../base/trace_event/common/trace_event_common.h", 726 "../base/trace_event/common/trace_event_common.h",
729 "include/v8-debug.h", 727 "include/v8-debug.h",
730 "include/v8-experimental.h", 728 "include/v8-experimental.h",
731 "include/v8-platform.h", 729 "include/v8-platform.h",
732 "include/v8-profiler.h", 730 "include/v8-profiler.h",
733 "include/v8-testing.h", 731 "include/v8-testing.h",
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 "src/s390/frames-s390.cc", 1792 "src/s390/frames-s390.cc",
1795 "src/s390/frames-s390.h", 1793 "src/s390/frames-s390.h",
1796 "src/s390/interface-descriptors-s390.cc", 1794 "src/s390/interface-descriptors-s390.cc",
1797 "src/s390/macro-assembler-s390.cc", 1795 "src/s390/macro-assembler-s390.cc",
1798 "src/s390/macro-assembler-s390.h", 1796 "src/s390/macro-assembler-s390.h",
1799 "src/s390/simulator-s390.cc", 1797 "src/s390/simulator-s390.cc",
1800 "src/s390/simulator-s390.h", 1798 "src/s390/simulator-s390.h",
1801 ] 1799 ]
1802 } 1800 }
1803 1801
1804 configs -= [ "//build/config/compiler:chromium_code" ] 1802 configs = [
1805 configs += [ "//build/config/compiler:no_chromium_code" ]
1806 configs += [
1807 ":internal_config", 1803 ":internal_config",
1808 ":features",
1809 ":toolchain",
1810 ] 1804 ]
1811 1805
1812 if (!is_debug || v8_optimized_debug) {
1813 configs -= [ "//build/config/compiler:default_optimization" ]
1814 configs += [ "//build/config/compiler:optimize_max" ]
1815 }
1816
1817 defines = [] 1806 defines = []
1818 deps = [ 1807 deps = [
1819 ":v8_libbase", 1808 ":v8_libbase",
1820 ] 1809 ]
1821 1810
1822 if (is_win) { 1811 if (is_win) {
1823 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. 1812 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
1824 cflags = [ "/wd4267" ] 1813 cflags = [ "/wd4267" ]
1825 } 1814 }
1826 1815
(...skipping 11 matching lines...) Expand all
1838 "src/i18n.h", 1827 "src/i18n.h",
1839 ] 1828 ]
1840 } 1829 }
1841 1830
1842 if (v8_postmortem_support) { 1831 if (v8_postmortem_support) {
1843 sources += [ "$target_gen_dir/debug-support.cc" ] 1832 sources += [ "$target_gen_dir/debug-support.cc" ]
1844 deps += [ ":postmortem-metadata" ] 1833 deps += [ ":postmortem-metadata" ]
1845 } 1834 }
1846 } 1835 }
1847 1836
1848 source_set("v8_libbase") { 1837 v8_source_set("v8_libbase") {
1849 visibility = [ ":*" ] # Only targets in this file can depend on this. 1838 visibility = [ ":*" ] # Only targets in this file can depend on this.
1850 1839
1851 sources = [ 1840 sources = [
1852 "src/base/accounting-allocator.cc", 1841 "src/base/accounting-allocator.cc",
1853 "src/base/accounting-allocator.h", 1842 "src/base/accounting-allocator.h",
1854 "src/base/adapters.h", 1843 "src/base/adapters.h",
1855 "src/base/atomic-utils.h", 1844 "src/base/atomic-utils.h",
1856 "src/base/atomicops.h", 1845 "src/base/atomicops.h",
1857 "src/base/atomicops_internals_arm64_gcc.h", 1846 "src/base/atomicops_internals_arm64_gcc.h",
1858 "src/base/atomicops_internals_arm_gcc.h", 1847 "src/base/atomicops_internals_arm_gcc.h",
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1898 "src/base/safe_conversions_impl.h", 1887 "src/base/safe_conversions_impl.h",
1899 "src/base/safe_math.h", 1888 "src/base/safe_math.h",
1900 "src/base/safe_math_impl.h", 1889 "src/base/safe_math_impl.h",
1901 "src/base/smart-pointers.h", 1890 "src/base/smart-pointers.h",
1902 "src/base/sys-info.cc", 1891 "src/base/sys-info.cc",
1903 "src/base/sys-info.h", 1892 "src/base/sys-info.h",
1904 "src/base/utils/random-number-generator.cc", 1893 "src/base/utils/random-number-generator.cc",
1905 "src/base/utils/random-number-generator.h", 1894 "src/base/utils/random-number-generator.h",
1906 ] 1895 ]
1907 1896
1908 configs -= [ "//build/config/compiler:chromium_code" ] 1897 configs = [
1909 configs += [ "//build/config/compiler:no_chromium_code" ]
1910 configs += [
1911 ":internal_config_base", 1898 ":internal_config_base",
1912 ":features",
1913 ":toolchain",
1914 ] 1899 ]
1915 1900
1916 if (!is_debug || v8_optimized_debug) {
1917 configs -= [ "//build/config/compiler:default_optimization" ]
1918 configs += [ "//build/config/compiler:optimize_max" ]
1919 }
1920
1921 defines = [] 1901 defines = []
1922 1902
1923 if (is_posix) { 1903 if (is_posix) {
1924 sources += [ "src/base/platform/platform-posix.cc" ] 1904 sources += [ "src/base/platform/platform-posix.cc" ]
1925 } 1905 }
1926 1906
1927 if (is_linux) { 1907 if (is_linux) {
1928 sources += [ "src/base/platform/platform-linux.cc" ] 1908 sources += [ "src/base/platform/platform-linux.cc" ]
1929 1909
1930 libs = [ 1910 libs = [
(...skipping 27 matching lines...) Expand all
1958 1938
1959 libs = [ 1939 libs = [
1960 "winmm.lib", 1940 "winmm.lib",
1961 "ws2_32.lib", 1941 "ws2_32.lib",
1962 ] 1942 ]
1963 } 1943 }
1964 1944
1965 # TODO(jochen): Add support for qnx, freebsd, openbsd, netbsd, and solaris. 1945 # TODO(jochen): Add support for qnx, freebsd, openbsd, netbsd, and solaris.
1966 } 1946 }
1967 1947
1968 source_set("v8_libplatform") { 1948 v8_source_set("v8_libplatform") {
1969 sources = [ 1949 sources = [
1970 "include/libplatform/libplatform.h", 1950 "include/libplatform/libplatform.h",
1971 "src/libplatform/default-platform.cc", 1951 "src/libplatform/default-platform.cc",
1972 "src/libplatform/default-platform.h", 1952 "src/libplatform/default-platform.h",
1973 "src/libplatform/task-queue.cc", 1953 "src/libplatform/task-queue.cc",
1974 "src/libplatform/task-queue.h", 1954 "src/libplatform/task-queue.h",
1975 "src/libplatform/worker-thread.cc", 1955 "src/libplatform/worker-thread.cc",
1976 "src/libplatform/worker-thread.h", 1956 "src/libplatform/worker-thread.h",
1977 ] 1957 ]
1978 1958
1979 configs -= [ "//build/config/compiler:chromium_code" ] 1959 configs = [
1980 configs += [ "//build/config/compiler:no_chromium_code" ]
1981 configs += [
1982 ":internal_config_base", 1960 ":internal_config_base",
1983 ":features",
1984 ":toolchain",
1985 ] 1961 ]
1986 1962
1987 if (!is_debug || v8_optimized_debug) {
1988 configs -= [ "//build/config/compiler:default_optimization" ]
1989 configs += [ "//build/config/compiler:optimize_max" ]
1990 }
1991
1992 deps = [ 1963 deps = [
1993 ":v8_libbase", 1964 ":v8_libbase",
1994 ] 1965 ]
1995 } 1966 }
1996 1967
1997 source_set("fuzzer_support") { 1968 v8_source_set("fuzzer_support") {
1998 visibility = [ ":*" ] # Only targets in this file can depend on this. 1969 visibility = [ ":*" ] # Only targets in this file can depend on this.
1999 1970
2000 sources = [ 1971 sources = [
2001 "test/fuzzer/fuzzer-support.cc", 1972 "test/fuzzer/fuzzer-support.cc",
2002 "test/fuzzer/fuzzer-support.h", 1973 "test/fuzzer/fuzzer-support.h",
2003 ] 1974 ]
2004 1975
2005 configs -= [ "//build/config/compiler:chromium_code" ] 1976 configs = [
2006 configs += [ "//build/config/compiler:no_chromium_code" ]
2007 configs += [
2008 ":internal_config_base", 1977 ":internal_config_base",
2009 ":libplatform_config", 1978 ":libplatform_config",
2010 ":features",
2011 ":toolchain",
2012 ] 1979 ]
2013 1980
2014 deps = [ 1981 deps = [
2015 ":v8_libplatform", 1982 ":v8_libplatform",
2016 snapshot_target, 1983 snapshot_target,
2017 ] 1984 ]
2018 } 1985 }
2019 1986
2020 ############################################################################### 1987 ###############################################################################
2021 # Executables 1988 # Executables
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
2156 "//build/config/sanitizers:deps", 2123 "//build/config/sanitizers:deps",
2157 "//build/win:default_exe_manifest", 2124 "//build/win:default_exe_manifest",
2158 ] 2125 ]
2159 2126
2160 if (v8_enable_i18n_support) { 2127 if (v8_enable_i18n_support) {
2161 deps += [ "//third_party/icu" ] 2128 deps += [ "//third_party/icu" ]
2162 } 2129 }
2163 } 2130 }
2164 } 2131 }
2165 2132
2166 source_set("json_fuzzer") { 2133 v8_source_set("json_fuzzer") {
2167 sources = [ 2134 sources = [
2168 "test/fuzzer/json.cc", 2135 "test/fuzzer/json.cc",
2169 ] 2136 ]
2170 2137
2171 deps = [ 2138 deps = [
2172 ":fuzzer_support", 2139 ":fuzzer_support",
2173 ] 2140 ]
2174 2141
2175 configs -= [ "//build/config/compiler:chromium_code" ] 2142 configs = [
2176 configs += [ "//build/config/compiler:no_chromium_code" ]
2177 configs += [
2178 ":internal_config", 2143 ":internal_config",
2179 ":libplatform_config", 2144 ":libplatform_config",
2180 ":features",
2181 ":toolchain",
2182 ] 2145 ]
2183 } 2146 }
2184 2147
2185 source_set("parser_fuzzer") { 2148 v8_source_set("parser_fuzzer") {
2186 sources = [ 2149 sources = [
2187 "test/fuzzer/parser.cc", 2150 "test/fuzzer/parser.cc",
2188 ] 2151 ]
2189 2152
2190 deps = [ 2153 deps = [
2191 ":fuzzer_support", 2154 ":fuzzer_support",
2192 ] 2155 ]
2193 2156
2194 configs -= [ "//build/config/compiler:chromium_code" ] 2157 configs = [
2195 configs += [ "//build/config/compiler:no_chromium_code" ]
2196 configs += [
2197 ":internal_config", 2158 ":internal_config",
2198 ":libplatform_config", 2159 ":libplatform_config",
2199 ":features",
2200 ":toolchain",
2201 ] 2160 ]
2202 } 2161 }
2203 2162
2204 source_set("regexp_fuzzer") { 2163 v8_source_set("regexp_fuzzer") {
2205 sources = [ 2164 sources = [
2206 "test/fuzzer/regexp.cc", 2165 "test/fuzzer/regexp.cc",
2207 ] 2166 ]
2208 2167
2209 deps = [ 2168 deps = [
2210 ":fuzzer_support", 2169 ":fuzzer_support",
2211 ] 2170 ]
2212 2171
2213 configs -= [ "//build/config/compiler:chromium_code" ] 2172 configs = [
2214 configs += [ "//build/config/compiler:no_chromium_code" ]
2215 configs += [
2216 ":internal_config", 2173 ":internal_config",
2217 ":libplatform_config", 2174 ":libplatform_config",
2218 ":features",
2219 ":toolchain",
2220 ] 2175 ]
2221 } 2176 }
2222 2177
2223 source_set("wasm_fuzzer") { 2178 v8_source_set("wasm_fuzzer") {
2224 sources = [ 2179 sources = [
2225 "test/fuzzer/wasm.cc", 2180 "test/fuzzer/wasm.cc",
2226 ] 2181 ]
2227 2182
2228 deps = [ 2183 deps = [
2229 ":fuzzer_support", 2184 ":fuzzer_support",
2230 ] 2185 ]
2231 2186
2232 configs -= [ "//build/config/compiler:chromium_code" ] 2187 configs = [
2233 configs += [ "//build/config/compiler:no_chromium_code" ]
2234 configs += [
2235 ":internal_config", 2188 ":internal_config",
2236 ":libplatform_config", 2189 ":libplatform_config",
2237 ":features",
2238 ":toolchain",
2239 ] 2190 ]
2240 } 2191 }
2241 2192
2242 source_set("wasm_asmjs_fuzzer") { 2193 v8_source_set("wasm_asmjs_fuzzer") {
2243 sources = [ 2194 sources = [
2244 "test/fuzzer/wasm-asmjs.cc", 2195 "test/fuzzer/wasm-asmjs.cc",
2245 ] 2196 ]
2246 2197
2247 deps = [ 2198 deps = [
2248 ":fuzzer_support", 2199 ":fuzzer_support",
2249 ] 2200 ]
2250 2201
2251 configs -= [ "//build/config/compiler:chromium_code" ] 2202 configs = [
2252 configs += [ "//build/config/compiler:no_chromium_code" ]
2253 configs += [
2254 ":internal_config", 2203 ":internal_config",
2255 ":libplatform_config", 2204 ":libplatform_config",
2256 ":features",
2257 ":toolchain",
2258 ] 2205 ]
2259 } 2206 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698