You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.8 KiB
66 lines
1.8 KiB
# Copyright 2019 The Pigweed Authors
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
# use this file except in compliance with the License. You may obtain a copy of
|
|
# the License at
|
|
#
|
|
# https://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations under
|
|
# the License.
|
|
|
|
import("python_action.gni")
|
|
|
|
declare_args() {
|
|
# Whether to build host-side tooling.
|
|
pw_build_HOST_TOOLS = false
|
|
}
|
|
|
|
if (pw_build_HOST_TOOLS) {
|
|
# Defines a Pigweed host tool and installs it into the host_tools directory.
|
|
#
|
|
# Args:
|
|
# tool: The target that outputs the binary tool.
|
|
# name: Optional name for the installed program. Defaults to the name of
|
|
# the compiled binary.
|
|
template("pw_host_tool") {
|
|
assert(defined(invoker.tool),
|
|
"pw_host_tool must specify an executable as the tool variable")
|
|
|
|
_script_args = [
|
|
"--src",
|
|
"<TARGET_FILE(${invoker.tool})>",
|
|
"--dst",
|
|
rebase_path("$root_out_dir/host_tools"),
|
|
"--out-root",
|
|
rebase_path(root_out_dir),
|
|
]
|
|
|
|
if (defined(invoker.name) && invoker.name != "") {
|
|
_script_args += [
|
|
"--name",
|
|
invoker.name,
|
|
]
|
|
}
|
|
|
|
pw_python_action(target_name) {
|
|
script = "$dir_pw_build/py/pw_build/host_tool.py"
|
|
args = _script_args
|
|
deps = [ invoker.tool ]
|
|
stamp = true
|
|
}
|
|
}
|
|
} else {
|
|
# For builds without host tools, create an empty target.
|
|
template("pw_host_tool") {
|
|
not_needed("*")
|
|
not_needed(invoker, "*")
|
|
|
|
group(target_name) {
|
|
}
|
|
}
|
|
} # pw_build_HOST_TOOLS
|