From 33e4f6e8686c5db2664310e2e0cde467557dff94 Mon Sep 17 00:00:00 2001 From: Jeremy Nimmer Date: Thu, 12 Oct 2023 06:40:20 -0700 Subject: [PATCH] [workspace] Use hidden symbols for tinyobjloader (#20357) --- tools/install/libdrake/test/exported_symbols_test.py | 1 - tools/workspace/BUILD.bazel | 1 + .../workspace/tinyobjloader_internal/package.BUILD.bazel | 9 +++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/install/libdrake/test/exported_symbols_test.py b/tools/install/libdrake/test/exported_symbols_test.py index 3f88fe93039f..ed732668da40 100644 --- a/tools/install/libdrake/test/exported_symbols_test.py +++ b/tools/install/libdrake/test/exported_symbols_test.py @@ -61,7 +61,6 @@ "MessageHandler", "N3uWS", "N5ofats10any_detail", - "N7tinyobj", "Realpath", "WindowsError", "action", diff --git a/tools/workspace/BUILD.bazel b/tools/workspace/BUILD.bazel index 911f71715ab8..d9d37318c8c0 100644 --- a/tools/workspace/BUILD.bazel +++ b/tools/workspace/BUILD.bazel @@ -54,6 +54,7 @@ drake_py_binary( "@nlopt_internal//:__subpackages__", "@qhull_internal//:__subpackages__", "@sdformat_internal//:__subpackages__", + "@tinyobjloader_internal//:__subpackages__", "@yaml_cpp_internal//:__subpackages__", ], deps = [":module_py"], diff --git a/tools/workspace/tinyobjloader_internal/package.BUILD.bazel b/tools/workspace/tinyobjloader_internal/package.BUILD.bazel index bd77d17066b2..5b93503e1c1a 100644 --- a/tools/workspace/tinyobjloader_internal/package.BUILD.bazel +++ b/tools/workspace/tinyobjloader_internal/package.BUILD.bazel @@ -1,6 +1,6 @@ # -*- bazel -*- -load("@drake//tools/skylark:cc.bzl", "cc_library") +load("@drake//tools/workspace:vendor_cxx.bzl", "cc_library_vendored") load("@drake//tools/install:install.bzl", "install") licenses(["notice"]) # MIT, ISC @@ -9,13 +9,14 @@ package( default_visibility = ["//visibility:public"], ) -cc_library( +cc_library_vendored( name = "tinyobjloader", srcs = ["tiny_obj_loader.cc"], + srcs_vendored = ["drake_src/tiny_obj_loader.cc"], hdrs = ["tiny_obj_loader.h"], + hdrs_vendored = ["drake_hdr/tiny_obj_loader.h"], defines = ["TINYOBJLOADER_USE_DOUBLE=1"], - copts = ["-fvisibility=hidden"], - includes = ["."], + includes = ["drake_hdr"], linkstatic = 1, )