Skip to content

Commit

Permalink
Merge pull request #47 from jwnimmer-tri/normal_estimation
Browse files Browse the repository at this point in the history
Normal estimation
  • Loading branch information
RussTedrake authored Sep 15, 2022
2 parents 6e669af + c3661c4 commit 87a1806
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 8 deletions.
2 changes: 1 addition & 1 deletion perception/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ drake_cc_library(
deps = [
"//common:unused",
"@abseil_cpp_internal//absl/container:flat_hash_map",
"@nanoflann",
"@nanoflann_internal//:nanoflann",
],
)

Expand Down
2 changes: 1 addition & 1 deletion perception/point_cloud.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include <vector>

#include "absl/container/flat_hash_map.h"
#include <drake_vendor/nanoflann.hpp>
#include <fmt/format.h>
#include <fmt/ostream.h>
#include <nanoflann.hpp>

#include "drake/common/drake_assert.h"
#include "drake/common/drake_throw.h"
Expand Down
1 change: 1 addition & 0 deletions tools/workspace/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ _DRAKE_EXTERNAL_PACKAGE_INSTALLS = ["@%s//:install" % p for p in [
"meshcat_python",
"msgpack_lite_js",
"net_sf_jchart2d",
"nanoflann_internal",
"nlopt_internal",
"org_apache_xmlgraphics_commons",
"petsc",
Expand Down
6 changes: 3 additions & 3 deletions tools/workspace/default.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ load("@drake//tools/workspace/msgpack:repository.bzl", "msgpack_repository")
load("@drake//tools/workspace/msgpack_lite_js:repository.bzl", "msgpack_lite_js_repository") # noqa
load("@drake//tools/workspace/mypy_extensions_internal:repository.bzl", "mypy_extensions_internal_repository") # noqa
load("@drake//tools/workspace/mypy_internal:repository.bzl", "mypy_internal_repository") # noqa
load("@drake//tools/workspace/nanoflann:repository.bzl", "nanoflann_repository") # noqa
load("@drake//tools/workspace/nanoflann_internal:repository.bzl", "nanoflann_internal_repository") # noqa
load("@drake//tools/workspace/net_sf_jchart2d:repository.bzl", "net_sf_jchart2d_repository") # noqa
load("@drake//tools/workspace/nlopt:repository.bzl", "nlopt_repository")
load("@drake//tools/workspace/nlopt_internal:repository.bzl", "nlopt_internal_repository") # noqa
Expand Down Expand Up @@ -278,8 +278,8 @@ def add_default_repositories(excludes = [], mirrors = DEFAULT_MIRRORS):
mypy_extensions_internal_repository(name = "mypy_extensions_internal", mirrors = mirrors) # noqa
if "mypy_internal" not in excludes:
mypy_internal_repository(name = "mypy_internal", mirrors = mirrors)
if "nanoflann" not in excludes:
nanoflann_repository(name = "nanoflann", mirrors = mirrors)
if "nanoflann_internal" not in excludes:
nanoflann_internal_repository(name = "nanoflann_internal", mirrors = mirrors) # noqa
if "net_sf_jchart2d" not in excludes:
net_sf_jchart2d_repository(name = "net_sf_jchart2d", mirrors = mirrors)
if "nlopt" not in excludes:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ package(default_visibility = ["//visibility:public"])
cc_library(
name = "nanoflann",
hdrs = ["include/nanoflann.hpp"],
includes = ["include"],
deps = [],
include_prefix = "drake_vendor",
strip_include_prefix = "include",
linkstatic = 1,
)

Expand Down
21 changes: 21 additions & 0 deletions tools/workspace/nanoflann_internal/patches/namespace.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Add a drake_vendor namespace ala tools/workspace/vendor_cxx

This prevents link-time symbol conflicts in case code downstream of
Drake wants to use a different build of nanoflann.

--- include/nanoflann.hpp.orig
+++ include/nanoflann.hpp
@@ -70,6 +70,7 @@
#endif
#endif

+inline namespace drake_vendor __attribute__ ((visibility ("hidden"))) {
namespace nanoflann
{
/** @addtogroup nanoflann_grp nanoflann C++ library for ANN
@@ -2414,3 +2415,4 @@

/** @} */ // end of grouping
} // namespace nanoflann
+} // namespace drake_vendor
\ No newline at end of file
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

load("@drake//tools/workspace:github.bzl", "github_archive")

def nanoflann_repository(
def nanoflann_internal_repository(
name,
mirrors = None):
github_archive(
Expand All @@ -11,5 +11,8 @@ def nanoflann_repository(
commit = "v1.4.3",
sha256 = "cbcecf22bec528a8673a113ee9b0e134f91f1f96be57e913fa1f74e98e4449fa", # noqa
build_file = ":package.BUILD.bazel",
patches = [
":patches/namespace.patch",
],
mirrors = mirrors,
)

0 comments on commit 87a1806

Please sign in to comment.