forked from gazebosim/gz-common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.bazel
110 lines (92 loc) · 2.38 KB
/
BUILD.bazel
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
load(
"//ign_bazel:build_defs.bzl",
"IGNITION_FEATURES",
"IGNITION_ROOT",
"IGNITION_VISIBILITY",
"generate_include_header",
"ign_config_header",
"ign_export_header",
)
package(
default_visibility = IGNITION_VISIBILITY,
features = IGNITION_FEATURES,
)
licenses(["notice"])
exports_files(["LICENSE"])
PROJECT_NAME = "ignition-common"
PROJECT_MAJOR = 4
PROJECT_MINOR = 0
PROJECT_PATCH = 2
# Generates config.hh based on the version numbers in CMake code.
ign_config_header(
name = "config",
src = "include/ignition/common/config.hh.in",
cmakelists = ["CMakeLists.txt"],
project_name = PROJECT_NAME,
project_version = (PROJECT_MAJOR, PROJECT_MINOR, PROJECT_PATCH),
)
ign_export_header(
name = "include/ignition/common/Export.hh",
export_base = "IGNITION_COMMON",
lib_name = "ignition-common",
visibility = ["//visibility:private"],
)
public_headers_no_gen = glob([
"include/ignition/common/*.hh",
"include/ignition/common/detail/*.hh",
])
private_headers = [
"src/PluginUtils.hh",
"src/PrintWindowsSystemWarning.hh",
]
sources = glob(
["src/*.cc"],
exclude = ["src/*_TEST.cc"],
)
generate_include_header(
name = "commonhh_genrule",
out = "include/ignition/common.hh",
hdrs = public_headers_no_gen + [
"include/ignition/common/config.hh",
"include/ignition/common/Export.hh",
],
)
public_headers = public_headers_no_gen + [
"include/ignition/common/config.hh",
"include/ignition/common/Export.hh",
"include/ignition/common.hh",
]
cc_library(
name = "ign_common",
srcs = sources + private_headers,
hdrs = public_headers,
includes = ["include"],
linkopts = ["-ldl"],
deps = [
"@uuid",
IGNITION_ROOT + "ign_math",
],
)
cc_binary(
name = "libignition-common4.so",
includes = ["include"],
linkopts = ["-Wl,-soname,libignition-common4.so"],
linkshared = True,
deps = [":ign_common"],
)
test_srcs = glob(
["src/*_TEST.cc"],
exclude = ["src/PluginLoader_TEST.cc"],
)
[cc_test(
name = src.replace("/", "_").replace(".cc", "").replace("src_", ""),
srcs = [src],
data = [":libignition-common4.so"],
deps = [
":ign_common",
IGNITION_ROOT + "ign_bazel:utilities",
IGNITION_ROOT + "ign_common/test:test_utils",
"@gtest",
"@gtest//:gtest_main",
],
) for src in test_srcs]