vcpkg/ports/libffi/portfile.cmake

39 lines
1.4 KiB
CMake
Raw Normal View History

2017-01-10 22:28:45 +08:00
if(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL x86 AND NOT VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
message(FATAL_ERROR "Architecture not supported")
endif()
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libffi-3.1)
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/libffi/libffi/archive/v3.1.zip"
FILENAME "libffi-3.1.zip"
SHA512 a5d4cc638262aecec29e70333119f561588a737fd8f353e18d9bf1bfa7b38eb6aba371778119ea8d35339b458815105d5b110063295b6588a8761b24dac77a7c)
vcpkg_extract_source_archive(${ARCHIVE})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/export-global-data.patch)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DFFI_CONFIG_FILE=${CMAKE_CURRENT_LIST_DIR}/fficonfig.h
OPTIONS_DEBUG
-DFFI_SKIP_HEADERS=ON)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
vcpkg_apply_patches(
SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
PATCHES
${CMAKE_CURRENT_LIST_DIR}/auto-define-static-macro.patch)
endif()
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libffi)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libffi/LICENSE ${CURRENT_PACKAGES_DIR}/share/libffi/copyright)