fix Mac linker script for @rpath libs (like SFML)

Homebrew SFML links itself with @rpath/ instead of the dylib path,
update the mac linking and bundling script to handle that case, also
move it from src/wx/tools/osx to tools/osx now that wx is the primary
port.

This fix is temporary and I will write a better one that takes
DYLD_LIBRARY_PATH and such into account, but will suffice for linking
Homebrew libs for now. The script needs more work in general.
This commit is contained in:
Rafael Kitover 2017-02-24 12:24:20 -08:00
parent cf5f425b3a
commit 4d12fcda10
2 changed files with 9 additions and 2 deletions

View File

@ -416,11 +416,11 @@ if(APPLE)
SET(MACOSX_BUNDLE_ICON_FILE ${VBAM_ICON})
SET_SOURCE_FILES_PROPERTIES(${VBAM_ICON_PATH} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
# budle dylibs and relink them for releasing .app
# bundle dylibs and relink them for releasing .app
# but only in Release mode
IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
ADD_CUSTOM_COMMAND(TARGET visualboyadvance-m POST_BUILD
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/osx/third_party_libs_tool "$<TARGET_FILE_DIR:visualboyadvance-m>/../..")
COMMAND ${CMAKE_SOURCE_DIR}/tools/osx/third_party_libs_tool "$<TARGET_FILE_DIR:visualboyadvance-m>/../..")
ENDIF()
endif(APPLE)

View File

@ -152,6 +152,13 @@ lib_scan() {
[ "$lib" = "$bin" ] && continue
# check for libs already linked as @rpath/ which usually means /usr/local/lib/
case "$lib" in
'@rpath/'*)
lib='/usr/local/lib'"${lib#@rpath}"
;;
esac
echo "$lib"
set -- "$@" "$lib"
done