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

[capstone] Use static runtime if capstone wants to be statically linked #23122

Merged
merged 17 commits into from
Feb 22, 2022
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
22 changes: 13 additions & 9 deletions ports/capstone/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ vcpkg_from_github(

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" CS_BUILD_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" CS_BUILD_SHARED)
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_CRT)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
Expand All @@ -28,29 +29,32 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
"diet" CAPSTONE_BUILD_DIET
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
if ("osxkernel" IN_LIST FEATURES AND NOT VCPKG_TARGET_IS_OSX)
message(FATAL_ERROR "Feature 'osxkernel' only supported in OSX")
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DCAPSTONE_BUILD_STATIC=${CS_BUILD_STATIC}
-DCAPSTONE_BUILD_SHARED=${CS_BUILD_SHARED}
-DCAPSTONE_BUILD_TESTS=OFF
-DCAPSTONE_BUILD_CSTOOL=OFF
-DCAPSTONE_BUILD_STATIC_RUNTIME=OFF
-DCAPSTONE_X86_ONLY=OFF
-DCAPSTONE_BUILD_STATIC_RUNTIME=${STATIC_CRT}
${FEATURE_OPTIONS}
)

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)
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()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()

file(INSTALL ${SOURCE_PATH}/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${SOURCE_PATH}/LICENSE.TXT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
12 changes: 11 additions & 1 deletion ports/capstone/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
{
"name": "capstone",
"version": "4.0.2",
"port-version": 2,
"port-version": 3,
"description": "Multi-architecture disassembly framework",
"homepage": "https://github.com/aquynh/capstone",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake",
"host": true
}
],
"features": {
"arm": {
"description": "Capstone disassembly support for ARM"
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@
},
"capstone": {
"baseline": "4.0.2",
"port-version": 2
"port-version": 3
},
"cartographer": {
"baseline": "1.0.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/c-/capstone.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "5250715402bf0c970792dafe6947aa810adde0f1",
"version": "4.0.2",
"port-version": 3
},
{
"git-tree": "465e527988f09c855e156cff45b7ee6dfbe1d303",
"version": "4.0.2",
Expand Down