1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-29 23:29:41 +02:00

Re-fix long Mac builds with many libraries, faster & more simply...

... Fix redundant "sh -c".  Combine many install_name_tool commands into one for
each library or executable.  Examine each with otool once only.
This commit is contained in:
Paul Licameli 2021-06-08 20:53:02 -04:00
parent cf993fcded
commit 7346fdac69

View File

@ -39,6 +39,7 @@ function( execute )
endfunction()
set( VISITED )
set( postcmds )
function( gather_libs src )
list( APPEND VISITED "${src}" )
if( CMAKE_HOST_SYSTEM_NAME MATCHES "Windows" )
@ -61,7 +62,8 @@ function( gather_libs src )
execute( output otool -L ${src} )
set( libname "${src}" )
set( words )
foreach( line ${output} )
if( line MATCHES "^.*\\.dylib " )
string( REGEX REPLACE "dylib .*" "dylib" line "${line}" )
@ -71,8 +73,7 @@ function( gather_libs src )
message(STATUS "Checking out ${line}")
set( lib "${WXWIN}/${dylib_name}" )
if( NOT lib STREQUAL "${src}" AND NOT line MATCHES "@executable" AND EXISTS "${lib}"
AND NOT "${lib}" IN_LIST VISITED )
if( NOT lib STREQUAL "${src}" AND NOT line MATCHES "@executable" AND EXISTS "${lib}" )
message(STATUS "\tProcessing ${lib}...")
list( APPEND libs ${lib} )
@ -81,12 +82,21 @@ function( gather_libs src )
message(STATUS "\t\tAdding ${refname} to ${src}")
list( APPEND postcmds "sh -c 'install_name_tool -change ${line} @executable_path/../Frameworks/${refname} ${src}'" )
list( APPEND words "-change ${line} @executable_path/../Frameworks/${refname}" )
gather_libs( ${lib} )
if( NOT "${lib}" IN_LIST VISITED )
gather_libs( ${lib} )
endif()
endif()
endif()
endforeach()
if( words )
# There is at least one dependency to rename
list( PREPEND words "install_name_tool" )
list( APPEND words "${src}" )
string( JOIN " " postcmd ${words} )
list( APPEND postcmds "${postcmd}" )
endif()
elseif( CMAKE_HOST_SYSTEM_NAME MATCHES "Linux" )
message(STATUS "Executing LD_LIBRARY_PATH='${WXWIN}' ldd ${src}")