11load (
2- "//ign_bazel:cmake_configure_file.bzl" ,
2+ "//ign_bazel:build_defs.bzl" ,
3+ "IGNITION_VISIBILITY" ,
34 "cmake_configure_file" ,
4- )
5- load (
6- "//ign_bazel:generate_include_header.bzl" ,
75 "generate_include_header" ,
8- )
9- load (
10- "//ign_bazel:ign_export_header.bzl" ,
6+ "ign_config_header" ,
117 "ign_export_header" ,
128)
139
14- package (default_visibility = ["//visibility:public" ])
10+ package (
11+ default_visibility = IGNITION_VISIBILITY ,
12+ features = [
13+ "-parse_headers" ,
14+ "-layering_check" ,
15+ ],
16+ )
17+
18+ licenses (["notice" ])
19+
20+ exports_files (["LICENSE" ])
1521
1622PROJECT_NAME = "ignition-math"
23+
1724PROJECT_MAJOR = 6
18- PROJECT_MINOR = 4
25+
26+ PROJECT_MINOR = 6
27+
1928PROJECT_PATCH = 0
2029
2130# Generates config.hh based on the version numbers in CMake code.
22- cmake_configure_file (
31+ ign_config_header (
2332 name = "config" ,
2433 src = "include/ignition/math/config.hh.in" ,
25- out = "include/ignition/math/config.hh" ,
2634 cmakelists = ["CMakeLists.txt" ],
27- defines = [
28- "PROJECT_VERSION_MAJOR=%d" % (PROJECT_MAJOR ),
29- "PROJECT_MAJOR_VERSION=%d" % (PROJECT_MAJOR ),
30- "PROJECT_MINOR_VERSION=%d" % (PROJECT_MINOR ),
31- "PROJECT_PATCH_VERSION=%d" % (PROJECT_PATCH ),
32- "PROJECT_VERSION=%d.%d" % (PROJECT_MAJOR , PROJECT_MINOR ),
33- "PROJECT_VERSION_FULL=%d.%d.%d" % (PROJECT_MAJOR , PROJECT_MINOR , PROJECT_PATCH ), # noqa
34- "PROJECT_NAME_NO_VERSION=%s" % (PROJECT_NAME ),
35- ],
36- visibility = ["//visibility:private" ],
35+ project_name = "ignition-math" ,
36+ project_version = (PROJECT_MAJOR , PROJECT_MINOR , PROJECT_PATCH ),
3737)
3838
3939ign_export_header (
4040 name = "include/ignition/math/Export.hh" ,
41- lib_name = "ignition-math" ,
4241 export_base = "IGNITION_MATH" ,
42+ lib_name = "ignition-math" ,
4343 visibility = ["//visibility:private" ],
4444)
4545
@@ -119,8 +119,8 @@ public_headers = public_headers_no_gen + [
119119 "include/ignition/math.hh" ,
120120]
121121
122- cc_binary (
123- name = "libignition-math6.so " ,
122+ cc_library (
123+ name = "ign_math " ,
124124 srcs = [
125125 "src/Angle.cc" ,
126126 "src/AxisAlignedBox.cc" ,
@@ -144,27 +144,28 @@ cc_binary(
144144 "src/Stopwatch.cc" ,
145145 "src/Temperature.cc" ,
146146 "src/Vector3Stats.cc" ,
147- ] + private_headers + public_headers ,
147+ ] + private_headers ,
148+ hdrs = public_headers ,
148149 includes = ["include" ],
149- linkopts = ["-Wl,-soname,libignition-math6.so" ],
150- linkshared = True ,
151- visibility = [],
152150)
153151
154- cc_library (
155- name = "ign_math" ,
156- srcs = ["libignition-math6.so" ],
157- hdrs = public_headers ,
152+ # use shared library only when absolutely needd
153+ cc_binary (
154+ name = "libignition-math6.so" ,
158155 includes = ["include" ],
159- visibility = ["//visibility:public" ],
156+ linkopts = ["-Wl,-soname,libignition-math6.so" ],
157+ linkshared = True ,
158+ deps = [
159+ ":ign_math" ,
160+ ],
160161)
161162
162163[cc_test (
163164 name = src .replace ("/" , "_" ).replace (".cc" , "" ).replace ("src_" , "" ),
164165 srcs = [src ],
165166 deps = [
166167 ":ign_math" ,
167- "@gtest//:gtest " ,
168+ "@gtest" ,
168169 "@gtest//:gtest_main" ,
169170 ],
170171) for src in glob (
@@ -173,4 +174,3 @@ cc_library(
173174 "src/graph/*_TEST.cc" ,
174175 ],
175176)]
176-
0 commit comments