Skip to content

Commit

Permalink
Fix rpath for debug tools and add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jun 17, 2024
1 parent d6501c9 commit 82e282d
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/cmake/z_vcpkg_fixup_rpath_macho.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function(z_vcpkg_calculate_corrected_macho_rpath)
set(current_prefix "${CURRENT_PACKAGES_DIR}")
set(current_installed_prefix "${CURRENT_INSTALLED_DIR}")
file(RELATIVE_PATH relative_from_packages "${CURRENT_PACKAGES_DIR}" "${arg_MACHO_FILE_DIR}")
if("${relative_from_packages}/" MATCHES "^debug/")
if("${relative_from_packages}/" MATCHES "^debug/" OR "${relative_from_packages}/" MATCHES "^(manual-)?tools/.*/debug/.*")
set(current_prefix "${CURRENT_PACKAGES_DIR}/debug")
set(current_installed_prefix "${CURRENT_INSTALLED_DIR}/debug")
endif()
Expand Down
1 change: 1 addition & 0 deletions scripts/test_ports/unit-test-cmake/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ if("fixup-pkgconfig" IN_LIST FEATURES)
endif()
if("fixup-rpath" IN_LIST FEATURES)
include("${CMAKE_CURRENT_LIST_DIR}/test-z_vcpkg_calculate_corrected_rpath.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/test-z_vcpkg_calculate_corrected_rpath_macho.cmake")
endif()

if(Z_VCPKG_UNIT_TEST_HAS_ERROR)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# z_vcpkg_calculate_corrected_macho_rpath_macho(...)

block(SCOPE_FOR VARIABLES)

set(CURRENT_PACKAGES_DIR "/P")
set(CURRENT_INSTALLED_DIR "/I")

unit_test_check_variable_equal([[
z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/lib")
]] out [[@loader_path]])

unit_test_check_variable_equal([[
z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/plugins/group")
]] out [[@loader_path/../../lib]])

unit_test_check_variable_equal([[
z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/debug/lib")
]] out [[@loader_path]])

unit_test_check_variable_equal([[
z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/debug/plugins/group")
]] out [[@loader_path/../../lib]])

unit_test_check_variable_equal([[
z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/tools/port")
]] out [[@loader_path/../../lib]])

unit_test_check_variable_equal([[
z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/tools/port/bin")
]] out [[@loader_path/../../../lib]])

unit_test_check_variable_equal([[
z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/tools/port/debug")
]] out [[@loader_path/../../../debug/lib]])

unit_test_check_variable_equal([[
z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/tools/port/debug/bin")
]] out [[@loader_path/../../../../debug/lib]])

unit_test_check_variable_equal([[
z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/manual-tools/port")
]] out [[@loader_path/../../lib]])

unit_test_check_variable_equal([[
z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/manual-tools/port/bin")
]] out [[@loader_path/../../../lib]])

unit_test_check_variable_equal([[
z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/manual-tools/port/debug")
]] out [[@loader_path/../../../debug/lib]])

unit_test_check_variable_equal([[
z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/manual-tools/port/debug/bin")
]] out [[@loader_path/../../../../debug/lib]])

endblock()

0 comments on commit 82e282d

Please sign in to comment.