OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
2 # for details. All rights reserved. Use of this source code is governed by a | |
3 # BSD-style license that can be found in the LICENSE file. | |
4 | |
5 config("libdart_vm_config") { | |
6 libs = [ | |
7 "pthread", | |
8 "rt", | |
9 "dl", | |
10 ] | |
11 } | |
12 | |
13 | |
14 static_library("libdart_platform") { | |
15 configs += ["../..:dart_config"] | |
16 public_configs = [":libdart_vm_config"] | |
17 | |
18 platform_headers_gypi = | |
19 exec_script("../../tools/gypi_to_gn.py", | |
20 [rebase_path("../platform/platform_headers.gypi")], | |
21 "scope", | |
22 ["../platform/platform_headers.gypi"]) | |
23 platform_headers = | |
24 rebase_path(platform_headers_gypi.sources, ".", "../platform") | |
25 | |
26 platform_sources_gypi = | |
27 exec_script("../../tools/gypi_to_gn.py", | |
28 [rebase_path("../platform/platform_sources.gypi")], | |
29 "scope", | |
30 ["../platform/platform_sources.gypi"]) | |
31 platform_sources = | |
32 rebase_path(platform_sources_gypi.sources, ".", "../platform") | |
33 | |
34 sources = platform_headers + platform_sources | |
35 include_dirs = [ | |
36 "..", | |
37 ] | |
38 } | |
39 | |
40 | |
41 static_library("libdart_vm") { | |
42 configs += ["../..:dart_config"] | |
43 public_configs = [":libdart_vm_config"] | |
44 deps = [ ":generate_service_cc_file", ] | |
45 | |
46 vm_sources_list = exec_script("../../tools/gypi_to_gn.py", | |
47 [rebase_path("vm_sources.gypi")], | |
48 "scope", | |
49 ["vm_sources.gypi"]) | |
50 | |
51 set_sources_assignment_filter(["*_test.cc", "*_test.h"]) | |
52 sources = vm_sources_list.sources | |
53 + ["$target_gen_dir/service_gen.cc",] | |
54 - ["vtune.cc", "vtune.h"] | |
55 include_dirs = [ | |
56 "..", | |
57 ] | |
58 } | |
59 | |
60 | |
61 template("generate_library_source") { | |
62 assert(defined(invoker.libname), "Need libname in $target_name") | |
63 assert(defined(invoker.filename), "Need a filename in $target_name") | |
64 assert(defined(invoker.kind), "Need kind in $target_name") | |
65 assert(defined(invoker.output), "Need output in $target_name") | |
66 action(target_name) { | |
67 visibility = [ ":*" ] # Only targets in this file can see this. | |
68 libname = invoker.libname | |
69 filename = invoker.filename | |
70 kind = invoker.kind | |
71 | |
72 if (kind == "source") { | |
73 path = "../../sdk/lib/${filename}" | |
74 } else { | |
75 path = "../lib" | |
76 } | |
77 | |
78 lib_sources_gypi = | |
79 exec_script("../../tools/gypi_to_gn.py", | |
80 [rebase_path("${path}/${filename}_sources.gypi")], | |
81 "scope", | |
82 ["${path}/${filename}_sources.gypi"]) | |
83 lib_sources = | |
84 rebase_path(lib_sources_gypi.sources, ".", path) | |
85 | |
86 script = "../tools/gen_library_src_paths.py" | |
87 inputs = [ | |
88 "../tools/gen_library_src_paths.py", | |
89 "../lib/libgen_in.cc", | |
90 ] | |
91 outputs = [ invoker.output, ] | |
92 args = [ | |
93 "--output", rebase_path(invoker.output, root_build_dir), | |
94 "--input_cc", rebase_path("../lib/libgen_in.cc", root_build_dir), | |
95 "--include", "vm/bootstrap.h", | |
96 "--var_name", "dart::Bootstrap::${libname}_${kind}_paths_", | |
97 "--library_name", "dart:${libname}",] + | |
98 rebase_path(lib_sources, root_build_dir) | |
99 } | |
100 } | |
101 | |
102 | |
103 # This templates expects invoker.sources to be a list of pairs of strings. | |
104 # The pairs of strings mean the following. | |
105 # library name, file name | |
106 # e.g. for the "internal" library named "dart:_internal", | |
107 # with sources listed at sdk/lib/internal/internal_sources.gypi and | |
108 # lib/internal_sources.gypi, we have: ["_internal", "internal"] | |
109 # | |
110 # The template iterates over the list, and generates generate_library_source | |
111 # actions for each. After that, it generates targets to compile the generated so urces | |
Ivan Posva
2014/11/11 18:26:23
Long line.
zra
2014/11/11 22:03:34
Done.
| |
112 # to make libdart_lib_withcore and libdart_lib. | |
113 template("generate_core_libraries") { | |
114 assert(defined(invoker.sources), "Need sources in $target_name") | |
115 liboutputs = [] | |
116 libsources = [] | |
117 libdeps = [] | |
118 foreach(lib, invoker.sources) { | |
119 libname = lib[0] | |
120 filename = lib[1] | |
121 generate_library_source("generate_${filename}_cc_file") { | |
122 libname = libname | |
123 filename = filename | |
124 kind = "source" | |
125 output = "$target_gen_dir/${filename}_gen.cc" | |
126 } | |
127 generate_library_source("generate_${filename}_patch_cc_file") { | |
128 libname = libname | |
129 filename = filename | |
130 kind = "patch" | |
131 output = "$target_gen_dir/${filename}_patch_gen.cc" | |
132 } | |
133 lib_sources_gypi = | |
134 exec_script("../../tools/gypi_to_gn.py", | |
135 [rebase_path("../lib/${filename}_sources.gypi")], | |
136 "scope", | |
137 ["../lib/${filename}_sources.gypi"]) | |
138 libsources += rebase_path(lib_sources_gypi.sources, ".", "../lib") | |
139 liboutputs += ["$target_gen_dir/${filename}_gen.cc", | |
140 "$target_gen_dir/${filename}_patch_gen.cc"] | |
141 libdeps += [":generate_${filename}_cc_file", | |
142 ":generate_${filename}_patch_cc_file"] | |
143 } | |
144 | |
145 static_library("libdart_lib_withcore") { | |
146 configs += ["../..:dart_config"] | |
147 deps = libdeps | |
148 sources = libsources + ["bootstrap.cc"] + liboutputs | |
149 include_dirs = [ | |
150 "..", | |
151 ] | |
152 } | |
153 static_library("libdart_lib") { | |
154 configs += ["../..:dart_config"] | |
155 sources = libsources + [ "bootstrap_nocore.cc", ] | |
156 include_dirs = [ | |
157 "..", | |
158 ] | |
159 } | |
160 } | |
161 | |
162 | |
163 generate_core_libraries("core_libraries") { | |
164 sources = [ | |
165 ["async", "async"], | |
166 ["core", "core"], | |
167 ["collection", "collection"], | |
168 ["convert", "convert"], | |
169 ["_internal", "internal"], | |
170 ["isolate", "isolate"], | |
171 ["math", "math"], | |
172 ["mirrors", "mirrors"], | |
173 ["typed_data", "typed_data"], | |
174 ["profiler", "profiler"], | |
175 ] | |
176 } | |
177 | |
178 | |
179 action("generate_service_cc_file") { | |
Ivan Posva
2014/11/11 18:26:23
ditto.
Are these needed without the VM service av
zra
2014/11/11 22:03:34
vm/service.cc refers to the symbols in the generat
| |
180 visibility = [ ":*" ] # Only targets in this file can see this. | |
181 script = "../tools/create_resources.py" | |
182 sources = [ | |
183 "service/client.dart", | |
184 "service/constants.dart", | |
185 "service/message.dart", | |
186 "service/message_router.dart", | |
187 "service/running_isolate.dart", | |
188 "service/running_isolates.dart", | |
189 "service/vmservice.dart", | |
190 ] | |
191 | |
192 output = "$target_gen_dir/service_gen.cc" | |
193 outputs = [ output, ] | |
194 | |
195 args = [ | |
196 "--output", rebase_path(output, root_build_dir), | |
197 "--outer_namespace", "dart", | |
198 "--table_name", "service", | |
199 "--root_prefix", rebase_path("service/", root_build_dir)] + | |
200 rebase_path(sources, root_build_dir) | |
201 } | |
OLD | NEW |