[rpath-test,rpath-test-binaries] Validate rpath fixup (#39319)

This commit is contained in:
Kai Pastor 2024-07-30 08:08:04 +02:00 committed by GitHub
parent 3ac0a23d6d
commit 5ac34f9b6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 48 additions and 18 deletions

View File

@ -1,5 +1,6 @@
set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
vcpkg_cmake_configure(
SOURCE_PATH "${CURRENT_PORT_DIR}/project"
OPTIONS_RELEASE
@ -8,11 +9,21 @@ vcpkg_cmake_configure(
-DTEST_STRING=debug
)
vcpkg_cmake_install()
if(NOT VCPKG_BUILD_TYPE)
vcpkg_copy_tools(TOOL_NAMES rpath-test-tool
SEARCH_DIR "${CURRENT_PACKAGES_DIR}/debug/bin"
DESTINATION "${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}"
)
vcpkg_copy_tools(TOOL_NAMES rpath-test-tool
SEARCH_DIR "${CURRENT_PACKAGES_DIR}/debug/bin"
DESTINATION "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}/debug"
)
vcpkg_copy_tools(TOOL_NAMES rpath-test-tool
SEARCH_DIR "${CURRENT_PACKAGES_DIR}/debug/bin"
DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug"
)
endif()
vcpkg_copy_tools(TOOL_NAMES rpath-test-tool DESTINATION "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}")
vcpkg_copy_tools(TOOL_NAMES rpath-test-tool AUTO_CLEAN)
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "This test port is part of vcpkg.")

View File

@ -3,10 +3,15 @@ project(rpath-test CXX)
set(TEST_STRING "" CACHE STRING "")
set(CMAKE_SKIP_INSTALL_RPATH TRUE)
add_library(rpath-backend-lib transitive.cpp)
target_compile_definitions(rpath-backend-lib PRIVATE "TEST_STRING=\"${TEST_STRING}\"")
add_library(rpath-test-lib lib.cpp)
target_compile_definitions(rpath-test-lib PRIVATE "TEST_STRING=\"${TEST_STRING}\"")
target_link_libraries(rpath-test-lib PRIVATE rpath-backend-lib)
add_executable(rpath-test-tool main.cpp)
target_link_libraries(rpath-test-tool PRIVATE rpath-test-lib)
install(TARGETS rpath-test-lib rpath-test-tool)
install(TARGETS rpath-backend-lib rpath-test-lib rpath-test-tool)

View File

@ -1,4 +1,6 @@
extern const char* getTestStringBackend();
const char* getTestString()
{
return TEST_STRING;
return getTestStringBackend();
}

View File

@ -0,0 +1,4 @@
const char* getTestStringBackend()
{
return TEST_STRING;
}

View File

@ -1,23 +1,31 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
vcpkg_execute_in_download_mode(
COMMAND "${CURRENT_INSTALLED_DIR}/tools/rpath-test-binaries/rpath-test-tool"
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
OUTPUT_VARIABLE output
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT output STREQUAL "release")
message(SEND_ERROR "Actual: '${output}', expected: 'release'")
endif()
if(NOT VCPKG_BUILD_TYPE)
vcpkg_execute_in_download_mode(
COMMAND "${CURRENT_INSTALLED_DIR}/tools/rpath-test-binaries/debug/rpath-test-tool"
foreach(dir IN ITEMS tools/rpath-test-binaries manual-tools/rpath-test-binaries)
string(REPLACE "/" "_" logname "execute-rel-${dir}")
vcpkg_execute_required_process(
COMMAND "${CURRENT_INSTALLED_DIR}/${dir}/rpath-test-tool"
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
OUTPUT_VARIABLE output
OUTPUT_STRIP_TRAILING_WHITESPACE
LOGNAME "${logname}"
)
if(NOT output STREQUAL "debug")
message(SEND_ERROR "Actual: '${output}', expected: 'debug'")
if(NOT output STREQUAL "release")
message(SEND_ERROR "${dir}: $Actual: '${output}', expected: 'release'")
endif()
endforeach()
if(NOT VCPKG_BUILD_TYPE)
foreach(dir IN ITEMS tools/rpath-test-binaries/debug manual-tools/rpath-test-binaries/debug debug/tools/rpath-test-binaries)
string(REPLACE "/" "_" logname "execute-dbg-${dir}")
vcpkg_execute_required_process(
COMMAND "${CURRENT_INSTALLED_DIR}/${dir}/rpath-test-tool"
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
OUTPUT_VARIABLE output
OUTPUT_STRIP_TRAILING_WHITESPACE
LOGNAME "${logname}"
)
if(NOT output STREQUAL "debug")
message(SEND_ERROR "${dir}: Actual: '${output}', expected: 'debug'")
endif()
endforeach()
endif()