diff options
Diffstat (limited to 'vcpkg/scripts/test_ports/rpath-macho-test-binaries')
6 files changed, 93 insertions, 0 deletions
diff --git a/vcpkg/scripts/test_ports/rpath-macho-test-binaries/portfile.cmake b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/portfile.cmake new file mode 100644 index 0000000..960fd7b --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/portfile.cmake @@ -0,0 +1,46 @@ +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) +vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS_RELEASE + -DTEST_STRING=release + OPTIONS_DEBUG + -DTEST_STRING=debug +) +vcpkg_cmake_install() + +function(make_rpath_absolute lib_dir) +string(REPLACE "/" "_" logname "make_rpath_absolute-${lib_dir}") + vcpkg_execute_required_process( + COMMAND "install_name_tool" -id ${CURRENT_INSTALLED_DIR}/${lib_dir}/librpath-macho-backend-lib++.dylib ${CURRENT_PACKAGES_DIR}/${lib_dir}/librpath-macho-backend-lib++.dylib + WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}" + LOGNAME "${logname}-id" + ) + + vcpkg_execute_required_process( + COMMAND "install_name_tool" -change @rpath/librpath-macho-backend-lib++.dylib ${CURRENT_INSTALLED_DIR}/${lib_dir}/librpath-macho-backend-lib++.dylib ${CURRENT_PACKAGES_DIR}/${lib_dir}/librpath-macho-test-lib.dylib + WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}" + LOGNAME "${logname}-change" + ) +endfunction() + +if(NOT VCPKG_BUILD_TYPE) + vcpkg_copy_tools(TOOL_NAMES rpath-macho-test-tool + SEARCH_DIR "${CURRENT_PACKAGES_DIR}/debug/bin" + DESTINATION "${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}" + ) + vcpkg_copy_tools(TOOL_NAMES rpath-macho-test-tool + SEARCH_DIR "${CURRENT_PACKAGES_DIR}/debug/bin" + DESTINATION "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}/debug" + ) + vcpkg_copy_tools(TOOL_NAMES rpath-macho-test-tool + SEARCH_DIR "${CURRENT_PACKAGES_DIR}/debug/bin" + DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug" + ) + make_rpath_absolute("debug/lib") +endif() +make_rpath_absolute("lib") +vcpkg_copy_tools(TOOL_NAMES rpath-macho-test-tool DESTINATION "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}") +vcpkg_copy_tools(TOOL_NAMES rpath-macho-test-tool AUTO_CLEAN) +file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "This test port is part of vcpkg.") diff --git a/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/CMakeLists.txt b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/CMakeLists.txt new file mode 100644 index 0000000..9939b6f --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.7) +project(rpath-macho-test CXX) + +set(TEST_STRING "" CACHE STRING "") + +set(CMAKE_SKIP_INSTALL_RPATH TRUE) + +add_library(rpath-macho-backend-lib++ transitive.cpp) +target_compile_definitions(rpath-macho-backend-lib++ PRIVATE "TEST_STRING=\"${TEST_STRING}\"") + +add_library(rpath-macho-test-lib lib.cpp) +target_link_libraries(rpath-macho-test-lib PRIVATE rpath-macho-backend-lib++) + +add_executable(rpath-macho-test-tool main.cpp) +target_link_libraries(rpath-macho-test-tool PRIVATE rpath-macho-test-lib) + +install(TARGETS rpath-macho-backend-lib++ rpath-macho-test-lib rpath-macho-test-tool) diff --git a/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/lib.cpp b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/lib.cpp new file mode 100644 index 0000000..3727a06 --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/lib.cpp @@ -0,0 +1,6 @@ +extern const char* getTestStringBackend(); + +const char* getTestString() +{ + return getTestStringBackend(); +} diff --git a/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/main.cpp b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/main.cpp new file mode 100644 index 0000000..7253b5a --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/main.cpp @@ -0,0 +1,8 @@ +#include <stdio.h> + +extern const char* getTestString(); + +int main() +{ + puts(getTestString()); +} diff --git a/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/transitive.cpp b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/transitive.cpp new file mode 100644 index 0000000..ab1ca00 --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/transitive.cpp @@ -0,0 +1,4 @@ +const char* getTestStringBackend() +{ + return TEST_STRING; +} diff --git a/vcpkg/scripts/test_ports/rpath-macho-test-binaries/vcpkg.json b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/vcpkg.json new file mode 100644 index 0000000..8911159 --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "rpath-macho-test-binaries", + "version-string": "ci", + "description": "Provides installed binaries for rpath macho fixup test", + "supports": "native & osx", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + } + ] +} |