Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/build-scripts/hidesymbols.map
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
global: *OSL*; test_shade; *osl*imageio*; *osl_input_extensions; PyInit*;
global: *OSL*; *osl*imageio*; *osl_input_extensions; PyInit*;
local: osl_*; *pvt*; *;
};
7 changes: 7 additions & 0 deletions src/testshade/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ if (NOT CODECOV)
OUTPUT_NAME libtestshade${OSL_LIBNAME_SUFFIX}
)

# Only libtestshade exports test_shade; keep it out of the global map.
if (VISIBILITY_MAP_COMMAND)
set_property (TARGET libtestshade
APPEND PROPERTY LINK_FLAGS
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/testshade_symbols.map)
endif ()
Comment on lines +115 to +118
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was expecting this to fail on Windows, but it didn't. What's going on? Is cmake smart enough to know that that these linker flags only apply to some platforms and don't put them on the link line elsewher?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only place where VISIBILITY_MAP_COMMAND is defined is:

if (${CMAKE_CXX_VISIBILITY_PRESET} STREQUAL "hidden" AND VISIBILITY_MAP_FILE AND
(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) AND
(CMAKE_SYSTEM_NAME MATCHES "Linux|kFreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "GNU"))
# Linux/FreeBSD/Hurd: also hide all the symbols of dependent libraries
# to prevent clashes if an app using this project is linked against
# other versions of our dependencies.
set (VISIBILITY_MAP_COMMAND "-Wl,--version-script=${VISIBILITY_MAP_FILE}")
endif ()

Which is Linux/FreeBSD/Hurd, not even Cygwin/mingw.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see! So the if (VISIBILITY_MAP_COMMAND) is already implicitly guarding by platform. Great.


target_link_libraries (libtestshade
PRIVATE
oslexec oslquery oslcomp)
Expand Down
4 changes: 4 additions & 0 deletions src/testshade/testshade_symbols.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
global: test_shade;
local: *;
};
Loading