vcpkg/ports/easyhook/portfile.cmake
Billy O'Neal 57485fd363
[easyhook] Also disable /ZI (#20853)
In https://github.com/microsoft/vcpkg/pull/20757 I patch easyhook to remove /Zi in release builds, but in our most recent nightly build we got another failure https://dev.azure.com/vcpkg/public/_build/results?buildId=61519&view=artifacts&pathAsName=false&type=publishedArtifacts

```
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\cderr.h : fatal error C1073: Internal error involving incremental compilation(compiler file 'd:\a01\_work\6\s\src\vctools\Compiler\CxxFE\sl\p1\c\p0io.c', line 1257) [D:\buildtrees\easyhook\x86-windows-dbg\2.7.7097.0-e2e62d41f5.clean\EasyHookDll\EasyHookDll.vcxproj]
         C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\ddeml.h(37,1): fatal error C1001: Internal compiler error. [D:\buildtrees\easyhook\x86-windows-dbg\2.7.7097.0-e2e62d41f5.clean\EasyHookDll\EasyHookDll.vcxproj]
         D:\buildtrees\easyhook\x86-windows-dbg\2.7.7097.0-e2e62d41f5.clean\DriverShared\LocalHook\install.c(618,1): error C2471: cannot update program database '???' [D:\buildtrees\easyhook\x86-windows-dbg\2.7.7097.0-e2e62d41f5.clean\EasyHookDll\EasyHookDll.vcxproj]
```

This change also removes /ZI (which was used in debug builds) and /Gm (which is irrelevant since we aren't doing development work on Easyhook)
2021-10-19 18:20:29 -07:00

82 lines
3.1 KiB
CMake

vcpkg_fail_port_install(ON_TARGET "Linux" "OSX" "UWP" ON_ARCH "arm" ON_LIBRARY_LINKAGE "static")
message(WARNING ".Net framework 4.0 is required, please install it before install easyhook.")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO EasyHook/EasyHook
REF v2.7.7097.0
SHA512 D0CA5B64E77F6281B2DD7EE0DC492A9B07DDB60A9F514037938CC3E3FFA5DD57C95CB630E18C02C984A89070839E4188044896D4EE57A21E43E6EA3A4918255A
HEAD_REF master
PATCHES fix-build.patch
)
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()
# 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>"
)
vcpkg_replace_string(
"${VCXPROJ}"
"<DebugInformationFormat>EditAndContinue</DebugInformationFormat>"
"<DebugInformationFormat>OldStyle</DebugInformationFormat>"
)
vcpkg_replace_string(
"${VCXPROJ}"
"<MinimalRebuild>true</MinimalRebuild>"
""
)
endforeach()
vcpkg_install_msbuild(
SOURCE_PATH ${SOURCE_PATH}
PROJECT_SUBPATH EasyHook.sln
TARGET EasyHookDll
RELEASE_CONFIGURATION "netfx4-Release"
DEBUG_CONFIGURATION "netfx4-Debug"
PLATFORM ${BUILD_ARCH}
)
# 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()
# These libraries are useless, so remove.
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()
# Install includes
file(INSTALL "${SOURCE_PATH}/Public/easyhook.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/easyhook")
# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)