2021-07-20 03:34:57 +08:00
|
|
|
set(VERSION 3.4.2)
|
2020-07-07 04:40:46 +08:00
|
|
|
|
2018-03-03 04:28:34 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO libffi/libffi
|
2021-07-20 03:34:57 +08:00
|
|
|
REF v${VERSION}
|
|
|
|
SHA512 d399319efcca375fe901b05722e25eca31d11a4261c6a5d5079480bbc552d4e4b42de2026912689d3b2f886ebb3c8bebbea47102e38a2f6acbc526b8d5bba388
|
2018-03-03 04:28:34 +08:00
|
|
|
HEAD_REF master
|
|
|
|
)
|
|
|
|
|
2021-08-31 09:19:44 +08:00
|
|
|
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
|
|
|
|
file(COPY "${CMAKE_CURRENT_LIST_DIR}/libffiConfig.cmake.in" DESTINATION "${SOURCE_PATH}")
|
2018-03-03 04:28:34 +08:00
|
|
|
|
2021-10-07 18:22:47 +08:00
|
|
|
vcpkg_cmake_configure(
|
2021-08-31 09:19:44 +08:00
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2019-03-01 14:58:46 +08:00
|
|
|
PREFER_NINJA
|
2018-03-03 04:28:34 +08:00
|
|
|
OPTIONS
|
|
|
|
-DFFI_CONFIG_FILE=${CMAKE_CURRENT_LIST_DIR}/fficonfig.h
|
|
|
|
OPTIONS_DEBUG
|
2018-04-18 07:18:25 +08:00
|
|
|
-DFFI_SKIP_HEADERS=ON
|
|
|
|
)
|
2018-03-03 04:28:34 +08:00
|
|
|
|
2021-10-07 18:22:47 +08:00
|
|
|
vcpkg_cmake_install()
|
2020-07-07 04:40:46 +08:00
|
|
|
|
|
|
|
# Create pkgconfig file
|
|
|
|
set(PACKAGE_VERSION ${VERSION})
|
|
|
|
set(prefix "${CURRENT_INSTALLED_DIR}")
|
|
|
|
set(exec_prefix "\${prefix}")
|
|
|
|
set(libdir "\${prefix}/lib")
|
|
|
|
set(toolexeclibdir "\${libdir}")
|
|
|
|
set(includedir "\${prefix}/include")
|
2021-12-20 23:50:45 +08:00
|
|
|
configure_file("${SOURCE_PATH}/libffi.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libffi.pc" @ONLY)
|
|
|
|
|
2020-07-07 04:40:46 +08:00
|
|
|
# debug
|
2021-12-20 23:50:45 +08:00
|
|
|
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
set(prefix "${CURRENT_INSTALLED_DIR}/debug")
|
|
|
|
set(exec_prefix "\${prefix}")
|
|
|
|
set(libdir "\${prefix}/lib")
|
|
|
|
set(toolexeclibdir "\${libdir}")
|
|
|
|
set(includedir "\${prefix}/../include")
|
2020-07-07 04:40:46 +08:00
|
|
|
configure_file("${SOURCE_PATH}/libffi.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libffi.pc" @ONLY)
|
|
|
|
endif()
|
|
|
|
|
2018-03-03 04:28:34 +08:00
|
|
|
vcpkg_copy_pdbs()
|
2021-10-07 18:22:47 +08:00
|
|
|
vcpkg_cmake_config_fixup()
|
|
|
|
|
2021-08-31 09:19:44 +08:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_MINGW)
|
2021-10-07 18:22:47 +08:00
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libffi.pc"
|
|
|
|
"-lffi" "-llibffi")
|
|
|
|
endif()
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libffi.pc"
|
|
|
|
"-lffi" "-llibffi")
|
|
|
|
endif()
|
2020-11-10 06:34:34 +08:00
|
|
|
endif()
|
2020-07-07 04:40:46 +08:00
|
|
|
vcpkg_fixup_pkgconfig()
|
2018-03-03 04:28:34 +08:00
|
|
|
|
2020-02-08 01:36:39 +08:00
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
2021-08-31 09:19:44 +08:00
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/ffi.h"
|
2020-04-07 05:17:22 +08:00
|
|
|
" *know* they are going to link with the static library. */"
|
|
|
|
" *know* they are going to link with the static library. */
|
2019-10-08 01:35:13 +08:00
|
|
|
|
|
|
|
#define FFI_BUILDING
|
2020-04-07 05:17:22 +08:00
|
|
|
"
|
|
|
|
)
|
2020-02-08 01:36:39 +08:00
|
|
|
endif()
|
2018-03-03 04:28:34 +08:00
|
|
|
|
2021-08-31 09:19:44 +08:00
|
|
|
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|