From 4953c8a3c0b3f824264b1233f5a2f89a431bdabb Mon Sep 17 00:00:00 2001 From: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> Date: Tue, 14 Jul 2020 01:54:00 +0800 Subject: [PATCH] [minhook] fix usage issue (#12399) * fix minhook lib faild to load when tring to be included in a project * fix usage issue --- ports/minhook/CONTROL | 1 + ports/minhook/fix-usage.patch | 10 ++++++++++ ports/minhook/install-destination.patch | 22 ---------------------- ports/minhook/portfile.cmake | 12 +++--------- 4 files changed, 14 insertions(+), 31 deletions(-) create mode 100644 ports/minhook/fix-usage.patch delete mode 100644 ports/minhook/install-destination.patch diff --git a/ports/minhook/CONTROL b/ports/minhook/CONTROL index 0daab0e4c..1c475bd17 100644 --- a/ports/minhook/CONTROL +++ b/ports/minhook/CONTROL @@ -1,4 +1,5 @@ Source: minhook Version: 1.3.3 +Port-Version: 1 Description: The Minimalistic x86/x64 API Hooking Library for Windows. Supports: !uwp \ No newline at end of file diff --git a/ports/minhook/fix-usage.patch b/ports/minhook/fix-usage.patch new file mode 100644 index 000000000..198b8795d --- /dev/null +++ b/ports/minhook/fix-usage.patch @@ -0,0 +1,10 @@ +diff --git a/cmake/minhook-config.cmake.in b/cmake/minhook-config.cmake.in +index 14e6463..28fa17c 100644 +--- a/cmake/minhook-config.cmake.in ++++ b/cmake/minhook-config.cmake.in +@@ -36,4 +36,4 @@ set(MINHOOK_FOUND ON) + set_and_check(MINHOOK_INCLUDE_DIRS "${PACKAGE_PREFIX_DIR}/include/") + set_and_check(MINHOOK_LIBRARY_DIRS "${PACKAGE_PREFIX_DIR}/lib") + +-include("${PACKAGE_PREFIX_DIR}/lib/minhook/minhook-targets.cmake") ++include("${CMAKE_CURRENT_LIST_DIR}/minhook-targets.cmake") diff --git a/ports/minhook/install-destination.patch b/ports/minhook/install-destination.patch deleted file mode 100644 index 13f3dc379..000000000 --- a/ports/minhook/install-destination.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index df947af..6a894d8 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -113,7 +113,7 @@ install( - "${CMAKE_CURRENT_BINARY_DIR}/minhook-config.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/minhook-config-version.cmake" - DESTINATION -- "lib/minhook" -+ share/minhook - ) - - ################### -@@ -133,7 +133,7 @@ install( - NAMESPACE - minhook:: - DESTINATION -- "lib/minhook" -+ share/minhook - ) - - install( diff --git a/ports/minhook/portfile.cmake b/ports/minhook/portfile.cmake index 13779a338..bd022d5bc 100644 --- a/ports/minhook/portfile.cmake +++ b/ports/minhook/portfile.cmake @@ -1,8 +1,4 @@ -if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") - message(FATAL_ERROR "${PORT} does not currently support UWP") -endif() - -include(vcpkg_common_functions) +vcpkg_fail_port_install(ON_TARGET "UWP") if (VCPKG_TARGET_ARCHITECTURE MATCHES "x86") set(BUILD_ARCH "Win32") @@ -30,20 +26,18 @@ vcpkg_from_github( HEAD_REF master PATCHES "${CMAKE_SUPPORT_PATCH}" - install-destination.patch + fix-usage.patch ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA - OPTIONS ) vcpkg_install_cmake() +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/minhook) vcpkg_copy_pdbs() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -file(COPY ${CURRENT_PACKAGES_DIR}/debug/share/${PORT}/minhook-targets-debug.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)