-
Notifications
You must be signed in to change notification settings - Fork 0
/
cc.bzl
54 lines (48 loc) · 1.78 KB
/
cc.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Copyright (C) 2023 The Android Open Source Project
#
# 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
#
# http://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.
"""CC rules for this package."""
def import_libraries(
name,
hdrs,
strip_include_prefix,
shared_libraries,
**kwargs):
"""Define a cc_library from a list of prebuilts.
Args:
name: name of the target.
hdrs: The list of header files published by this library to be directly included by
sources in dependent rules.
strip_include_prefix: The prefix to strip from the paths of the headers of this rule.
shared_libraries: A list of dynamic library files.
This cannot be a `filegroup`; it must be a list of targets, each corresponding
to a single dynamic library file.
**kwargs: other arguments to the top-level target.
"""
private_kwargs = dict(kwargs)
private_kwargs["visibility"] = ["//visibility:private"]
targets = []
for f in shared_libraries:
native.cc_import(
name = name + "_" + f,
shared_library = f,
**private_kwargs
)
targets.append(name + "_" + f)
native.cc_library(
name = name,
deps = targets,
hdrs = hdrs,
strip_include_prefix = strip_include_prefix,
**kwargs
)