From 4a2fc192e63955ecf9625c7520033e5549c4ca73 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Tue, 8 Jun 2021 22:16:39 -0400 Subject: [PATCH] Bug2799: mod-script-pipe fails to load on Mac... ... This broke at commit 938bbeb with changes in CMake scripts. This can be fixed by invoking CopyLibs.cmake for modules too. This affects only the macOS build. --- .../cmake-modules/AudacityFunctions.cmake | 9 +++++++++ cmake-proxies/cmake-modules/CopyLibs.cmake | 16 +++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/cmake-proxies/cmake-modules/AudacityFunctions.cmake b/cmake-proxies/cmake-modules/AudacityFunctions.cmake index 4a14db612..165101289 100644 --- a/cmake-proxies/cmake-modules/AudacityFunctions.cmake +++ b/cmake-proxies/cmake-modules/AudacityFunctions.cmake @@ -359,6 +359,15 @@ function( audacity_module_fn NAME SOURCES IMPORT_TARGETS PREFIX "" FOLDER "modules" # for IDE organization ) + if( CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin" ) + add_custom_command( + TARGET ${TARGET} + COMMAND ${CMAKE_COMMAND} + -D SRC="${_MODDIR}/${TARGET}.so" + -D WXWIN="${_SHARED_PROXY_BASE_PATH}/$" + -P ${AUDACITY_MODULE_PATH}/CopyLibs.cmake + POST_BUILD ) + endif() else() set( ATTRIBUTES "shape=octagon" ) set_target_property_all( ${TARGET} ${DIRECTORY_PROPERTY} "${_SHARED_PROXY_PATH}" ) diff --git a/cmake-proxies/cmake-modules/CopyLibs.cmake b/cmake-proxies/cmake-modules/CopyLibs.cmake index a79811e44..9050acc1c 100644 --- a/cmake-proxies/cmake-modules/CopyLibs.cmake +++ b/cmake-proxies/cmake-modules/CopyLibs.cmake @@ -84,7 +84,13 @@ function( gather_libs src ) list( APPEND words "-change ${line} @executable_path/../Frameworks/${refname}" ) - if( NOT "${lib}" IN_LIST VISITED ) + if( + # Don't do depth first search from modules: assume the fixup + # of .dylib libraries was already done when this function + # was visited for the executable + NOT src MATCHES "\\.so$" + AND NOT "${lib}" IN_LIST VISITED + ) gather_libs( ${lib} ) endif() endif() @@ -141,5 +147,9 @@ foreach( cmd ${postcmds} ) ) endforeach() -list( REMOVE_DUPLICATES libs ) -file( INSTALL ${libs} DESTINATION ${DST} FOLLOW_SYMLINK_CHAIN ) +# This .cmake file is invoked on Darwin for modules too. +# Do the INSTALL only for the executable. +if( NOT SRC MATCHES "\\.so$" ) + list( REMOVE_DUPLICATES libs ) + file( INSTALL ${libs} DESTINATION ${DST} FOLLOW_SYMLINK_CHAIN ) +endif()