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.
5 import("../public/mojo_sdk.gni")
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:
12 # allow_circular_mojo_edk_includes_from
13 # mojo_edk_public_deps
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
19 template("mojo_edk_source_set") {
20 mojo_sdk_source_set(target_name) {
21 restrict_external_deps = false
23 if (defined(invoker.visibility)) {
24 visibility = invoker.visibility
26 if (defined(invoker.mojo_edk_visibility)) {
27 mojo_sdk_visibility = invoker.mojo_edk_visibility
29 if (defined(invoker.testonly)) {
30 testonly = invoker.testonly
32 if (defined(invoker.sources)) {
33 sources = invoker.sources
35 if (defined(invoker.defines)) {
36 defines = invoker.defines
38 if (defined(invoker.public_configs)) {
39 public_configs = invoker.public_configs
43 if (defined(invoker.configs)) {
44 configs = invoker.configs
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
50 assert(get_path_info(edk_config, "abspath") != edk_config)
51 configs += [ rebase_path(edk_config, ".", mojo_root) ]
55 allow_circular_includes_from = []
56 if (defined(invoker.allow_circular_includes_from)) {
57 allow_circular_includes_from += invoker.allow_circular_includes_from
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
63 assert(get_path_info(edk_target, "abspath") != edk_target)
64 allow_circular_includes_from += [
65 rebase_path(edk_target, ".", mojo_root)
70 if (defined(invoker.public_deps)) {
71 public_deps = invoker.public_deps
73 mojo_sdk_public_deps = []
74 if (defined(invoker.mojo_edk_public_deps)) {
75 # The EDK is required to be a sibling of the SDK, so the relative
76 # dependencies are rewritten in the same way.
77 mojo_sdk_public_deps = invoker.mojo_edk_public_deps
79 if (defined(invoker.mojo_sdk_public_deps)) {
80 mojo_sdk_public_deps += invoker.mojo_sdk_public_deps
83 if (defined(invoker.deps)) {
87 if (defined(invoker.mojo_edk_deps)) {
88 # The EDK is required to be a sibling of the SDK, so the relative
89 # dependencies are rewritten in the same way.
90 mojo_sdk_deps = invoker.mojo_edk_deps
92 if (defined(invoker.mojo_sdk_deps)) {
93 mojo_sdk_deps += invoker.mojo_sdk_deps