From 09d5b9471e92caf8b8a76c17c01e3ffa15dea662 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 25 Aug 2021 22:01:01 -0400 Subject: [PATCH] cmake: allow VTK to skip soname links for libraries VTK's wheels do not want these symlinks because they are useless in Python wheels. --- CMake/VTKmWrappers.cmake | 8 +++++--- CMakeLists.txt | 5 +++++ docs/changelog/skip-library-versions.md | 8 ++++++++ vtkm/thirdparty/lodepng/CMakeLists.txt | 9 +++++++-- 4 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 docs/changelog/skip-library-versions.md diff --git a/CMake/VTKmWrappers.cmake b/CMake/VTKmWrappers.cmake index ab58e9941..25c2274cb 100644 --- a/CMake/VTKmWrappers.cmake +++ b/CMake/VTKmWrappers.cmake @@ -431,9 +431,11 @@ function(vtkm_library) set_property(TARGET ${lib_name} PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) endif() - # Setup the SOVERSION and VERSION information for this vtkm library - set_property(TARGET ${lib_name} PROPERTY VERSION 1) - set_property(TARGET ${lib_name} PROPERTY SOVERSION 1) + if (NOT VTKm_SKIP_LIBRARY_VERSIONS) + # Setup the SOVERSION and VERSION information for this vtkm library + set_property(TARGET ${lib_name} PROPERTY VERSION 1) + set_property(TARGET ${lib_name} PROPERTY SOVERSION 1) + endif () # Support custom library suffix names, for other projects wanting to inject # their own version numbers etc. diff --git a/CMakeLists.txt b/CMakeLists.txt index c579a510f..b618a579c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,6 +157,10 @@ vtkm_option(VTKm_NO_INSTALL_README_LICENSE "disable the installation of README a # and this option will be removed. vtkm_option(VTKm_NO_DEPRECATED_VIRTUAL "Do not compile support of deprecated virtual methods" OFF) +# In Python wheels, having SONAME suffixes just ends up duplicating files. +# Allow VTK to turn off these symlinks for its wheel distribution. +vtkm_option(VTKm_SKIP_LIBRARY_VERSIONS "Skip versioning VTK-m libraries" OFF) + mark_as_advanced( VTKm_ENABLE_LOGGING VTKm_NO_ASSERT @@ -167,6 +171,7 @@ mark_as_advanced( VTKm_ENABLE_DEVELOPER_FLAGS VTKm_NO_INSTALL_README_LICENSE VTKm_NO_DEPRECATED_VIRTUAL + VTKm_SKIP_LIBRARY_VERSIONS ) #----------------------------------------------------------------------------- diff --git a/docs/changelog/skip-library-versions.md b/docs/changelog/skip-library-versions.md new file mode 100644 index 000000000..b6afae2f7 --- /dev/null +++ b/docs/changelog/skip-library-versions.md @@ -0,0 +1,8 @@ +# skip library versions + +The `VTKm_SKIP_LIBRARY_VERSIONS` variable is now available to skip the SONAME +and SOVERSION fields (or the equivalent for non-ELF platforms). + +Some deployments (e.g., Python wheels or Java `.jar` files) do not support +symlinks reliably and the way the libraries get loaded just leads to +unnecessary files in the packaged artifact. diff --git a/vtkm/thirdparty/lodepng/CMakeLists.txt b/vtkm/thirdparty/lodepng/CMakeLists.txt index d86bcb80e..064aea2f9 100644 --- a/vtkm/thirdparty/lodepng/CMakeLists.txt +++ b/vtkm/thirdparty/lodepng/CMakeLists.txt @@ -30,10 +30,15 @@ set_target_properties(vtkm_lodepng LIBRARY_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH} ARCHIVE_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH} RUNTIME_OUTPUT_DIRECTORY ${VTKm_EXECUTABLE_OUTPUT_PATH} - VERSION 1 - SOVERSION 1 POSITION_INDEPENDENT_CODE ON ) +if (NOT VTKm_SKIP_LIBRARY_VERSIONS) + set_target_properties(vtkm_lodepng + PROPERTIES + VERSION 1 + SOVERSION 1 + ) +endif () target_include_directories(vtkm_lodepng INTERFACE $ $