2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-12-01 22:16:27 +00:00
rules_foreign_cc/examples/third_party/gn/BUILD.gn.bazel
James Sharpe b136e6c52d
Add config for building with spawn_strategy=standalone (#603)
* Add config for building with spawn_strategy=standalone

* Always build RELEASE configuration to avoid having to select for the output due to change in artifact names for debug builds

* Fix for copy_contents_to_dir and symlink_contents_to_dir on macOS as per #512

* Update name of test files
2021-05-05 17:47:25 -07:00

54 lines
1.2 KiB
Plaintext

load("@rules_foreign_cc//foreign_cc:defs.bzl", "ninja")
filegroup(
name = "srcs",
srcs = glob(
["**"],
exclude = ["out/**"],
) + [
"out/build.ninja",
"out/build.ninja.d",
"out/last_commit_position.h",
],
)
config_setting(
name = "windows",
constraint_values = ["@platforms//os:windows"],
)
ninja(
name = "gn",
directory = "out",
lib_source = "//:srcs",
out_binaries = select({
":windows": ["gn.exe"],
"//conditions:default": ["gn"],
}),
out_static_libs = select({
":windows": ["gn_lib.lib"],
"//conditions:default": ["gn_lib.a"],
}),
# gn has no install step, manually grab the artifacts
postfix_script = select({
":windows": " && ".join([
"cp -a out/gn_lib.lib $$INSTALLDIR$$/lib",
"cp -a out/gn.exe $$INSTALLDIR$$/bin",
]),
"//conditions:default": " && ".join([
"cp -a out/gn_lib.a $$INSTALLDIR$$/lib",
"cp -a out/gn $$INSTALLDIR$$/bin",
]),
}),
)
filegroup(
name = "gn_bin",
srcs = [":gn"],
output_group = select({
":windows": "gn.exe",
"//conditions:default": "gn",
}),
visibility = ["//visibility:public"],
)