2017-05-06 17:55:19 +08:00
|
|
|
if(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
|
|
|
|
message(FATAL_ERROR "Folly only supports the x64 architecture.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
|
|
|
message(STATUS "Warning: Dynamic building not supported yet. Building static.")
|
|
|
|
set(VCPKG_LIBRARY_LINKAGE static)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include(vcpkg_common_functions)
|
|
|
|
|
2017-05-10 12:30:26 +08:00
|
|
|
# Required to run build/generate_escape_tables.py et al.
|
|
|
|
vcpkg_find_acquire_program(PYTHON3)
|
|
|
|
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
|
2018-08-14 07:07:26 +08:00
|
|
|
vcpkg_add_to_path("${PYTHON3_DIR}")
|
2017-05-10 12:30:26 +08:00
|
|
|
|
2017-05-06 17:55:19 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO facebook/folly
|
2019-01-19 06:40:03 +08:00
|
|
|
REF v2019.01.28.00
|
|
|
|
SHA512 cdd32d863bd98b31332fbcb25a548407857ffd8e611fb5d243821f43fcf240cb796fb4520dddec5537f398c10492e1ecb03de22f7ec0384b98411e9906f40d09
|
2017-05-06 17:55:19 +08:00
|
|
|
HEAD_REF master
|
2017-12-21 15:55:38 +08:00
|
|
|
PATCHES
|
2018-08-14 07:07:26 +08:00
|
|
|
find-gflags.patch
|
|
|
|
no-werror.patch
|
2017-12-21 15:55:38 +08:00
|
|
|
)
|
|
|
|
|
2018-03-29 07:47:49 +08:00
|
|
|
file(COPY
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/FindLZ4.cmake
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/FindSnappy.cmake
|
|
|
|
DESTINATION ${SOURCE_PATH}/CMake/
|
|
|
|
)
|
2018-04-20 07:23:01 +08:00
|
|
|
file(REMOVE ${SOURCE_PATH}/CMake/FindGFlags.cmake)
|
2018-03-29 07:47:49 +08:00
|
|
|
|
2017-05-06 17:55:19 +08:00
|
|
|
if(VCPKG_CRT_LINKAGE STREQUAL static)
|
|
|
|
set(MSVC_USE_STATIC_RUNTIME ON)
|
|
|
|
else()
|
|
|
|
set(MSVC_USE_STATIC_RUNTIME OFF)
|
|
|
|
endif()
|
|
|
|
|
2018-03-29 07:47:49 +08:00
|
|
|
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)
|
|
|
|
|
2017-05-06 17:55:19 +08:00
|
|
|
vcpkg_configure_cmake(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
2017-05-06 17:55:19 +08:00
|
|
|
PREFER_NINJA
|
2017-05-06 17:55:19 +08:00
|
|
|
OPTIONS
|
|
|
|
-DMSVC_USE_STATIC_RUNTIME=${MSVC_USE_STATIC_RUNTIME}
|
2018-03-29 07:47:49 +08:00
|
|
|
-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
|
2018-07-03 21:18:55 +08:00
|
|
|
-DCMAKE_INSTALL_DIR=share/folly
|
2018-03-29 07:47:49 +08:00
|
|
|
${FEATURE_OPTIONS}
|
2017-05-06 17:55:19 +08:00
|
|
|
)
|
|
|
|
|
2018-03-29 07:47:49 +08:00
|
|
|
vcpkg_install_cmake(ADD_BIN_TO_PATH)
|
2017-05-06 17:55:19 +08:00
|
|
|
|
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
|
2018-07-03 21:18:55 +08:00
|
|
|
vcpkg_fixup_cmake_targets(CONFIG_PATH share/folly)
|
2017-05-06 17:55:19 +08:00
|
|
|
|
2019-03-01 15:53:42 +08:00
|
|
|
# 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
|
|
|
|
[[
|
2019-04-05 21:57:37 +08:00
|
|
|
"Threads::Threads;Iphlpapi.lib;Ws2_32.lib;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_context-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_context-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_chrono-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_chrono-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_date_time-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_date_time-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_filesystem-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_filesystem-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_program_options-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_program_options-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_regex-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_regex-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_system-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_system-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_thread-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_thread-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_atomic-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_atomic-vc140-mt-gd.lib>;${_IMPORT_PREFIX}/lib/double-conversion.lib;${_IMPORT_PREFIX}/lib/ssleay32.lib;${_IMPORT_PREFIX}/lib/libeay32.lib;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/zlib.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/zlibd.lib>;gflags;glog::glog;event"
|
2019-03-01 15:53:42 +08:00
|
|
|
]]
|
|
|
|
[[
|
2019-04-05 21:57:37 +08:00
|
|
|
"Threads::Threads;Iphlpapi.lib;Ws2_32.lib;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_context-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_context-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_chrono-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_chrono-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_date_time-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_date_time-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_filesystem-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_filesystem-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_program_options-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_program_options-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_regex-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_regex-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_system-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_system-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_thread-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_thread-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_atomic-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_atomic-vc140-mt-gd.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/double-conversion.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/double-conversion.lib>;${_IMPORT_PREFIX}/lib/ssleay32.lib;${_IMPORT_PREFIX}/lib/libeay32.lib;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/zlib.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/zlibd.lib>;gflags;glog::glog;event"
|
2019-03-01 15:53:42 +08:00
|
|
|
]]
|
|
|
|
_contents "${_contents}")
|
|
|
|
FILE(WRITE ${FOLLY_TARGETS_CMAKE} "${_contents}")
|
|
|
|
|
2017-05-06 17:55:19 +08:00
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
|
|
|
|
|
|
|
# Handle copyright
|
|
|
|
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/folly)
|
|
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/share/folly/LICENSE ${CURRENT_PACKAGES_DIR}/share/folly/copyright)
|