Skip to content

Commit 3383344

Browse files
author
Addisu Z. Taddese
authored
Merge branch 'gz-math8' into patch-1
2 parents 077dcd6 + c35a71a commit 3383344

104 files changed

Lines changed: 1293 additions & 798 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazelrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
common --enable_bzlmod
2+
common --lockfile_mode=off
3+
4+
# Add C++17 compiler flags.
5+
build --cxxopt=-std=c++17
6+
build --host_cxxopt=-std=c++17
7+
8+
build --force_pic
9+
build --strip=never
10+
build --strict_system_includes
11+
build --fission=dbg
12+
build --features=per_object_debug_info
13+
14+
# Enable header processing, required for layering checks with parse_header.
15+
build --process_headers_in_dependencies

.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.3.1

.github/ci/after_make.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,11 @@ cmake ..
1515
make
1616
./graph_example
1717

18+
# Compile python bindings
19+
cd $BUILD_DIR/../src/python_pybind11
20+
mkdir build;
21+
cd build;
22+
cmake ..;
23+
make;
24+
1825
cd $BUILD_DIR

.github/workflows/bazel.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Bazel CI
2+
on:
3+
push:
4+
branches: [gz-math8, main]
5+
pull_request:
6+
branches: [gz-math8, main]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
test:
14+
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v7
15+
with:
16+
folders: |
17+
[
18+
".",
19+
]
20+
exclude: |
21+
[
22+
{"folder": ".", "bzlmodEnabled": false},
23+
]

.github/workflows/ci.bazelrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file contains Bazel settings to apply on CI only.
2+
# It is referenced with a --bazelrc option in the call to bazel in ci.yaml
3+
4+
# Debug where options came from
5+
build --announce_rc
6+
# This directory is configured in GitHub actions to be persisted between runs.
7+
# We do not enable the repository cache to cache downloaded external artifacts
8+
# as these are generally faster to download again than to fetch them from the
9+
# GitHub actions cache.
10+
build --disk_cache=~/.cache/bazel
11+
# Don't rely on test logs being easily accessible from the test runner,
12+
# though it makes the log noisier.
13+
test --test_output=errors
14+
# Allows tests to run bazelisk-in-bazel, since this is the cache folder used
15+
test --test_env=XDG_CACHE_HOME

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ jobs:
2020
uses: gazebo-tooling/action-gz-ci@jammy
2121
with:
2222
codecov-enabled: true
23-
cppcheck-enabled: true
24-
cpplint-enabled: true
25-
doxygen-enabled: true
2623
noble-ci:
2724
runs-on: ubuntu-latest
2825
name: Ubuntu Noble CI
@@ -32,3 +29,7 @@ jobs:
3229
- name: Compile and test
3330
id: ci
3431
uses: gazebo-tooling/action-gz-ci@noble
32+
with:
33+
cppcheck-enabled: true
34+
cpplint-enabled: true
35+
doxygen-enabled: true

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ build_*
88

99
# Python generaated files
1010
*.pyc
11+
12+
# Bazel generated files
13+
bazel-*

BUILD.bazel

Lines changed: 105 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
1-
load(
2-
"@gz//bazel/skylark:build_defs.bzl",
3-
"GZ_FEATURES",
4-
"GZ_ROOT",
5-
"GZ_VISIBILITY",
6-
"gz_configure_header",
7-
"gz_export_header",
8-
"gz_include_header",
9-
)
10-
load(
11-
"@gz//bazel/lint:lint.bzl",
12-
"add_lint_tests",
13-
)
14-
load(
15-
"@rules_license//rules:license.bzl",
16-
"license",
17-
)
1+
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
2+
load("@rules_gazebo//gazebo:headers.bzl", "gz_configure_header", "gz_export_header", "gz_include_header")
3+
load("@rules_license//rules:license.bzl", "license")
4+
load("@rules_python//python:py_library.bzl", "py_library")
5+
load("@rules_python//python:py_test.bzl", "py_test")
186

197
package(
20-
default_applicable_licenses = [GZ_ROOT + "math:license"],
21-
default_visibility = GZ_VISIBILITY,
22-
features = GZ_FEATURES,
8+
default_applicable_licenses = [":license"],
9+
default_visibility = ["__subpackages__"],
10+
features = [
11+
"layering_check",
12+
"parse_headers",
13+
],
2314
)
2415

