aboutsummaryrefslogtreecommitdiff
path: root/rules/cc/cc_library_common.bzl
diff options
context:
space:
mode:
authorAlex Márquez Pérez Muñíz Díaz Puras Thaureaux <alexmarquez@google.com>2023-04-17 21:01:20 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-04-17 21:01:20 +0000
commit8bbd1f3b3067f3f4d137e92641bd60312c9f5129 (patch)
tree40e7aa99bfdc0134e45fb187fc768393cc4b6dd3 /rules/cc/cc_library_common.bzl
parent146e4150d357aaa5919f7421bc2f613cd5148b96 (diff)
parent68e96eb29095443c078167effaf8f30e430cbbf8 (diff)
downloadbazel-8bbd1f3b3067f3f4d137e92641bd60312c9f5129.tar.gz
Merge "cc_prebuilt_library_{shared,static}: macros->rules"
Diffstat (limited to 'rules/cc/cc_library_common.bzl')
-rw-r--r--rules/cc/cc_library_common.bzl19
1 files changed, 19 insertions, 0 deletions
diff --git a/rules/cc/cc_library_common.bzl b/rules/cc/cc_library_common.bzl
index bd861c50..afd5d978 100644
--- a/rules/cc/cc_library_common.bzl
+++ b/rules/cc/cc_library_common.bzl
@@ -402,3 +402,22 @@ def create_cc_androidmk_provider(*, static_deps, whole_archive_deps, dynamic_dep
local_whole_static_libs = local_whole_static_libs,
local_shared_libs = local_shared_libs,
)
+
+def create_cc_prebuilt_library_info(ctx, lib_to_link):
+ "Create the CcInfo for a prebuilt_library_{shared,static}"
+
+ compilation_context = cc_common.create_compilation_context(
+ includes = depset(get_includes_paths(ctx, ctx.attr.export_includes)),
+ system_includes = depset(get_includes_paths(ctx, ctx.attr.export_system_includes)),
+ )
+ linker_input = cc_common.create_linker_input(
+ owner = ctx.label,
+ libraries = depset(direct = [lib_to_link] if lib_to_link != None else []),
+ )
+ linking_context = cc_common.create_linking_context(
+ linker_inputs = depset(direct = [linker_input]),
+ )
+ return CcInfo(
+ compilation_context = compilation_context,
+ linking_context = linking_context,
+ )