diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 000000000..f2d06137d --- /dev/null +++ b/.bazelrc @@ -0,0 +1,12 @@ +common --enable_bzlmod +common --lockfile_mode=off + +# Add C++17 compiler flags. +build --cxxopt=-std=c++17 +build --host_cxxopt=-std=c++17 + +build --force_pic +build --strip=never +build --strict_system_includes +build --fission=dbg +build --features=per_object_debug_info diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 000000000..643916c03 --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +7.3.1 diff --git a/.gitignore b/.gitignore index 5eca50293..e7f7852aa 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ build_* # Python generaated files *.pyc + +# Bazel generated files +bazel-* diff --git a/BUILD.bazel b/BUILD.bazel index 968198e92..6e03fe30b 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,25 +1,10 @@ -load( - "@gz//bazel/skylark:build_defs.bzl", - "GZ_FEATURES", - "GZ_ROOT", - "GZ_VISIBILITY", - "gz_configure_header", - "gz_export_header", - "gz_include_header", -) -load( - "@gz//bazel/lint:lint.bzl", - "add_lint_tests", -) -load( - "@rules_license//rules:license.bzl", - "license", -) +load("@rules_gazebo//gazebo:headers.bzl", "gz_configure_header", "gz_export_header") +load("@rules_license//rules:license.bzl", "license") +load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test") package( - default_applicable_licenses = [GZ_ROOT + "math:license"], - default_visibility = GZ_VISIBILITY, - features = GZ_FEATURES, + default_applicable_licenses = [":license"], + default_visibility = ["//visibility:public"] ) license( @@ -29,75 +14,1188 @@ license( licenses(["notice"]) -exports_files(["LICENSE"]) +exports_files([ + "LICENSE", + "MODULE.bazel", +]) + +gz_export_header( + name = "Export", + out = "include/gz/math/Export.hh", + export_base = "GZ_MATH", + lib_name = "gz-math", +) gz_configure_header( name = "config", src = "include/gz/math/config.hh.in", - cmakelists = ["CMakeLists.txt"], - package = "math", + package_xml = "package.xml", ) -gz_export_header( - name = "include/gz/math/Export.hh", - export_base = "GZ_MATH", - lib_name = "gz-math", - visibility = ["//visibility:private"], +cc_library( + name = "AdditivelySeparableScalarField3", + hdrs = ["include/gz/math/AdditivelySeparableScalarField3.hh"], + includes = ["include"], + deps = [ + ":Region3", + ], ) -public_headers_no_gen = glob([ - "include/gz/math/*.hh", - "include/gz/math/detail/*.hh", - "include/gz/math/graph/*.hh", -]) +cc_test( + name = "AdditivelySeparableScalarField3_TEST", + srcs = ["src/AdditivelySeparableScalarField3_TEST.cc"], + deps = [ + ":AdditivelySeparableScalarField3", + ":Polynomial3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Angle", + srcs = ["src/Angle.cc"], + hdrs = ["include/gz/math/Angle.hh"], + includes = ["include"], + deps = [":Helpers"], +) + +cc_test( + name = "Angle_TEST", + srcs = ["src/Angle_TEST.cc"], + deps = [ + ":Angle", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "AxisAlignedBox", + srcs = ["src/AxisAlignedBox.cc"], + hdrs = ["include/gz/math/AxisAlignedBox.hh"], + includes = ["include"], + deps = [ + ":Helpers", + ":Line3", + ":MassMatrix3", + ":config", + ], +) + +cc_test( + name = "AxisAlignedBox_TEST", + srcs = ["src/AxisAlignedBox_TEST.cc"], + deps = [ + ":AxisAlignedBox", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Box", + hdrs = [ + "include/gz/math/Box.hh", + "include/gz/math/detail/Box.hh", + "include/gz/math/detail/WellOrderedVector.hh", + ], + includes = ["include"], + deps = [ + ":Line2", + ":MassMatrix3", + ":Plane", + ":Triangle3", + ":config", + ], +) + +cc_test( + name = "Box_TEST", + srcs = ["src/Box_TEST.cc"], + deps = [ + ":Box", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Capsule", + hdrs = [ + "include/gz/math/Capsule.hh", + "include/gz/math/detail/Capsule.hh", + ], + includes = ["include"], + deps = [ + ":Inertial", + ":MassMatrix3", + ], +) + +cc_test( + name = "Capsule_TEST", + srcs = ["src/Capsule_TEST.cc"], + deps = [ + ":Capsule", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Color", + srcs = ["src/Color.cc"], + hdrs = [ + "include/gz/math/Color.hh", + ], + includes = ["include"], + deps = [ + ":Helpers", + ":Vector3", + ], +) + +cc_test( + name = "Color_TEST", + srcs = ["src/Color_TEST.cc"], + deps = [ + ":Color", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Cone", + hdrs = [ + "include/gz/math/Cone.hh", + "include/gz/math/detail/Cone.hh", + ], + includes = ["include"], + deps = [ + ":MassMatrix3", + ], +) + +cc_test( + name = "Cone_TEST", + srcs = ["src/Cone_TEST.cc"], + deps = [ + ":Cone", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "CoordinateVector3", + srcs = ["src/CoordinateVector3.cc"], + hdrs = ["include/gz/math/CoordinateVector3.hh"], + includes = ["include"], + deps = [ + ":Angle", + ":Vector3", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "CoordinateVector3_TEST", + srcs = ["src/CoordinateVector3_TEST.cc"], + deps = [ + ":CoordinateVector3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Cylinder", + hdrs = [ + "include/gz/math/Cylinder.hh", + "include/gz/math/detail/Cylinder.hh", + ], + includes = ["include"], + deps = [ + ":MassMatrix3", + ], +) + +cc_test( + name = "Cylinder_TEST", + srcs = ["src/Cylinder_TEST.cc"], + deps = [ + ":Cylinder", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "DiffDriveOdometry", + srcs = ["src/DiffDriveOdometry.cc"], + hdrs = [ + "include/gz/math/DiffDriveOdometry.hh", + ], + includes = ["include"], + deps = [ + ":Angle", + ":RollingMean", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "DiffDriveOdometry_TEST", + srcs = ["src/DiffDriveOdometry_TEST.cc"], + deps = [ + ":DiffDriveOdometry", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Ellipsoid", + hdrs = [ + "include/gz/math/Ellipsoid.hh", + "include/gz/math/detail/Ellipsoid.hh", + ], + includes = ["include"], + deps = [ + ":Inertial", + ":MassMatrix3", + ], +) + +cc_test( + name = "Ellipsoid_TEST", + srcs = ["src/Ellipsoid_TEST.cc"], + deps = [ + ":Ellipsoid", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Filter", + hdrs = ["include/gz/math/Filter.hh"], + includes = ["include"], + deps = [ + ":Helpers", + ":Quaternion", + ":Vector3", + ], +) + +cc_test( + name = "Filter_TEST", + srcs = ["src/Filter_TEST.cc"], + deps = [ + ":Filter", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Frustum", + srcs = ["src/Frustum.cc"], + hdrs = ["include/gz/math/Frustum.hh"], + includes = ["include"], + deps = [ + ":Angle", + ":AxisAlignedBox", + ":Matrix4", + ":Plane", + ":Pose3", + ], +) + +cc_test( + name = "Frustum_TEST", + srcs = ["src/Frustum_TEST.cc"], + deps = [ + ":Frustum", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "GaussMarkovProcess", + srcs = ["src/GaussMarkovProcess.cc"], + hdrs = ["include/gz/math/GaussMarkovProcess.hh"], + includes = ["include"], + deps = [ + ":Export", + ":Rand", + ":config", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "GaussMarkovProcess_TEST", + srcs = ["src/GaussMarkovProcess_TEST.cc"], + deps = [ + ":GaussMarkovProcess", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Helpers", + srcs = ["src/Helpers.cc"], + hdrs = ["include/gz/math/Helpers.hh"], + includes = ["include"], + deps = [ + ":Export", + ":config", + "@gz-utils//:NeverDestroyed", + ], +) + +cc_test( + name = "Helpers_TEST", + srcs = ["src/Helpers_TEST.cc"], + deps = [ + ":Helpers", + ":Rand", + ":Vector3", + "@googletest//:gtest_main", + "@gz-utils//:SuppressWarning", + ], +) + +cc_library( + name = "Inertial", + hdrs = ["include/gz/math/Inertial.hh"], + includes = ["include"], + deps = [ + ":MassMatrix3", + ":Matrix6", + ":Pose3", + ":config", + ], +) + +cc_test( + name = "Inertial_TEST", + srcs = ["src/Inertial_TEST.cc"], + deps = [ + ":Inertial", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "InterpolationPoint", + hdrs = [ + "include/gz/math/detail/AxisIndex.hh", + "include/gz/math/detail/InterpolationPoint.hh", + ], + includes = ["include"], + deps = [ + ":Vector2", + ":Vector3", + ], +) + +cc_test( + name = "InterpolationPoint_TEST", + srcs = ["src/InterpolationPoint_TEST.cc"], + deps = [ + ":InterpolationPoint", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Interval", + hdrs = ["include/gz/math/Interval.hh"], + includes = ["include"], + deps = [ + ":config", + ], +) -private_headers = glob(["src/*.hh"]) +cc_test( + name = "Interval_TEST", + srcs = ["src/Interval_TEST.cc"], + deps = [ + ":Interval", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Kmeans", + srcs = [ + "src/Kmeans.cc", + "src/KmeansPrivate.hh", + ], + hdrs = ["include/gz/math/Kmeans.hh"], + includes = ["include"], + deps = [ + ":Rand", + ":Vector3", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "Kmeans_TEST", + srcs = ["src/Kmeans_TEST.cc"], + deps = [ + ":Kmeans", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Line2", + hdrs = ["include/gz/math/Line2.hh"], + includes = ["include"], + deps = [ + ":Vector2", + ], +) + +cc_test( + name = "Line2_TEST", + srcs = ["src/Line2_TEST.cc"], + deps = [ + ":Line2", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Line3", + hdrs = ["include/gz/math/Line3.hh"], + includes = ["include"], + deps = [ + ":Vector3", + ], +) + +cc_test( + name = "Line3_TEST", + srcs = ["src/Line3_TEST.cc"], + deps = [ + ":Line3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "MassMatrix3", + hdrs = ["include/gz/math/MassMatrix3.hh"], + includes = ["include"], + deps = [ + ":Material", + ":Quaternion", + ":Vector2", + ], +) + +cc_test( + name = "MassMatrix3_TEST", + srcs = ["src/MassMatrix3_TEST.cc"], + deps = [ + ":MassMatrix3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "MaterialType", + hdrs = ["include/gz/math/MaterialType.hh"], + includes = ["include"], +) -sources = glob( - ["src/*.cc"], - exclude = ["src/*_TEST.cc"], +cc_library( + name = "Material", + srcs = [ + "src/Material.cc", + "src/MaterialType.hh", + ], + hdrs = ["include/gz/math/Material.hh"], + includes = ["include"], + deps = [ + ":Export", + ":Helpers", + ":MaterialType", + ":config", + "@gz-utils//:ImplPtr", + ], ) -gz_include_header( - name = "mathhh_genrule", - out = "include/gz/math.hh", - hdrs = public_headers_no_gen + [ - "include/gz/math/config.hh", - "include/gz/math/Export.hh", +cc_library( + name = "Matrix3", + hdrs = ["include/gz/math/Matrix3.hh"], + includes = ["include"], + deps = [ + ":Vector3", ], ) -public_headers = public_headers_no_gen + [ - "include/gz/math/config.hh", - "include/gz/math/Export.hh", - "include/gz/math.hh", -] +cc_test( + name = "Matrix3_TEST", + srcs = ["src/Matrix3_TEST.cc"], + deps = [ + ":Helpers", + ":Matrix3", + ":Quaternion", + "@googletest//:gtest_main", + ], +) cc_library( - name = "math", - srcs = sources + private_headers, - hdrs = public_headers, + name = "Matrix4", + hdrs = ["include/gz/math/Matrix4.hh"], includes = ["include"], deps = [ - GZ_ROOT + "utils", + ":Matrix3", + ":Pose3", + ":Quaternion", + ":Vector3", ], ) -test_sources = glob( - [ - "src/*_TEST.cc", - "src/graph/*_TEST.cc", +cc_test( + name = "Matrix4_TEST", + srcs = ["src/Matrix4_TEST.cc"], + deps = [ + ":Matrix4", + "@googletest//:gtest_main", ], ) -[cc_test( - name = src.replace("/", "_").replace(".cc", "").replace("src_", ""), - srcs = [src], +cc_library( + name = "Matrix6", + hdrs = ["include/gz/math/Matrix6.hh"], + includes = ["include"], deps = [ - ":math", - "@gtest", - "@gtest//:gtest_main", + ":Matrix3", + ":Vector3", ], -) for src in test_sources] +) + +cc_test( + name = "Matrix6_TEST", + srcs = ["src/Matrix6_TEST.cc"], + deps = [ + ":Helpers", + ":Matrix6", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "MecanumDriveOdometry", + srcs = ["src/MecanumDriveOdometry.cc"], + hdrs = ["include/gz/math/MecanumDriveOdometry.hh"], + includes = ["include"], + deps = [ + ":Angle", + ":RollingMean", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "MecanumDriveOdometry_TEST", + srcs = ["src/MecanumDriveOdometry_TEST.cc"], + deps = [ + ":MecanumDriveOdometry", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "MovingWindowFilter", + hdrs = ["include/gz/math/MovingWindowFilter.hh"], + includes = ["include"], + deps = [ + "@gz-utils//:SuppressWarning", + ], +) + +cc_test( + name = "MovingWindowFilter_TEST", + srcs = ["src/MovingWindowFilter_TEST.cc"], + deps = [ + ":MovingWindowFilter", + ":Vector3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "OrientedBox", + hdrs = ["include/gz/math/OrientedBox.hh"], + includes = ["include"], + deps = [ + ":MassMatrix3", + ":Matrix4", + ], +) + +cc_test( + name = "OrientedBox_TEST", + srcs = ["src/OrientedBox_TEST.cc"], + deps = [ + ":Angle", + ":OrientedBox", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "PID", + srcs = ["src/PID.cc"], + hdrs = ["include/gz/math/PID.hh"], + includes = ["include"], + deps = [ + ":Helpers", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "PID_TEST", + srcs = ["src/PID_TEST.cc"], + deps = [ + ":Angle", + ":PID", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "PiecewiseScalarField3", + hdrs = ["include/gz/math/PiecewiseScalarField3.hh"], + includes = ["include"], +) + +cc_test( + name = "PiecewiseScalarField3_TEST", + srcs = ["src/PiecewiseScalarField3_TEST.cc"], + deps = [ + ":AdditivelySeparableScalarField3", + ":PiecewiseScalarField3", + ":Polynomial3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Plane", + hdrs = ["include/gz/math/Plane.hh"], + includes = ["include"], + deps = [ + ":AxisAlignedBox", + ":Line2", + ], +) + +cc_test( + name = "Plane_TEST", + srcs = ["src/Plane_TEST.cc"], + deps = [ + ":Helpers", + ":Plane", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Polynomial3", + hdrs = ["include/gz/math/Polynomial3.hh"], + includes = ["include"], + deps = [ + ":Interval", + ":Vector4", + ], +) + +cc_test( + name = "Polynomial3_TEST", + srcs = ["src/Polynomial3_TEST.cc"], + deps = [ + ":Polynomial3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Pose3", + hdrs = ["include/gz/math/Pose3.hh"], + includes = ["include"], + deps = [":Quaternion"], +) + +cc_test( + name = "Pose_TEST", + srcs = ["src/Pose_TEST.cc"], + deps = [ + ":Helpers", + ":Pose3", + "@googletest//:gtest_main", + "@gz-utils//:SuppressWarning", + ], +) + +cc_library( + name = "Quaternion", + hdrs = ["include/gz/math/Quaternion.hh"], + includes = ["include"], + deps = [ + ":Angle", + ":Matrix3", + ":Vector3", + ], +) + +cc_test( + name = "Quaternion_TEST", + srcs = ["src/Quaternion_TEST.cc"], + deps = [ + ":Helpers", + ":Matrix4", + ":Quaternion", + "@googletest//:gtest_main", + "@gz-utils//:SuppressWarning", + ], +) + +cc_library( + name = "Rand", + srcs = ["src/Rand.cc"], + hdrs = ["include/gz/math/Rand.hh"], + includes = ["include"], + deps = [":Helpers"], +) + +cc_test( + name = "Rand_TEST", + srcs = ["src/Rand_TEST.cc"], + deps = [ + ":Rand", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Region3", + hdrs = ["include/gz/math/Region3.hh"], + includes = ["include"], + deps = [ + ":Interval", + ":Vector3", + ], +) + +cc_test( + name = "Region3_TEST", + srcs = ["src/Region3_TEST.cc"], + deps = [ + ":Region3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "RollingMean", + srcs = ["src/RollingMean.cc"], + hdrs = ["include/gz/math/RollingMean.hh"], + includes = ["include"], + deps = [ + ":Export", + ":config", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "RollingMean_TEST", + srcs = ["src/RollingMean_TEST.cc"], + deps = [ + ":Helpers", + ":RollingMean", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "RotationSpline", + srcs = ["src/RotationSpline.cc"], + hdrs = ["include/gz/math/RotationSpline.hh"], + includes = ["include"], + deps = [ + ":Quaternion", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "RotationSpline_TEST", + srcs = ["src/RotationSpline_TEST.cc"], + deps = [ + ":RotationSpline", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "SemanticVersion", + srcs = ["src/SemanticVersion.cc"], + hdrs = ["include/gz/math/SemanticVersion.hh"], + includes = ["include"], + deps = [ + ":Helpers", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "SemanticVersion_TEST", + srcs = ["src/SemanticVersion_TEST.cc"], + deps = [ + ":SemanticVersion", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "SignalStats", + srcs = ["src/SignalStats.cc"], + hdrs = ["include/gz/math/SignalStats.hh"], + includes = ["include"], + deps = [ + ":Helpers", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "SignalStats_TEST", + srcs = ["src/SignalStats_TEST.cc"], + deps = [ + ":Rand", + ":SignalStats", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "SpeedLimiter", + srcs = ["src/SpeedLimiter.cc"], + hdrs = ["include/gz/math/SpeedLimiter.hh"], + includes = ["include"], + deps = [ + ":Helpers", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "SpeedLimiter_TEST", + srcs = ["src/SpeedLimiter_TEST.cc"], + deps = [ + ":SpeedLimiter", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Sphere", + hdrs = [ + "include/gz/math/Sphere.hh", + "include/gz/math/detail/Sphere.hh", + ], + includes = ["include"], + deps = [ + ":MassMatrix3", + ":Plane", + ], +) + +cc_test( + name = "Sphere_TEST", + srcs = ["src/Sphere_TEST.cc"], + deps = [ + ":Sphere", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "SphericalCoordinates", + srcs = ["src/SphericalCoordinates.cc"], + hdrs = ["include/gz/math/SphericalCoordinates.hh"], + includes = ["include"], + deps = [ + ":Angle", + ":CoordinateVector3", + ":Helpers", + ":Matrix3", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "SphericalCoordinates_TEST", + srcs = ["src/SphericalCoordinates_TEST.cc"], + deps = [ + ":SphericalCoordinates", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Spline", + srcs = [ + "src/Spline.cc", + "src/SplinePrivate.cc", + "src/SplinePrivate.hh", + ], + hdrs = ["include/gz/math/Spline.hh"], + includes = ["include"], + deps = [ + ":Matrix4", + ":Vector4", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "Spline_TEST", + srcs = ["src/Spline_TEST.cc"], + deps = [ + ":Spline", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Stopwatch", + srcs = [ + "src/Stopwatch.cc", + ], + hdrs = ["include/gz/math/Stopwatch.hh"], + includes = ["include"], + deps = [ + ":Export", + ":config", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "Stopwatch_TEST", + srcs = ["src/Stopwatch_TEST.cc"], + deps = [ + ":Stopwatch", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Temperature", + srcs = [ + "src/Temperature.cc", + ], + hdrs = ["include/gz/math/Temperature.hh"], + includes = ["include"], + deps = [ + ":Export", + ":Helpers", + ":config", + "@gz-utils//:ImplPtr", + ], +) + +cc_test( + name = "Temperature_TEST", + srcs = ["src/Temperature_TEST.cc"], + deps = [ + ":Temperature", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "TimeVaryingVolumetricGrid", + hdrs = ["include/gz/math/TimeVaryingVolumetricGrid.hh"], + includes = ["include"], + deps = [ + ":TimeVaryingVolumetricGridLookupField", + ], +) + +cc_test( + name = "TimeVaryingVolumetricGrid_TEST", + srcs = ["src/TimeVaryingVolumetricGrid_TEST.cc"], + deps = [ + ":TimeVaryingVolumetricGrid", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "TimeVaryingVolumetricGridLookupField", + hdrs = ["include/gz/math/TimeVaryingVolumetricGridLookupField.hh"], + includes = ["include"], + deps = [ + ":VolumetricGridLookupField", + ], +) + +cc_test( + name = "TimeVaryingVolumetricGridLookupField_TEST", + srcs = ["src/TimeVaryingVolumetricGridLookupField_TEST.cc"], + deps = [ + ":TimeVaryingVolumetricGridLookupField", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Triangle", + hdrs = ["include/gz/math/Triangle.hh"], + includes = ["include"], + deps = [ + ":Helpers", + ":Line2", + ], +) + +cc_test( + name = "Triangle_TEST", + srcs = ["src/Triangle_TEST.cc"], + deps = [ + ":Triangle", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Triangle3", + hdrs = ["include/gz/math/Triangle3.hh"], + includes = ["include"], + deps = [ + ":Helpers", + ":Line3", + ":Plane", + ], +) + +cc_test( + name = "Triangle3_TEST", + srcs = ["src/Triangle3_TEST.cc"], + deps = [ + ":Triangle3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Vector2", + hdrs = ["include/gz/math/Vector2.hh"], + includes = ["include"], + deps = [":Helpers"], +) + +cc_test( + name = "Vector2_TEST", + srcs = ["src/Vector2_TEST.cc"], + deps = [ + ":Helpers", + ":Vector2", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Vector3", + hdrs = ["include/gz/math/Vector3.hh"], + includes = ["include"], + deps = [":Helpers"], +) + +cc_test( + name = "Vector3_TEST", + srcs = ["src/Vector3_TEST.cc"], + deps = [ + ":Vector3", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Vector3Stats", + srcs = ["src/Vector3Stats.cc"], + hdrs = ["include/gz/math/Vector3Stats.hh"], + includes = ["include"], + deps = [ + ":Helpers", + ":SignalStats", + ":Vector3", + ], +) + +cc_test( + name = "Vector3Stats_TEST", + srcs = ["src/Vector3Stats_TEST.cc"], + deps = [ + ":Vector3Stats", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "Vector4", + hdrs = ["include/gz/math/Vector4.hh"], + includes = ["include"], + deps = [ + ":Matrix4", + ], +) + +cc_test( + name = "Vector4_TEST", + srcs = ["src/Vector4_TEST.cc"], + deps = [ + ":Helpers", + ":Vector4", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "VolumetricGridLookupField", + hdrs = ["include/gz/math/VolumetricGridLookupField.hh"], + includes = ["include"], + deps = [ + ":InterpolationPoint", + ":Vector3", + ], +) + +cc_test( + name = "VolumetricGridLookupField_TEST", + srcs = ["src/VolumetricGridLookupField_TEST.cc"], + deps = [ + ":VolumetricGridLookupField", + "@googletest//:gtest_main", + ], +) + +buildifier( + name = "buildifier.fix", + exclude_patterns = ["./.git/*"], + lint_mode = "fix", + mode = "fix", +) + +buildifier_test( + name = "buildifier.test", + exclude_patterns = ["./.git/*"], + lint_mode = "warn", + mode = "diff", + no_sandbox = True, + workspace = "//:MODULE.bazel", +) -add_lint_tests() diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 000000000..f6ef7f6a4 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,24 @@ +## MODULE.bazel +module( + name = "gz-math", + repo_name = "org_gazebosim_gz-math", +) + +bazel_dep(name = "buildifier_prebuilt", version = "6.1.2") +bazel_dep(name = "googletest", version = "1.14.0") +bazel_dep(name = "rules_license", version = "0.0.8") +bazel_dep(name = "eigen", version = "3.4.0") + +# Gazebo Dependencies +bazel_dep(name = "rules_gazebo") +bazel_dep(name = "gz-utils") + +local_path_override( + module_name = "rules_gazebo", + path = "/usr/local/google/home/mjcarroll/workspaces/gz_ionic_bazel/rules_gazebo", +) + +local_path_override( + module_name = "gz-utils", + path = "/usr/local/google/home/mjcarroll/workspaces/gz_ionic_bazel/gz-utils", +) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel new file mode 100644 index 000000000..e69de29bb diff --git a/eigen3/BUILD.bazel b/eigen3/BUILD.bazel index 4107f59b8..17b531532 100644 --- a/eigen3/BUILD.bazel +++ b/eigen3/BUILD.bazel @@ -1,48 +1,3 @@ -load( - "@gz//bazel/skylark:build_defs.bzl", - "GZ_ROOT", - "GZ_VISIBILITY", - "gz_include_header", +package( + default_applicable_licenses = ["//:license"], ) - -package(default_applicable_licenses = [GZ_ROOT + "math:license"]) - -public_headers = glob([ - "include/gz/math/eigen3/*.hh", -]) - -gz_include_header( - name = "eigen3_hh_genrule", - out = "include/gz/math/eigen3.hh", - hdrs = public_headers, -) - -cc_library( - name = "eigen3", - srcs = public_headers, - hdrs = public_headers + [ - "include/gz/math/eigen3.hh", - ], - includes = ["include"], - visibility = GZ_VISIBILITY, - deps = [ - GZ_ROOT + "math", - "@eigen3", - ], -) - -test_sources = glob( - [ - "src/*_TEST.cc", - ], -) - -[cc_test( - name = src.replace("/", "_").replace(".cc", "").replace("src_", ""), - srcs = [src], - deps = [ - ":eigen3", - "@gtest", - "@gtest//:gtest_main", - ], -) for src in test_sources] diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel deleted file mode 100644 index c3902e6a3..000000000 --- a/examples/BUILD.bazel +++ /dev/null @@ -1,23 +0,0 @@ -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() diff --git a/include/gz/math/Matrix3.hh b/include/gz/math/Matrix3.hh index 3f27b072b..e257f20a2 100644 --- a/include/gz/math/Matrix3.hh +++ b/include/gz/math/Matrix3.hh @@ -21,9 +21,8 @@ #include #include #include -#include -#include #include +#include namespace gz::math { diff --git a/test/BUILD.bazel b/test/BUILD.bazel index 9000f4abc..e69de29bb 100644 --- a/test/BUILD.bazel +++ b/test/BUILD.bazel @@ -1,13 +0,0 @@ -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()