diff options
author | John Abd-El-Malek <jam@chromium.org> | 2015-04-02 10:29:35 -0700 |
---|---|---|
committer | John Abd-El-Malek <jam@chromium.org> | 2015-04-02 17:31:11 +0000 |
commit | 537a670451020f4764d511cbdf8e30ec91ef897c (patch) | |
tree | d2868da2b0d33dc7ed8c8e709ae4a7f5bd5aefd8 /mojo/public/mojo_sdk.gni | |
parent | 83653dd1da59dfa7ddd9e48d4cd507a11cefd968 (diff) | |
download | chromium_src-537a670451020f4764d511cbdf8e30ec91ef897c.zip chromium_src-537a670451020f4764d511cbdf8e30ec91ef897c.tar.gz chromium_src-537a670451020f4764d511cbdf8e30ec91ef897c.tar.bz2 |
Get mojo_shell building inside chromium checkout.
This brings in mojo_shell and the necessary services to make html_viewer work.
This is copied from the Mojo repo at 272fbba5887d66fc0111e2ab44c1edf67b7f23e0.
R=scottmg@chromium.org
Review URL: https://codereview.chromium.org/1049993002
Cr-Commit-Position: refs/heads/master@{#323528}
Diffstat (limited to 'mojo/public/mojo_sdk.gni')
-rw-r--r-- | mojo/public/mojo_sdk.gni | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/mojo/public/mojo_sdk.gni b/mojo/public/mojo_sdk.gni new file mode 100644 index 0000000..dbed84c --- /dev/null +++ b/mojo/public/mojo_sdk.gni @@ -0,0 +1,139 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# The absolute path to the directory containing the mojo public SDK (i.e., the +# directory containing mojo/public). The build files within the Mojo public +# SDK use this variable to allow themselves to be parameterized by the location +# of the public SDK within a client repo. +mojo_root = get_path_info("../..", "abspath") + +# Takes as input a "source_set" that includes dependencies that are relative to +# the parent directory of the Mojo public SDK (given in |mojo_sdk_deps|). +# Generates a source_set that has the mojo_sdk_deps added as ordinary deps +# rebased to the current directory. +# By default, restricts the entries that are given in invoker.deps and +# invoker.public_deps to be only within the same file and on a small set of +# whitelisted external dependencies. This check can be elided by setting +# restrict_external_deps to false in the invoker. DO NOT DO THIS in +# //mojo/public. +# +# Example of a mojo_sdk_source_set: +# +# mojo_sdk_source_set("foo") { +# sources = [ +# "foo.h", +# "foo.cc", +# ] +# +# # Same-file deps are specified in the ordinary way. Any external +# dependencies are specified the same way (although in general there should +# be very few of these). +# deps = [ +# ":bar", +# ] +# +# # Mojo SDK deps are specified relative to the containing directory of the +# SDK via mojo_sdk_deps. +# mojo_sdk_deps = [ +# "mojo/public/cpp/bindings", +# "mojo/public/cpp/environment", +# "mojo/public/cpp/system", +# ] +# } +# +template("mojo_sdk_source_set") { + source_set(target_name) { + if (defined(invoker.visibility)) { + visibility = invoker.visibility + } else { + visibility = [ "*" ] + } + if (defined(invoker.mojo_sdk_visibility)) { + foreach(sdk_target, invoker.mojo_sdk_visibility) { + # Check that the SDK target was not mistakenly given as an absolute + # path. + assert(get_path_info(sdk_target, "abspath") != sdk_target) + visibility += [ rebase_path(sdk_target, ".", mojo_root) ] + } + } + + if (defined(invoker.testonly)) { + testonly = invoker.testonly + } + + if (defined(invoker.sources)) { + sources = invoker.sources + } + + if (defined(invoker.defines)) { + defines = invoker.defines + } + + if (defined(invoker.libs)) { + libs = invoker.libs + } + + public_configs = + [ rebase_path("mojo/public/build/config:mojo_sdk", ".", mojo_root) ] + if (defined(invoker.public_configs)) { + public_configs += invoker.public_configs + } + + if (defined(invoker.configs)) { + configs += invoker.configs + } + + if (defined(invoker.allow_circular_includes_from)) { + allow_circular_includes_from = invoker.allow_circular_includes_from + } + + if (defined(invoker.public_deps) || defined(invoker.deps)) { + restrict_external_deps = true + if (defined(invoker.restrict_external_deps)) { + restrict_external_deps = invoker.restrict_external_deps + } + } + + public_deps = [] + if (defined(invoker.public_deps)) { + foreach(dep, invoker.public_deps) { + if (restrict_external_deps) { + # The only deps that are not specified relative to the location of + # the Mojo SDK should be on targets within the same file or on a + # whitelisted set of external dependencies. + assert(get_path_info(dep, "dir") == ".") + } + public_deps += [ dep ] + } + } + if (defined(invoker.mojo_sdk_public_deps)) { + foreach(sdk_dep, invoker.mojo_sdk_public_deps) { + # Check that the SDK dep was not mistakenly given as an absolute path. + assert(get_path_info(sdk_dep, "abspath") != sdk_dep) + public_deps += [ rebase_path(sdk_dep, ".", mojo_root) ] + } + } + + deps = [] + if (defined(invoker.deps)) { + foreach(dep, invoker.deps) { + if (restrict_external_deps) { + # The only deps that are not specified relative to the location of + # the Mojo SDK should be on targets within the same file or on a + # whitelisted set of external dependencies. + dep_dir = get_path_info(dep, "dir") + assert(dep_dir == "." || dep == "//testing/gtest") + } + deps += [ dep ] + } + } + if (defined(invoker.mojo_sdk_deps)) { + foreach(sdk_dep, invoker.mojo_sdk_deps) { + # Check that the SDK dep was not mistakenly given as an absolute path. + assert(get_path_info(sdk_dep, "abspath") != sdk_dep) + deps += [ rebase_path(sdk_dep, ".", mojo_root) ] + } + } + } +} |