2022-01-26 02:31:15 +08:00
|
|
|
message(WARNING ".Net framework 4.0 is required, please install it before installing easyhook.")
|
2019-08-02 08:50:06 +08:00
|
|
|
|
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO EasyHook/EasyHook
|
2021-09-28 12:03:25 +08:00
|
|
|
REF v2.7.7097.0
|
|
|
|
SHA512 D0CA5B64E77F6281B2DD7EE0DC492A9B07DDB60A9F514037938CC3E3FFA5DD57C95CB630E18C02C984A89070839E4188044896D4EE57A21E43E6EA3A4918255A
|
2019-08-02 08:50:06 +08:00
|
|
|
HEAD_REF master
|
|
|
|
PATCHES fix-build.patch
|
|
|
|
)
|
|
|
|
|
2021-07-29 12:51:34 +08:00
|
|
|
if (VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
|
|
|
|
set(BUILD_ARCH "Win32")
|
|
|
|
elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
|
|
|
set(BUILD_ARCH "x64")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Unsupported architecture: ${VCPKG_TARGET_ARCHITECTURE}")
|
|
|
|
endif()
|
|
|
|
|
2021-10-16 10:23:14 +08:00
|
|
|
# Use /Z7 rather than /Zi to avoid "fatal error C1090: PDB API call failed, error code '23': (0x00000006)"
|
|
|
|
foreach(VCXPROJ IN ITEMS
|
|
|
|
"${SOURCE_PATH}/EasyHookDll/EasyHookDll.vcxproj"
|
|
|
|
"${SOURCE_PATH}/Examples/UnmanagedHook/UnmanagedHook.vcxproj")
|
|
|
|
vcpkg_replace_string(
|
|
|
|
"${VCXPROJ}"
|
|
|
|
"<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>"
|
|
|
|
"<DebugInformationFormat>OldStyle</DebugInformationFormat>"
|
|
|
|
)
|
2021-10-20 09:20:29 +08:00
|
|
|
vcpkg_replace_string(
|
|
|
|
"${VCXPROJ}"
|
|
|
|
"<DebugInformationFormat>EditAndContinue</DebugInformationFormat>"
|
|
|
|
"<DebugInformationFormat>OldStyle</DebugInformationFormat>"
|
|
|
|
)
|
|
|
|
vcpkg_replace_string(
|
|
|
|
"${VCXPROJ}"
|
|
|
|
"<MinimalRebuild>true</MinimalRebuild>"
|
|
|
|
""
|
|
|
|
)
|
2021-10-16 10:23:14 +08:00
|
|
|
endforeach()
|
|
|
|
|
2019-08-02 08:50:06 +08:00
|
|
|
vcpkg_install_msbuild(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
|
|
PROJECT_SUBPATH EasyHook.sln
|
2021-10-16 10:23:14 +08:00
|
|
|
TARGET EasyHookDll
|
2019-08-02 08:50:06 +08:00
|
|
|
RELEASE_CONFIGURATION "netfx4-Release"
|
|
|
|
DEBUG_CONFIGURATION "netfx4-Debug"
|
2021-07-29 12:51:34 +08:00
|
|
|
PLATFORM ${BUILD_ARCH}
|
2019-08-02 08:50:06 +08:00
|
|
|
)
|
|
|
|
|
2021-07-29 12:51:34 +08:00
|
|
|
# Remove the mismatch rebuild library
|
|
|
|
if (VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
|
|
|
|
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/AUX_ULIB_x64.LIB")
|
|
|
|
endif()
|
|
|
|
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/AUX_ULIB_x64.LIB")
|
|
|
|
endif()
|
|
|
|
elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
|
|
|
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/AUX_ULIB_x86.LIB")
|
|
|
|
endif()
|
|
|
|
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/AUX_ULIB_x86.LIB")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2019-08-02 08:50:06 +08:00
|
|
|
# These libraries are useless, so remove.
|
2021-07-29 12:51:34 +08:00
|
|
|
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/EasyHook.dll" "${CURRENT_PACKAGES_DIR}/bin/EasyHook.pdb")
|
|
|
|
endif()
|
|
|
|
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/EasyHook.dll" "${CURRENT_PACKAGES_DIR}/debug/bin/EasyHook.pdb")
|
|
|
|
endif()
|
2019-08-02 08:50:06 +08:00
|
|
|
|
|
|
|
# Install includes
|
2021-07-29 12:51:34 +08:00
|
|
|
file(INSTALL "${SOURCE_PATH}/Public/easyhook.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/easyhook")
|
2019-08-02 08:50:06 +08:00
|
|
|
|
|
|
|
# Handle copyright
|
2021-07-29 12:51:34 +08:00
|
|
|
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|