Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 7 commits into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions ports/keystone/CONTROL

This file was deleted.

40 changes: 18 additions & 22 deletions ports/keystone/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
vcpkg_fail_port_install(ON_TARGET "uwp")

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO keystone-engine/keystone
Expand All @@ -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 changes: 14 additions & 0 deletions ports/keystone/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
3 changes: 0 additions & 3 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2870,7 +2870,7 @@
},
"keystone": {
"baseline": "0.9.2",
"port-version": 0
"port-version": 1
},
"kf5archive": {
"baseline": "5.84.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/k-/keystone.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "34865a7cf3fbcf4f104e8b136862aa8acc1a7ca7",
"version-semver": "0.9.2",
"port-version": 1
},
{
"git-tree": "779d3f65bc01be0cfb50208ec50673612154023f",
"version-string": "0.9.2",
Expand Down