|
| 1 | +load("@cmake_configure_file//:cmake_configure_file.bzl", "cmake_configure_file") |
| 2 | +load("@rules_cc//cc:cc_test.bzl", "cc_test") |
| 3 | +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") |
| 4 | + |
| 5 | +package(default_visibility = ["//visibility:public"]) |
| 6 | + |
| 7 | +# Define the required headers to be generated. |
| 8 | +cmake_configure_file( |
| 9 | + name = "config_header", |
| 10 | + src = "cmake/config.hh.cmake", |
| 11 | + out = "include/pinocchio/config.hpp", |
| 12 | + cmakelists = ["CMakeLists.txt"], |
| 13 | + defines = [ |
| 14 | + "LIBRARY_NAME=" + module_name().upper(), |
| 15 | + "PROJECT_VERSION=" + module_version(), |
| 16 | + "PROJECT_VERSION_MAJOR_CONFIG=" + module_version().split(".")[0], |
| 17 | + "PROJECT_VERSION_MINOR_CONFIG=" + module_version().split(".")[1], |
| 18 | + "PROJECT_VERSION_PATCH_CONFIG=" + module_version().split(".")[2], |
| 19 | + "EXPORT_SYMBOL=" + module_name().upper() + "_EXPORTS", |
| 20 | + ], |
| 21 | + visibility = ["//visibility:private"], |
| 22 | +) |
| 23 | + |
| 24 | +cmake_configure_file( |
| 25 | + name = "deprecated_header", |
| 26 | + src = "cmake/deprecated.hh.cmake", |
| 27 | + out = "include/pinocchio/deprecated.hpp", |
| 28 | + cmakelists = ["CMakeLists.txt"], |
| 29 | + defines = [ |
| 30 | + "PACKAGE_CPPNAME=" + module_name().upper(), |
| 31 | + ], |
| 32 | + visibility = ["//visibility:private"], |
| 33 | +) |
| 34 | + |
| 35 | +cmake_configure_file( |
| 36 | + name = "warning_header", |
| 37 | + src = "cmake/warning.hh.cmake", |
| 38 | + out = "include/pinocchio/warning.hpp", |
| 39 | + cmakelists = ["CMakeLists.txt"], |
| 40 | + defines = [ |
| 41 | + "PACKAGE_CPPNAME=" + module_name().upper(), |
| 42 | + ], |
| 43 | + visibility = ["//visibility:private"], |
| 44 | +) |
| 45 | + |
| 46 | +filegroup( |
| 47 | + name = "pinocchio_models", |
| 48 | + srcs = glob(["models/**/*"]), |
| 49 | +) |
| 50 | + |
| 51 | +cc_library( |
| 52 | + name = "pinocchio", |
| 53 | + srcs = glob(["src/**/*.cpp"]), |
| 54 | + hdrs = glob( |
| 55 | + [ |
| 56 | + "include/**/*.hpp", |
| 57 | + "include/**/*.hxx", |
| 58 | + ], |
| 59 | + exclude = ["include/pinocchio/bindings/**/*"], |
| 60 | + ) + [ |
| 61 | + ":config_header", |
| 62 | + ":deprecated_header", |
| 63 | + ":warning_header", |
| 64 | + ], |
| 65 | + copts = ["-DPINOCCHIO_URDFDOM_USE_STD_SHARED_PTR"], |
| 66 | + includes = ["include/"], |
| 67 | + deps = [ |
| 68 | + "@boost.algorithm//:boost.algorithm", |
| 69 | + "@boost.asio//:boost.asio", |
| 70 | + "@boost.bind//:boost.bind", |
| 71 | + "@boost.filesystem//:boost.filesystem", |
| 72 | + "@boost.foreach//:boost.foreach", |
| 73 | + "@boost.format//:boost.format", |
| 74 | + "@boost.fusion//:boost.fusion", |
| 75 | + "@boost.integer//:boost.integer", |
| 76 | + "@boost.iostreams//:boost.iostreams", |
| 77 | + "@boost.math//:boost.math", |
| 78 | + "@boost.property_tree//:boost.property_tree", |
| 79 | + "@boost.serialization//:boost.serialization", |
| 80 | + "@boost.type_traits//:boost.type_traits", |
| 81 | + "@boost.variant//:boost.variant", |
| 82 | + "@eigen", |
| 83 | + "@sdformat//:urdf_parser", |
| 84 | + ], |
| 85 | +) |
| 86 | + |
| 87 | +# Alias for backwards compatibility |
| 88 | +alias( |
| 89 | + name = "pinocchio_includes", |
| 90 | + actual = ":pinocchio", |
| 91 | +) |
| 92 | + |
| 93 | +BINARY_DEPS = [ |
| 94 | + ":pinocchio", |
| 95 | + "@eigen//:eigen", |
| 96 | +] |
| 97 | + |
| 98 | +# Core examples |
| 99 | +[ |
| 100 | + cc_binary( |
| 101 | + name = name, |
| 102 | + srcs = [src], |
| 103 | + deps = BINARY_DEPS, |
| 104 | + ) |
| 105 | + for name, src in { |
| 106 | + "build-reduced-model": "examples/build-reduced-model.cpp", |
| 107 | + "forward-dynamics-derivatives": "examples/forward-dynamics-derivatives.cpp", |
| 108 | + "geometry-models": "examples/geometry-models.cpp", |
| 109 | + "interpolation-SE3": "examples/interpolation-SE3.cpp", |
| 110 | + "inverse-dynamics-derivatives": "examples/inverse-dynamics-derivatives.cpp", |
| 111 | + "inverse-kinematics": "examples/inverse-kinematics.cpp", |
| 112 | + "kinematics-derivatives": "examples/kinematics-derivatives.cpp", |
| 113 | + "overview-SE3": "examples/overview-SE3.cpp", |
| 114 | + "overview-lie": "examples/overview-lie.cpp", |
| 115 | + "overview-simple": "examples/overview-simple.cpp", |
| 116 | + "overview-urdf": "examples/overview-urdf.cpp", |
| 117 | + }.items() |
| 118 | +] |
| 119 | + |
| 120 | +TEST_DEPS = [ |
| 121 | + ":pinocchio", |
| 122 | + "@boost.test//:boost.test", |
| 123 | + "@eigen//:eigen", |
| 124 | +] |
| 125 | + |
| 126 | +COMMON_TEST_HEADERS = [ |
| 127 | + "unittest/utils/macros.hpp", |
| 128 | + "unittest/utils/model-generator.hpp", |
| 129 | +] |
| 130 | + |
| 131 | +[ |
| 132 | + cc_test( |
| 133 | + name = name, |
| 134 | + srcs = [src] + COMMON_TEST_HEADERS, |
| 135 | + deps = TEST_DEPS, |
| 136 | + ) |
| 137 | + for name, src in { |
| 138 | + "aba-derivatives_test": "unittest/aba-derivatives.cpp", |
| 139 | + "aba_test": "unittest/aba.cpp", |
| 140 | + "algo-check_test": "unittest/algo-check.cpp", |
| 141 | + "all-joints_test": "unittest/all-joints.cpp", |
| 142 | + "cartesian-product-liegroups_test": "unittest/cartesian-product-liegroups.cpp", |
| 143 | + "center-of-mass-derivatives_test": "unittest/center-of-mass-derivatives.cpp", |
| 144 | + "centroidal-derivatives_test": "unittest/centroidal-derivatives.cpp", |
| 145 | + "centroidal_test": "unittest/centroidal.cpp", |
| 146 | + "cholesky_test": "unittest/cholesky.cpp", |
| 147 | + "com_test": "unittest/com.cpp", |
| 148 | + "compute-all-terms_test": "unittest/compute-all-terms.cpp", |
| 149 | + "constraint_test": "unittest/constraint.cpp", |
| 150 | + "contact-dynamics-derivatives_test": "unittest/contact-dynamics-derivatives.cpp", |
| 151 | + "contact-dynamics_test": "unittest/contact-dynamics.cpp", |
| 152 | + "copy_test": "unittest/copy.cpp", |
| 153 | + "crba_test": "unittest/crba.cpp", |
| 154 | + "data_test": "unittest/data.cpp", |
| 155 | + "eigen-basic-op_test": "unittest/eigen-basic-op.cpp", |
| 156 | + "eigen-tensor_test": "unittest/eigen-tensor.cpp", |
| 157 | + "energy_test": "unittest/energy.cpp", |
| 158 | + "explog_test": "unittest/explog.cpp", |
| 159 | + "finite-differences_test": "unittest/finite-differences.cpp", |
| 160 | + "frames-derivatives_test": "unittest/frames-derivatives.cpp", |
| 161 | + "frames_test": "unittest/frames.cpp", |
| 162 | + "joint-composite_test": "unittest/joint-composite.cpp", |
| 163 | + "joint-configurations_test": "unittest/joint-configurations.cpp", |
| 164 | + "joint-free-flyer_test": "unittest/joint-free-flyer.cpp", |
| 165 | + "joint-generic_test": "unittest/joint-generic.cpp", |
| 166 | + "joint-jacobian_test": "unittest/joint-jacobian.cpp", |
| 167 | + "joint-mimic_test": "unittest/joint-mimic.cpp", |
| 168 | + "joint-planar_test": "unittest/joint-planar.cpp", |
| 169 | + "joint-prismatic_test": "unittest/joint-prismatic.cpp", |
| 170 | + "joint-revolute_test": "unittest/joint-revolute.cpp", |
| 171 | + "joint-spherical_test": "unittest/joint-spherical.cpp", |
| 172 | + "joint-translation_test": "unittest/joint-translation.cpp", |
| 173 | + "kinematics-derivatives_test": "unittest/kinematics-derivatives.cpp", |
| 174 | + "kinematics_test": "unittest/kinematics.cpp", |
| 175 | + "liegroups_test": "unittest/liegroups.cpp", |
| 176 | + "macros_test": "unittest/macros.cpp", |
| 177 | + "model_test": "unittest/model.cpp", |
| 178 | + "quaternion_test": "unittest/quaternion.cpp", |
| 179 | + "regressor_test": "unittest/regressor.cpp", |
| 180 | + "rnea-derivatives_test": "unittest/rnea-derivatives.cpp", |
| 181 | + "rnea-second-order-derivatives_test": "unittest/rnea-second-order-derivatives.cpp", |
| 182 | + "rnea_test": "unittest/rnea.cpp", |
| 183 | + "rotation_test": "unittest/rotation.cpp", |
| 184 | + "rpy_test": "unittest/rpy.cpp", |
| 185 | + "sample-models_test": "unittest/sample-models.cpp", |
| 186 | + "symmetric_test": "unittest/symmetric.cpp", |
| 187 | + "vector_test": "unittest/vector.cpp", |
| 188 | + "version_test": "unittest/version.cpp", |
| 189 | + "visitor_test": "unittest/visitor.cpp", |
| 190 | + }.items() |
| 191 | +] |
0 commit comments