[keystone] Fix static build with dynamic CRT on Windows (#19491)

* [keystone] Fix static build with dynamic CRT on Windows

* Add port-version

* Update version files

* Add double quotes for the path

* Update versions/k-/keystone.json

* Add comments for kstool

* Update versions/k-/keystone.json
This commit is contained in:
NancyLi1013 2021-08-12 08:18:20 +08:00 committed by GitHub
parent 53204fc2fb
commit c315cf92f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 29 deletions

View File

@ -1,3 +0,0 @@
Source: keystone
Version: 0.9.2
Description: Lightweight multi-platform, multi-architecture assembler framework

View File

@ -1,3 +1,5 @@
vcpkg_fail_port_install(ON_TARGET "uwp")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO keystone-engine/keystone
@ -8,43 +10,37 @@ vcpkg_from_github(
vcpkg_find_acquire_program(PYTHON2)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" KEYSTONE_BUILD_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" KEYSTONE_BUILD_SHARED)
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" KEYSTONE_BUILD_STATIC_RUNTIME)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DKEYSTONE_BUILD_STATIC=${KEYSTONE_BUILD_STATIC}
-DKEYSTONE_BUILD_SHARED=${KEYSTONE_BUILD_SHARED}
-DKEYSTONE_BUILD_STATIC_RUNTIME=${KEYSTONE_BUILD_STATIC_RUNTIME}
-DPYTHON_EXECUTABLE=${PYTHON2}
# Add support for only a subset of architectures
#-DLLVM_TARGETS_TO_BUILD="AArch64;X86"
)
vcpkg_install_cmake()
vcpkg_cmake_install()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(GLOB EXES ${CURRENT_PACKAGES_DIR}/bin/*.exe ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe)
if(EXES)
file(REMOVE ${EXES})
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
#For windows, do not build kstool if building DLL https://github.com/keystone-engine/keystone/blob/master/CMakeLists.txt#L74
vcpkg_copy_tools(TOOL_NAMES kstool AUTO_CLEAN)
else()
# Move DLLs
file(GLOB DLLS ${CURRENT_PACKAGES_DIR}/lib/*.dll)
file(COPY ${DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
file(GLOB DLLS "${CURRENT_PACKAGES_DIR}/lib/*.dll")
file(COPY ${DLLS} DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
file(REMOVE ${DLLS})
file(GLOB DLLS ${CURRENT_PACKAGES_DIR}/debug/lib/*.dll)
file(COPY ${DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
file(GLOB DLLS "${CURRENT_PACKAGES_DIR}/debug/lib/*.dll")
file(COPY ${DLLS} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
file(REMOVE ${DLLS})
endif()
vcpkg_fixup_pkgconfig()
# Handle copyright
file(INSTALL ${SOURCE_PATH}/COPYING
DESTINATION ${CURRENT_PACKAGES_DIR}/share/keystone
RENAME copyright
)
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

14
ports/keystone/vcpkg.json Normal file
View File

@ -0,0 +1,14 @@
{
"name": "keystone",
"version-semver": "0.9.2",
"port-version": 1,
"description": "A Lightweight multi-platform, multi-architecture assembler framework.",
"homepage": "https://github.com/keystone-engine/keystone",
"supports": "!uwp",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
}
]
}

View File

@ -497,8 +497,6 @@ jemalloc:x64-uwp=fail
jemalloc:x64-windows-static=fail
jinja2cpplight:arm-uwp=fail
jinja2cpplight:x64-uwp=fail
keystone:arm-uwp=fail
keystone:x64-uwp=fail
kfr:arm64-windows=fail
kfr:arm-uwp=fail
kfr:x64-linux=fail
@ -1723,7 +1721,6 @@ clockutils:x64-windows-static-md=fail
fastcgi:x64-windows-static-md=fail
gmp:x64-windows-static-md=fail
ijg-libjpeg:x64-windows-static-md=fail
keystone:x64-windows-static-md=fail
libcerf:x64-windows-static-md=fail
libgo:x64-windows-static-md=fail
libmicrohttpd:x64-windows-static-md=fail

View File

@ -2870,7 +2870,7 @@
},
"keystone": {
"baseline": "0.9.2",
"port-version": 0
"port-version": 1
},
"kf5archive": {
"baseline": "5.84.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "34865a7cf3fbcf4f104e8b136862aa8acc1a7ca7",
"version-semver": "0.9.2",
"port-version": 1
},
{
"git-tree": "779d3f65bc01be0cfb50208ec50673612154023f",
"version-string": "0.9.2",