OLD | NEW |
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("../public/mojo_sdk.gni") | 5 import("../../third_party/mojo/src/mojo/public/mojo_sdk.gni") |
6 | 6 |
7 # A mojo_edk_source_set is a mojo_sdk_source_set that does not restrict | 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 | 8 # external dependencies and understands the following additional variables, all |
9 # of which admit a list of the relevant elements specified relative to the | 9 # of which admit a list of the relevant elements specified relative to the |
10 # location of the Mojo EDK: | 10 # location of the Mojo EDK: |
11 # mojo_edk_configs | |
12 # allow_circular_mojo_edk_includes_from | 11 # 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") { | 12 template("mojo_edk_source_set") { |
20 mojo_sdk_source_set(target_name) { | 13 mojo_sdk_source_set(target_name) { |
21 if (defined(invoker.public_deps) || defined(invoker.deps)) { | 14 if (defined(invoker.public_deps) || defined(invoker.deps)) { |
22 restrict_external_deps = false | 15 restrict_external_deps = false |
23 } | 16 } |
24 | 17 |
25 if (defined(invoker.visibility)) { | 18 if (defined(invoker.visibility)) { |
26 visibility = invoker.visibility | 19 visibility = invoker.visibility |
27 } | 20 } |
28 if (defined(invoker.mojo_edk_visibility)) { | |
29 mojo_sdk_visibility = invoker.mojo_edk_visibility | |
30 } | |
31 if (defined(invoker.testonly)) { | 21 if (defined(invoker.testonly)) { |
32 testonly = invoker.testonly | 22 testonly = invoker.testonly |
33 } | 23 } |
34 if (defined(invoker.sources)) { | 24 if (defined(invoker.sources)) { |
35 sources = invoker.sources | 25 sources = invoker.sources |
36 } | 26 } |
37 if (defined(invoker.defines)) { | 27 if (defined(invoker.defines)) { |
38 defines = invoker.defines | 28 defines = invoker.defines |
39 } | 29 } |
40 if (defined(invoker.public_configs)) { | 30 if (defined(invoker.public_configs)) { |
41 public_configs = invoker.public_configs | 31 public_configs = invoker.public_configs |
42 } | 32 } |
43 | 33 |
44 configs = [] | 34 configs = [] |
45 if (defined(invoker.configs)) { | 35 if (defined(invoker.configs)) { |
46 configs = invoker.configs | 36 configs = invoker.configs |
47 } | 37 } |
48 if (defined(invoker.mojo_edk_configs)) { | |
49 foreach(edk_config, invoker.mojo_edk_configs) { | |
50 # Check that the EDK config was not mistakenly given as an absolute | |
51 # path. | |
52 assert(get_path_info(edk_config, "abspath") != edk_config) | |
53 configs += [ rebase_path(edk_config, ".", mojo_root) ] | |
54 } | |
55 } | |
56 | 38 |
57 allow_circular_includes_from = [] | 39 allow_circular_includes_from = [] |
58 if (defined(invoker.allow_circular_includes_from)) { | 40 if (defined(invoker.allow_circular_includes_from)) { |
59 allow_circular_includes_from += invoker.allow_circular_includes_from | 41 allow_circular_includes_from += invoker.allow_circular_includes_from |
60 } | 42 } |
61 if (defined(invoker.allow_circular_mojo_edk_includes_from)) { | 43 if (defined(invoker.allow_circular_mojo_edk_includes_from)) { |
62 foreach(edk_target, invoker.allow_circular_mojo_edk_includes_from) { | 44 foreach(edk_target, invoker.allow_circular_mojo_edk_includes_from) { |
63 # Check that the EDK target was not mistakenly given as an absolute | 45 # Check that the EDK target was not mistakenly given as an absolute |
64 # path. | 46 # path. |
65 assert(get_path_info(edk_target, "abspath") != edk_target) | 47 assert(get_path_info(edk_target, "abspath") != edk_target) |
66 allow_circular_includes_from += | 48 allow_circular_includes_from += |
67 [ rebase_path(edk_target, ".", mojo_root) ] | 49 [ rebase_path(edk_target, ".", mojo_root) ] |
68 } | 50 } |
69 } | 51 } |
70 | 52 |
71 if (defined(invoker.public_deps)) { | 53 if (defined(invoker.public_deps)) { |
72 public_deps = invoker.public_deps | 54 public_deps = invoker.public_deps |
73 } | 55 } |
74 mojo_sdk_public_deps = [] | 56 mojo_sdk_public_deps = [] |
75 if (defined(invoker.mojo_edk_public_deps)) { | |
76 # The EDK is required to be a sibling of the SDK, so the relative | |
77 # dependencies are rewritten in the same way. | |
78 mojo_sdk_public_deps = invoker.mojo_edk_public_deps | |
79 } | |
80 if (defined(invoker.mojo_sdk_public_deps)) { | 57 if (defined(invoker.mojo_sdk_public_deps)) { |
81 mojo_sdk_public_deps += invoker.mojo_sdk_public_deps | 58 mojo_sdk_public_deps += invoker.mojo_sdk_public_deps |
82 } | 59 } |
83 | 60 |
84 if (defined(invoker.deps)) { | 61 if (defined(invoker.deps)) { |
85 deps = invoker.deps | 62 deps = invoker.deps |
86 } | 63 } |
87 mojo_sdk_deps = [] | 64 mojo_sdk_deps = [] |
88 if (defined(invoker.mojo_edk_deps)) { | |
89 # The EDK is required to be a sibling of the SDK, so the relative | |
90 # dependencies are rewritten in the same way. | |
91 mojo_sdk_deps = invoker.mojo_edk_deps | |
92 } | |
93 if (defined(invoker.mojo_sdk_deps)) { | 65 if (defined(invoker.mojo_sdk_deps)) { |
94 mojo_sdk_deps += invoker.mojo_sdk_deps | 66 mojo_sdk_deps += invoker.mojo_sdk_deps |
95 } | 67 } |
96 } | 68 } |
97 } | 69 } |
98 | |
99 # Build EDK things with static thread annotation analysis enabled. | |
100 # TODO(vtl): Should we set this at a higher level? | |
101 if (is_clang) { | |
102 cflags = [ "-Wthread-safety" ] | |
103 } | |
OLD | NEW |