1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-01-20 15:55:45 +01: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() endfunction()
set( VISITED ) set( VISITED )
set( postcmds )
function( gather_libs src ) function( gather_libs src )
list( APPEND VISITED "${src}" ) list( APPEND VISITED "${src}" )
if( CMAKE_HOST_SYSTEM_NAME MATCHES "Windows" ) if( CMAKE_HOST_SYSTEM_NAME MATCHES "Windows" )
@@ -62,6 +63,7 @@ function( gather_libs src )
set( libname "${src}" ) set( libname "${src}" )
set( words )
foreach( line ${output} ) foreach( line ${output} )
if( line MATCHES "^.*\\.dylib " ) if( line MATCHES "^.*\\.dylib " )
string( REGEX REPLACE "dylib .*" "dylib" line "${line}" ) string( REGEX REPLACE "dylib .*" "dylib" line "${line}" )
@@ -71,8 +73,7 @@ function( gather_libs src )
message(STATUS "Checking out ${line}") message(STATUS "Checking out ${line}")
set( lib "${WXWIN}/${dylib_name}" ) set( lib "${WXWIN}/${dylib_name}" )
if( NOT lib STREQUAL "${src}" AND NOT line MATCHES "@executable" AND EXISTS "${lib}" if( NOT lib STREQUAL "${src}" AND NOT line MATCHES "@executable" AND EXISTS "${lib}" )
AND NOT "${lib}" IN_LIST VISITED )
message(STATUS "\tProcessing ${lib}...") message(STATUS "\tProcessing ${lib}...")
list( APPEND libs ${lib} ) list( APPEND libs ${lib} )
@@ -81,12 +82,21 @@ function( gather_libs src )
message(STATUS "\t\tAdding ${refname} to ${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}" )
if( NOT "${lib}" IN_LIST VISITED )
gather_libs( ${lib} ) gather_libs( ${lib} )
endif() endif()
endif() endif()
endif()
endforeach() 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" ) elseif( CMAKE_HOST_SYSTEM_NAME MATCHES "Linux" )
message(STATUS "Executing LD_LIBRARY_PATH='${WXWIN}' ldd ${src}") message(STATUS "Executing LD_LIBRARY_PATH='${WXWIN}' ldd ${src}")