diff --git a/WORKSPACE b/WORKSPACE index 3af4dfa6e5a4..f022d0ccc61c 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -408,9 +408,9 @@ new_local_repository( bitbucket_archive( name = "ignition_math", repository = "ignitionrobotics/ign-math", - commit = "ignition-math3_3.2.0", - sha256 = "1948c1610fa4403bce7ba2a262a29662990ee66aab00882411a0868afe0e5309", # noqa - strip_prefix = "ignitionrobotics-ign-math-e86e5bb392e4", + commit = "392237e10ba4", + sha256 = "44068bb91c07c9305213057cad801ae5b689ac1a5f37cd8330dd6e729df8f5b0", # noqa + strip_prefix = "ignitionrobotics-ign-math-392237e10ba4", build_file = "tools/workspace/ignition_math/ignition_math.BUILD.bazel", ) diff --git a/tools/install/libdrake/BUILD.bazel b/tools/install/libdrake/BUILD.bazel index 4c7900baa98c..a2935b2bd7ef 100644 --- a/tools/install/libdrake/BUILD.bazel +++ b/tools/install/libdrake/BUILD.bazel @@ -124,6 +124,7 @@ cc_library( ":mosek_deps", ":vtk_deps", "@bullet//:BulletCollision", + "@ignition_math", "@lcm", "@libprotobuf", "@scs//:scsdir", diff --git a/tools/install/libdrake/drake.cps b/tools/install/libdrake/drake.cps index 163bc5410d93..fdeb5de65960 100644 --- a/tools/install/libdrake/drake.cps +++ b/tools/install/libdrake/drake.cps @@ -40,9 +40,9 @@ "Hints": ["@prefix@/lib/cmake/gflags"], "X-CMake-Find-Args": ["CONFIG"] }, - "ignition-math3": { - "Version": "3.2.0", - "Hints": ["@prefix@/lib/cmake/ignition-math3"], + "ignition-math4": { + "Version": "4.0.0", + "Hints": ["@prefix@/lib/cmake/ignition-math4"], "X-CMake-Find-Args": ["CONFIG"] }, "ignition-rndf0": { @@ -112,7 +112,7 @@ "Bullet:BulletCollision", "Eigen3:Eigen", "fcl:fcl", - "ignition-math3:ignition-math3", + "ignition-math4:ignition-math4", "ignition-rndf0:ignition-rndf0", "lcm:lcm", "optitrack:lcmtypes_optitrack-cpp", diff --git a/tools/workspace/ignition_math/ignition_math-create-cps.py b/tools/workspace/ignition_math/ignition_math-create-cps.py index 1a355135e9c1..0de44de25060 100644 --- a/tools/workspace/ignition_math/ignition_math-create-cps.py +++ b/tools/workspace/ignition_math/ignition_math-create-cps.py @@ -2,19 +2,19 @@ from drake.tools.install.cpsutils import read_version_defs -def_re = "#define IGNITION_MATH_VERSION_FULL[\s]\"([0-9]+).([0-9]+).([0-9]+)\"" +def_re = "#define IGNITION_MATH_VERSION_FULL[\s]\"([0-9]+).([0-9]+).([0-9]+).*\"" defs = read_version_defs(def_re) content = """ { "Cps-Version": "0.8.0", - "Name": "ignition-math3", + "Name": "ignition-math4", "Description": "Math classes and functions for robot applications", "License": "Apache-2.0", "Version": "%(VERSION_MAJOR)s.%(VERSION_MINOR)s.%(VERSION_PATCH)s", - "Default-Components": [ ":ignition-math3" ], + "Default-Components": [ ":ignition-math4" ], "Components": { - "ignition-math3": { + "ignition-math4": { "Type": "dylib", "Location": "@prefix@/lib/libignition_math.so", "Includes": [ "@prefix@/include" ] diff --git a/tools/workspace/ignition_math/ignition_math.BUILD.bazel b/tools/workspace/ignition_math/ignition_math.BUILD.bazel index 0a230d9f81ab..91fcea80eb6f 100644 --- a/tools/workspace/ignition_math/ignition_math.BUILD.bazel +++ b/tools/workspace/ignition_math/ignition_math.BUILD.bazel @@ -18,33 +18,44 @@ load( "install", "install_cmake_config", ) +load("@drake//tools/workspace:generate_file.bzl", "generate_file") package(default_visibility = ["//visibility:public"]) # Generates config.hh based on the version numbers in CMake code. cmake_configure_file( name = "config", - src = "cmake/config.hh.in", + src = "include/ignition/math/config.hh.in", out = "include/ignition/math/config.hh", cmakelists = ["CMakeLists.txt"], defines = [ - # It would be nice to get this information directly from - # CMakeLists.txt, but it ends up being too hard. ignition-math sets a - # project name as "ignition-math", and then uses CMake - # substring to pick that version out. We'd have to extend the - # cmake_configure_file functionality to do the same, and I'm not sure - # it is worth it. We just hard code the major version here. + "PROJECT_MAJOR_VERSION=4", + "PROJECT_MINOR_VERSION=0", + "PROJECT_PATCH_VERSION=0", + "PROJECT_VERSION=4.0", + "PROJECT_VERSION_FULL=4.0.0~pre3", "PROJECT_NAME_NO_VERSION=ignition-math", - "PROJECT_MAJOR_VERSION=3", - "PROJECT_VERSION_FULL=3.2.0", ], visibility = ["//visibility:private"], ) -public_headers = [ +generate_file( + name = "export_genrule", + out = "include/ignition/math/Export.hh", + content = """ +#pragma once + +#define IGNITION_MATH_VISIBLE __attribute__ ((visibility("default"))) +#define IGN_DEPRECATED(version) __attribute__ ((__deprecated__)) + """, + visibility = ["//visibility:private"], +) + +public_headers_no_gen = [ "include/ignition/math/Angle.hh", "include/ignition/math/Box.hh", "include/ignition/math/Color.hh", + "include/ignition/math/Export.hh", "include/ignition/math/Filter.hh", "include/ignition/math/Frustum.hh", "include/ignition/math/Helpers.hh", @@ -66,7 +77,6 @@ public_headers = [ "include/ignition/math/SignalStats.hh", "include/ignition/math/SphericalCoordinates.hh", "include/ignition/math/Spline.hh", - "include/ignition/math/System.hh", "include/ignition/math/Temperature.hh", "include/ignition/math/Triangle.hh", "include/ignition/math/Triangle3.hh", @@ -74,16 +84,20 @@ public_headers = [ "include/ignition/math/Vector3.hh", "include/ignition/math/Vector3Stats.hh", "include/ignition/math/Vector4.hh", + "include/ignition/math/graph/Edge.hh", + "include/ignition/math/graph/GraphAlgorithms.hh", + "include/ignition/math/graph/Graph.hh", + "include/ignition/math/graph/Vertex.hh", ] private_headers = [ - "include/ignition/math/BoxPrivate.hh", - "include/ignition/math/FrustumPrivate.hh", - "include/ignition/math/KmeansPrivate.hh", - "include/ignition/math/RotationSplinePrivate.hh", - "include/ignition/math/SignalStatsPrivate.hh", - "include/ignition/math/SplinePrivate.hh", - "include/ignition/math/Vector3StatsPrivate.hh", + "src/BoxPrivate.hh", + "src/FrustumPrivate.hh", + "src/KmeansPrivate.hh", + "src/RotationSplinePrivate.hh", + "src/SignalStatsPrivate.hh", + "src/SplinePrivate.hh", + "src/Vector3StatsPrivate.hh", ] # Generates math.hh, which consists of #include statements for all of the @@ -93,22 +107,25 @@ private_headers = [ drake_generate_include_header( name = "mathhh_genrule", out = "include/ignition/math.hh", - hdrs = [":config"] + public_headers, + hdrs = public_headers_no_gen + ["include/ignition/math/config.hh"], ) check_lists_consistency( - file_list = private_headers + public_headers, + file_list = private_headers + public_headers_no_gen, glob = ["include/**/*.hh"], ) +public_headers = public_headers_no_gen + [ + "include/ignition/math/config.hh", + "include/ignition/math.hh", +] + # Generates the library exported to users. The explicitly listed srcs= matches # upstream's explicitly listed sources plus private headers. The explicitly # listed hdrs= matches upstream's public headers. -cc_library( - name = "ignition_math", +cc_binary( + name = "libignition_math.so", srcs = [ - "include/ignition/math.hh", - "include/ignition/math/config.hh", # created above "src/Angle.cc", "src/Box.cc", "src/Color.cc", @@ -126,13 +143,21 @@ cc_library( "src/SplinePrivate.cc", "src/Temperature.cc", "src/Vector3Stats.cc", - ] + private_headers, + ] + private_headers + public_headers, + includes = ["include"], + linkshared = 1, + visibility = [], +) + +cc_library( + name = "ignition_math", + srcs = ["libignition_math.so"], hdrs = public_headers, includes = ["include"], visibility = ["//visibility:public"], ) -CMAKE_PACKAGE = "ignition-math3" +CMAKE_PACKAGE = "ignition-math4" cmake_config( package = CMAKE_PACKAGE, @@ -146,11 +171,8 @@ install_cmake_config(package = CMAKE_PACKAGE) install( name = "install", workspace = CMAKE_PACKAGE, - targets = [":ignition_math"], - hdrs = public_headers + [ - ":config", - ":mathhh_genrule", - ], + targets = [":libignition_math.so"], + hdrs = public_headers, hdr_strip_prefix = ["include"], docs = [ "COPYING", diff --git a/tools/workspace/ignition_rndf/ignition_rndf-create-cps.py b/tools/workspace/ignition_rndf/ignition_rndf-create-cps.py index 2316a1bc9ed4..b05f029398d7 100644 --- a/tools/workspace/ignition_rndf/ignition_rndf-create-cps.py +++ b/tools/workspace/ignition_rndf/ignition_rndf-create-cps.py @@ -14,9 +14,9 @@ "License": "Apache-2.0", "Version": "%(MAJOR_VERSION)s.%(MINOR_VERSION)s.%(PATCH_VERSION)s", "Requires": { - "ignition-math3": { - "Version": "%(ignition-math3_VERSION)s", - "Hints": ["@prefix@/lib/cmake/ignition-math3"], + "ignition-math4": { + "Version": "%(ignition-math4_VERSION)s", + "Hints": ["@prefix@/lib/cmake/ignition-math4"], "X-CMake-Find-Args": [ "CONFIG" ] } }, @@ -26,7 +26,7 @@ "Type": "dylib", "Location": "@prefix@/lib/libignition_rndf.so", "Includes": [ "@prefix@/include" ], - "Requires": [ "ignition-math3:ignition-math3" ] + "Requires": [ "ignition-math4:ignition-math4" ] } } } diff --git a/tools/workspace/sdformat/sdformat-create-cps.py b/tools/workspace/sdformat/sdformat-create-cps.py index 98638b3f5b9d..ce749c842fd3 100644 --- a/tools/workspace/sdformat/sdformat-create-cps.py +++ b/tools/workspace/sdformat/sdformat-create-cps.py @@ -18,10 +18,10 @@ "Version": "1.58", "X-CMake-Find-Args": ["MODULE"] }, - "ignition-math3": { - "Version": "%(ignition-math3_VERSION)s", - "Hints": ["@prefix@/lib/cmake/ignition-math3"], - "X-CMake-Find-Args": ["CONFIG"] + "ignition-math4": { + "Version": "%(ignition-math4_VERSION)s", + "Hints": ["@prefix@/lib/cmake/ignition-math4"], + "X-CMake-Find-Args": [ "CONFIG" ] } }, "Default-Components": [ ":sdformat" ], @@ -33,7 +33,7 @@ "Link-Flags": ["-ltinyxml"], "Requires": [ "Boost:boost", - "ignition-math3:ignition-math3" + "ignition-math4:ignition-math4" ] } }