OLD | NEW |
| (Empty) |
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 | |
3 # found in the LICENSE file. | |
4 | |
5 import("../public/mojo_sdk.gni") | |
6 | |
7 # A mojo_edk_source_set is a mojo_sdk_source_set that does not restrict | |
8 # external dependencies and understands the following additional variables, all | |
9 # of which admit a list of the relevant elements specified relative to the | |
10 # location of the Mojo EDK: | |
11 # mojo_edk_configs | |
12 # allow_circular_mojo_edk_includes_from | |
13 # mojo_edk_public_deps | |
14 # mojo_edk_deps | |
15 | |
16 # Note that it is assumed that the Mojo EDK is a sibling of the Mojo SDK in a | |
17 # client repo; the distinctions made above are for the sake of clarity in | |
18 # writing targets. | |
19 template("mojo_edk_source_set") { | |
20 mojo_sdk_source_set(target_name) { | |
21 restrict_external_deps = false | |
22 | |
23 if (defined(invoker.visibility)) { | |
24 visibility = invoker.visibility | |
25 } | |
26 if (defined(invoker.mojo_edk_visibility)) { | |
27 mojo_sdk_visibility = invoker.mojo_edk_visibility | |
28 } | |
29 if (defined(invoker.testonly)) { | |
30 testonly = invoker.testonly | |
31 } | |
32 if (defined(invoker.sources)) { | |
33 sources = invoker.sources | |
34 } | |
35 if (defined(invoker.defines)) { | |
36 defines = invoker.defines | |
37 } | |
38 if (defined(invoker.public_configs)) { | |
39 public_configs = invoker.public_configs | |
40 } | |
41 | |
42 configs = [] | |
43 if (defined(invoker.configs)) { | |
44 configs = invoker.configs | |
45 } | |
46 if (defined(invoker.mojo_edk_configs)) { | |
47 foreach(edk_config, invoker.mojo_edk_configs) { | |
48 # Check that the EDK config was not mistakenly given as an absolute | |
49 # path. | |
50 assert(get_path_info(edk_config, "abspath") != edk_config) | |
51 configs += [ rebase_path(edk_config, ".", mojo_root) ] | |
52 } | |
53 } | |
54 | |
55 allow_circular_includes_from = [] | |
56 if (defined(invoker.allow_circular_includes_from)) { | |
57 allow_circular_includes_from += invoker.allow_circular_includes_from | |
58 } | |
59 if (defined(invoker.allow_circular_mojo_edk_includes_from)) { | |
60 foreach(edk_target, invoker.allow_circular_mojo_edk_includes_from) { | |
61 # Check that the EDK target was not mistakenly given as an absolute | |
62 # path. | |
63 assert(get_path_info(edk_target, "abspath") != edk_target) | |
64 allow_circular_includes_from += | |
65 [ rebase_path(edk_target, ".", mojo_root) ] | |
66 } | |
67 } | |
68 | |
69 if (defined(invoker.public_deps)) { | |
70 public_deps = invoker.public_deps | |
71 } | |
72 mojo_sdk_public_deps = [] | |
73 if (defined(invoker.mojo_edk_public_deps)) { | |
74 # The EDK is required to be a sibling of the SDK, so the relative | |
75 # dependencies are rewritten in the same way. | |
76 mojo_sdk_public_deps = invoker.mojo_edk_public_deps | |
77 } | |
78 if (defined(invoker.mojo_sdk_public_deps)) { | |
79 mojo_sdk_public_deps += invoker.mojo_sdk_public_deps | |
80 } | |
81 | |
82 if (defined(invoker.deps)) { | |
83 deps = invoker.deps | |
84 } | |
85 mojo_sdk_deps = [] | |
86 if (defined(invoker.mojo_edk_deps)) { | |
87 # The EDK is required to be a sibling of the SDK, so the relative | |
88 # dependencies are rewritten in the same way. | |
89 mojo_sdk_deps = invoker.mojo_edk_deps | |
90 } | |
91 if (defined(invoker.mojo_sdk_deps)) { | |
92 mojo_sdk_deps += invoker.mojo_sdk_deps | |
93 } | |
94 } | |
95 } | |
OLD | NEW |