mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-11 03:10:09 +08:00
8bb8b579ac
* [folly] update to v2022.07.11.00 * update version * [proxygen] update to v2022.07.11.00 * update version * Add License * update version * update version
97 lines
3.4 KiB
CMake
97 lines
3.4 KiB
CMake
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
|
|
|
# Required to run build/generate_escape_tables.py et al.
|
|
vcpkg_find_acquire_program(PYTHON3)
|
|
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
|
|
vcpkg_add_to_path("${PYTHON3_DIR}")
|
|
|
|
vcpkg_from_github(
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
REPO facebook/folly
|
|
REF 4ba3bfed38ad14d0951d82b154c44235d380f59b #v2022.07.11.00
|
|
SHA512 d2dd31a42475e564d01a0e7d99b59382f0afd56d89beb189e580b654650d2f9316cbeb459a038f9534881f22efd1571494926c1ea88b827de6ac56317d3c135b
|
|
HEAD_REF main
|
|
PATCHES
|
|
reorder-glog-gflags.patch
|
|
disable-non-underscore-posix-names.patch
|
|
boost-1.70.patch
|
|
fix-windows-minmax.patch
|
|
)
|
|
|
|
file(COPY
|
|
"${CMAKE_CURRENT_LIST_DIR}/FindLZ4.cmake"
|
|
"${CMAKE_CURRENT_LIST_DIR}/FindSnappy.cmake"
|
|
DESTINATION "${SOURCE_PATH}/CMake/"
|
|
)
|
|
file(REMOVE "${SOURCE_PATH}/CMake/FindGFlags.cmake")
|
|
|
|
if(VCPKG_CRT_LINKAGE STREQUAL static)
|
|
set(MSVC_USE_STATIC_RUNTIME ON)
|
|
else()
|
|
set(MSVC_USE_STATIC_RUNTIME OFF)
|
|
endif()
|
|
|
|
set(FEATURE_OPTIONS)
|
|
|
|
macro(feature FEATURENAME PACKAGENAME)
|
|
if("${FEATURENAME}" IN_LIST FEATURES)
|
|
list(APPEND FEATURE_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_${PACKAGENAME}=OFF)
|
|
else()
|
|
list(APPEND FEATURE_OPTIONS -DCMAKE_DISABLE_FIND_PACKAGE_${PACKAGENAME}=ON)
|
|
endif()
|
|
endmacro()
|
|
|
|
feature(zlib ZLIB)
|
|
feature(bzip2 BZip2)
|
|
feature(lzma LibLZMA)
|
|
feature(lz4 LZ4)
|
|
feature(zstd Zstd)
|
|
feature(snappy Snappy)
|
|
|
|
vcpkg_cmake_configure(
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
OPTIONS
|
|
-DMSVC_USE_STATIC_RUNTIME=${MSVC_USE_STATIC_RUNTIME}
|
|
-DCMAKE_DISABLE_FIND_PACKAGE_LibDwarf=ON
|
|
-DCMAKE_DISABLE_FIND_PACKAGE_Libiberty=ON
|
|
-DCMAKE_DISABLE_FIND_PACKAGE_LibAIO=ON
|
|
-DLIBAIO_FOUND=OFF
|
|
-DLIBURCU_FOUND=OFF
|
|
-DCMAKE_DISABLE_FIND_PACKAGE_LibURCU=ON
|
|
-DCMAKE_INSTALL_DIR=share/folly
|
|
${FEATURE_OPTIONS}
|
|
)
|
|
|
|
vcpkg_cmake_install(ADD_BIN_TO_PATH)
|
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
|
|
|
|
vcpkg_cmake_config_fixup()
|
|
|
|
# Release folly-targets.cmake does not link to the right libraries in debug mode.
|
|
# We substitute with generator expressions so that the right libraries are linked for debug and release.
|
|
set(FOLLY_TARGETS_CMAKE "${CURRENT_PACKAGES_DIR}/share/folly/folly-targets.cmake")
|
|
FILE(READ ${FOLLY_TARGETS_CMAKE} _contents)
|
|
string(REPLACE "\${VCPKG_IMPORT_PREFIX}/lib/zlib.lib" "ZLIB::ZLIB" _contents "${_contents}")
|
|
STRING(REPLACE "\${VCPKG_IMPORT_PREFIX}/lib/" "\${VCPKG_IMPORT_PREFIX}/\$<\$<CONFIG:DEBUG>:debug/>lib/" _contents "${_contents}")
|
|
STRING(REPLACE "\${VCPKG_IMPORT_PREFIX}/debug/lib/" "\${VCPKG_IMPORT_PREFIX}/\$<\$<CONFIG:DEBUG>:debug/>lib/" _contents "${_contents}")
|
|
string(REPLACE "-vc140-mt.lib" "-vc140-mt\$<\$<CONFIG:DEBUG>:-gd>.lib" _contents "${_contents}")
|
|
FILE(WRITE ${FOLLY_TARGETS_CMAKE} "${_contents}")
|
|
FILE(READ "${CURRENT_PACKAGES_DIR}/share/folly/folly-config.cmake" _contents)
|
|
FILE(WRITE "${CURRENT_PACKAGES_DIR}/share/folly/folly-config.cmake"
|
|
"include(CMakeFindDependencyMacro)
|
|
find_dependency(Threads)
|
|
find_dependency(glog CONFIG)
|
|
find_dependency(gflags CONFIG REQUIRED)
|
|
find_dependency(ZLIB)
|
|
${_contents}")
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
|
|
|
# Handle copyright
|
|
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
|
|
|
vcpkg_fixup_pkgconfig()
|