From 215837697defcb69fa59d911d6ab7fce677044e9 Mon Sep 17 00:00:00 2001 From: Ryan Mast Date: Fri, 2 Feb 2024 23:18:07 -0800 Subject: [PATCH] Slim down binary wheels --- helics_apps-pip/CMakeLists.txt | 37 ++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/helics_apps-pip/CMakeLists.txt b/helics_apps-pip/CMakeLists.txt index cd70c48..8e5efd7 100644 --- a/helics_apps-pip/CMakeLists.txt +++ b/helics_apps-pip/CMakeLists.txt @@ -27,14 +27,39 @@ if(DEFINED ENV{CIBUILDWHEEL} AND HELICS_DOWNLOAD_URL AND SKBUILD_STATE STREQUAL URL ${HELICS_DOWNLOAD_URL} ) FetchContent_MakeAvailable(helics-bin) + # Only include the things we actually need for the helics_apps in the wheels to minimize overall file size if(EXISTS ${helics-bin_SOURCE_DIR}/bin) - install(DIRECTORY ${helics-bin_SOURCE_DIR}/bin DESTINATION . USE_SOURCE_PERMISSIONS) + install( + DIRECTORY ${helics-bin_SOURCE_DIR}/bin/ + TYPE BIN + USE_SOURCE_PERMISSIONS + ) endif() - if(EXISTS ${helics-bin_SOURCE_DIR}/lib) - install(DIRECTORY ${helics-bin_SOURCE_DIR}/lib DESTINATION . USE_SOURCE_PERMISSIONS) - endif() - if(EXISTS ${helics-bin_SOURCE_DIR}/lib64) - install(DIRECTORY ${helics-bin_SOURCE_DIR}/lib64 DESTINATION . USE_SOURCE_PERMISSIONS) + # Linux needs libzmq (libhelics isn't used); previously we added lib64 to LD_LIBRARY_PATH so auditwheel can fix up the binary wheel + # that is a bit trickier due to temporary folder skbuild/CMake uses, so instead let's include it this way... + if(LINUX OR APPLE) + if(EXISTS ${helics-bin_SOURCE_DIR}/lib) + install( + DIRECTORY ${helics-bin_SOURCE_DIR}/lib/ + TYPE LIB + USE_SOURCE_PERMISSIONS + PATTERN cmake EXCLUDE + PATTERN pkgconfig EXCLUDE + PATTERN libhelics* EXCLUDE + PATTERN libzmq* + ) + endif() + if(EXISTS ${helics-bin_SOURCE_DIR}/lib64) + install( + DIRECTORY ${helics-bin_SOURCE_DIR}/lib64/ + TYPE LIB + USE_SOURCE_PERMISSIONS + PATTERN cmake EXCLUDE + PATTERN pkgconfig EXCLUDE + PATTERN libhelics* EXCLUDE + PATTERN libzmq* + ) + endif() endif() # If we made a wheel from pre-built HELICS binaries, exit early!