2022-11-30 04:05:22 +08:00
|
|
|
vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}
|
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
|
2022-05-18 02:15:06 +08:00
|
|
|
REF "v${VERSION}"
|
2022-11-30 04:05:22 +08:00
|
|
|
SHA512 e3b261a7900cec61225c768ebd443884465669e0904db3f523aaaeeed74b4c03dbe23d74ff8bb69554791a798e25894a5fcbe2b13b883d3ee38aeff4c1e16a49
|
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}"
|
2018-03-03 04:28:34 +08:00
|
|
|
OPTIONS
|
2022-05-18 02:15:06 +08:00
|
|
|
"-DFFI_CONFIG_FILE=${CMAKE_CURRENT_LIST_DIR}/fficonfig.h"
|
2018-03-03 04:28:34 +08:00
|
|
|
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)
|