Skip to content

Commit

Permalink
Merge 445775d into 70b98ef
Browse files Browse the repository at this point in the history
  • Loading branch information
mjcarroll authored Feb 10, 2023
2 parents 70b98ef + 445775d commit 450ac03
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 47 deletions.
58 changes: 24 additions & 34 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
load(
"//gz_bazel:build_defs.bzl",
"@gz//bazel/skylark:build_defs.bzl",
"GZ_FEATURES",
"GZ_ROOT",
"GZ_VISIBILITY",
"cmake_configure_file",
"generate_include_header",
"gz_config_header",
"gz_configure_header",
"gz_export_header",
"gz_include_header",
)
load(
"@gz//bazel/lint:lint.bzl",
"add_lint_tests",
)

package(
default_visibility = GZ_VISIBILITY,
features = GZ_FEATURES,
)

licenses(["notice"])
licenses(["notice"]) # Apache-2.0

exports_files(["LICENSE"])

PROJECT_NAME = "gz-math"

PROJECT_MAJOR = 7

PROJECT_MINOR = 0

PROJECT_PATCH = 0

# Generates config.hh based on the version numbers in CMake code.
gz_config_header(
gz_configure_header(
name = "config",
src = "include/gz/math/config.hh.in",
cmakelists = ["CMakeLists.txt"],
project_name = PROJECT_NAME,
project_version = (PROJECT_MAJOR, PROJECT_MINOR, PROJECT_PATCH),
package = "math",
)

gz_export_header(
Expand All @@ -54,7 +48,7 @@ sources = glob(
exclude = ["src/*_TEST.cc"],
)

generate_include_header(
gz_include_header(
name = "mathhh_genrule",
out = "include/gz/math.hh",
hdrs = public_headers_no_gen + [
Expand All @@ -70,34 +64,30 @@ public_headers = public_headers_no_gen + [
]

cc_library(
name = "gz_math",
name = "math",
srcs = sources + private_headers,
hdrs = public_headers,
includes = ["include"],
deps = [
GZ_ROOT + "utils",
],
)

# use shared library only when absolutely needd
cc_binary(
name = "libgz-math7.so",
includes = ["include"],
linkopts = ["-Wl,-soname,libgz-math7.so"],
linkshared = True,
deps = [
":gz_math",
test_sources = glob(
[
"src/*_TEST.cc",
"src/graph/*_TEST.cc",
],
)

[cc_test(
name = src.replace("/", "_").replace(".cc", "").replace("src_", ""),
srcs = [src],
deps = [
":gz_math",
":math",
"@gtest",
"@gtest//:gtest_main",
],
) for src in glob(
[
"src/*_TEST.cc",
"src/graph/*_TEST.cc",
],
)]
) for src in test_sources]

add_lint_tests()
27 changes: 14 additions & 13 deletions eigen3/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
load(
"//gz_bazel:build_defs.bzl",
"@gz//bazel/skylark:build_defs.bzl",
"GZ_FEATURES",
"GZ_ROOT",
"GZ_VISIBILITY",
"gz_configure_header",
"gz_export_header",
"gz_include_header",
)

package(
default_visibility = GZ_VISIBILITY,
)

licenses(["notice"])

public_headers = glob([
"include/gz/math/eigen3/*.hh",
])
Expand All @@ -19,9 +17,16 @@ cc_library(
srcs = public_headers,
hdrs = public_headers,
includes = ["include"],
visibility = GZ_VISIBILITY,
deps = [
GZ_ROOT + "math",
"@eigen3",
GZ_ROOT + "gz_math",
],
)

test_sources = glob(
[
"src/*_TEST.cc",
],
)

Expand All @@ -33,8 +38,4 @@ cc_library(
"@gtest",
"@gtest//:gtest_main",
],
) for src in glob(
[
"src/*_TEST.cc",
],
)]
) for src in test_sources]
23 changes: 23 additions & 0 deletions examples/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
load(
"@gz//bazel/skylark:build_defs.bzl",
"GZ_ROOT",
"GZ_VISIBILITY",
)
load(
"@gz//bazel/lint:lint.bzl",
"add_lint_tests",
)

sources = glob(
["*.cc"],
)

[cc_binary(
name = src.replace(".cc", ""),
srcs = [src],
deps = [
GZ_ROOT + "math",
],
) for src in sources]

add_lint_tests()
13 changes: 13 additions & 0 deletions test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
load(
"@gz//bazel/skylark:build_defs.bzl",
"GZ_FEATURES",
"GZ_VISIBILITY",
)
load(
"@gz//bazel/lint:lint.bzl",
"add_lint_tests",
)

# Currently test directory only applies to CMake builds

add_lint_tests()

0 comments on commit 450ac03

Please sign in to comment.