blob: 51624ccf716a27ffbcb3fa2a311e3adf286884d2 [file] [log] [blame]
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Defines a config specifying the result of running pkg-config for the given
# packages. Put the package names you want to query in the "pkg_deps" variable
# inside the template invocation.
template("pkg_config") {
config(target_name) {
forward_variables_from(invoker,
"*",
[
"ldflags",
"libs",
"cflags",
])
assert(defined(pkg_deps), "pkg_deps must be set")
ldflags = []
libs = []
cflags = []
if (pkg_deps != []) {
ldflags += exec_script("//common-mk/args_generator_wrapper.py",
[ pkg_config ] + pkg_deps + [
"--libs-only-L",
"--libs-only-other",
],
"list lines")
libs += exec_script("//common-mk/args_generator_wrapper.py",
[ pkg_config ] + pkg_deps + [ "--libs-only-l" ],
"list lines")
cflags += exec_script("//common-mk/args_generator_wrapper.py",
[ pkg_config ] + pkg_deps + [ "--cflags" ],
"list lines")
}
if (defined(invoker.ldflags)) {
ldflags += invoker.ldflags
}
if (defined(invoker.libs)) {
libs += invoker.libs
}
if (defined(invoker.cflags)) {
cflags += invoker.cflags
}
}
}