2516
license(
@@ -29,75 +20,129 @@ license(
2920

3021
licenses(["notice"])
3122

32-
exports_files(["LICENSE"])
33-
34-
gz_configure_header(
35-
name = "config",
36-
src = "include/gz/math/config.hh.in",
37-
cmakelists = ["CMakeLists.txt"],
38-
package = "math",
39-
)
23+
exports_files([
24+
"LICENSE",
25+
"MODULE.bazel",
26+
])
4027

4128
gz_export_header(
42-
name = "include/gz/math/Export.hh",
29+
name = "Export",
30+
out = "include/gz/math/Export.hh",
4331
export_base = "GZ_MATH",
4432
lib_name = "gz-math",
45-
visibility = ["//visibility:private"],
4633
)
4734

48-
public_headers_no_gen = glob([
49-
"include/gz/math/*.hh",
50-
"include/gz/math/detail/*.hh",
51-
"include/gz/math/graph/*.hh",
52-
])
53-
54-
private_headers = glob(["src/*.hh"])
35+
gz_configure_header(
36+
name = "Config",
37+
src = "include/gz/math/config.hh.in",
38+
package_xml = "package.xml",
39+
)
5540

56-
sources = glob(
57-
["src/*.cc"],
58-
exclude = ["src/*_TEST.cc"],
41+
public_headers_no_gen = glob(
42+
include = [
43+
"include/gz/math/*.hh",
44+
"include/gz/math/detail/*.hh",
45+
"include/gz/math/graph/*.hh",
46+
],
5947
)
6048

6149
gz_include_header(
62-
name = "mathhh_genrule",
50+
name = "Include",
6351
out = "include/gz/math.hh",
64-
hdrs = public_headers_no_gen + [
65-
"include/gz/math/config.hh",
66-
"include/gz/math/Export.hh",
67-
],
52+
hdrs = public_headers_no_gen + ["include/gz/math/config.hh"],
6853
)
6954

7055
public_headers = public_headers_no_gen + [
71-
"include/gz/math/config.hh",
72-
"include/gz/math/Export.hh",
7356
"include/gz/math.hh",
57+
"include/gz/math/Export.hh",
58+
"include/gz/math/config.hh",
7459
]
7560

61+
private_headers = glob(
62+
include = [
63+
"src/*.hh",
64+
],
65+
)
66+
67+
sources = glob(
68+
include = [
69+
"src/*.cc",
70+
],
71+
exclude = [
72+
"src/*_TEST.cc",
73+
],
74+
)
75+
7676
cc_library(
77-
name = "math",
77+
name = "gz-math",
7878
srcs = sources + private_headers,
7979
hdrs = public_headers,
80-
includes = ["include"],
80+
includes = [
81+
"include",
82+
],
83+
visibility = ["//visibility:public"],
8184
deps = [
82-
GZ_ROOT + "utils",
85+
"@gz-utils//:ImplPtr",
86+
"@gz-utils//:NeverDestroyed",
87+
"@gz-utils//:SuppressWarning",
8388
],
8489
)
8590

91+
pybind_extension(
92+
name = "gz/math8",
93+
srcs = glob(
94+
include = [
95+
"src/python_pybind11/src/*.cc",
96+
"src/python_pybind11/src/*.hh",
97+
],
98+
),
99+
defines = [
100+
"BINDINGS_MODULE_NAME=math8",
101+
],
102+
linkstatic = True,
103+
visibility = ["//visibility:private"],
104+
deps = [":gz-math"],
105+
)
106+
107+
py_library(
108+
name = "python",
109+
data = [":gz/math8"],
110+
visibility = ["//visibility:public"],
111+
)
112+
86113
test_sources = glob(
87-
[
114+
include = [
88115
"src/*_TEST.cc",
89116
"src/graph/*_TEST.cc",
90117
],
91118
)
92119

93-
[cc_test(
94-
name = src.replace("/", "_").replace(".cc", "").replace("src_", ""),
95-
srcs = [src],
96-
deps = [
97-
":math",
98-
"@gtest",
99-
"@gtest//:gtest_main",
120+
[
121+
cc_test(
122+
name = src.replace("/", "_").replace(".cc", "").replace("src_", ""),
123+
srcs = [src],
124+
deps = [
125+
":gz-math",
126+
"@googletest//:gtest",
127+
"@googletest//:gtest_main",
128+
"@gz-utils//:SuppressWarning",
129+
],
130+
)
131+
for src in test_sources
132+
]
133+
134+
py_test_sources = glob(
135+
include = [
136+
"src/python_pybind11/test/*_TEST.py",
100137
],
101-
) for src in test_sources]
138+
)
102139

103-
add_lint_tests()
140+
[
141+
py_test(
142+
name = src.replace("/", "_").replace(".py", "_py").replace("src_python_pybind11_test_", ""),
143+
srcs = [src],
144+
main = src,
145+
deps = [":python"],
146+
)
147+
for src in py_test_sources
148+
]

CMakeLists.txt

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
33
#============================================================================
44
# Initialize the project
55
#============================================================================
6-
project(gz-math8 VERSION 8.0.0)
6+
project(gz-math8 VERSION 8.2.0)
77

88
#============================================================================
99
# Find gz-cmake
@@ -18,7 +18,7 @@ set(GZ_CMAKE_VER ${gz-cmake4_VERSION_MAJOR})
1818
set(CMAKE_CXX_STANDARD 17)
1919
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2020

21-
gz_configure_project(VERSION_SUFFIX pre1)
21+
gz_configure_project(VERSION_SUFFIX)
2222

2323
#============================================================================
2424
# Set project-specific options
@@ -103,19 +103,6 @@ else()
103103
COMPONENTS Interpreter
104104
OPTIONAL_COMPONENTS Development
105105
)
106-
if (NOT Python3_Development_FOUND)
107-
GZ_BUILD_WARNING("Python development libraries are missing: Python interfaces are disabled.")
108-
else()
109-
set(PYBIND11_PYTHON_VERSION 3)
110-
find_package(pybind11 2.2 QUIET)
111-
112-
if (${pybind11_FOUND})
113-
message (STATUS "Searching for pybind11 - found version ${pybind11_VERSION}.")
114-
else()
115-
GZ_BUILD_WARNING("pybind11 is missing: Python interfaces are disabled.")
116-
message (STATUS "Searching for pybind11 - not found.")
117-
endif()
118-
endif()
119106
endif()
120107

121108
# Location of "fake install folder" used in tests

0 commit comments

Comments
 (0)