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)
|
|
|
|
set(ENV{PATH} "$ENV{PATH};${PYTHON3_DIR}")
|
|
|
|
|
2017-05-06 17:55:19 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO facebook/folly
|
2017-11-29 02:52:17 +08:00
|
|
|
REF v2017.11.27.00
|
|
|
|
SHA512 738bb00047a7cbd807f2dccd64031763df80bbebca73f1ae9500b750dcad156dde84e47f4eda7af1bcd7abfae10c973da47515f2e111929979d1637869cf06ee
|
2017-05-06 17:55:19 +08:00
|
|
|
HEAD_REF master
|
|
|
|
)
|
|
|
|
|
2017-12-21 15:55:38 +08:00
|
|
|
vcpkg_apply_patches(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
|
|
PATCHES
|
2018-02-10 14:56:36 +08:00
|
|
|
${CMAKE_CURRENT_LIST_DIR}/cmake-link-boost-fix.patch
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/msvc-15.6-workaround.patch
|
2017-12-21 15:55:38 +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()
|
|
|
|
|
|
|
|
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}
|
|
|
|
)
|
|
|
|
|
2017-05-09 11:52:53 +08:00
|
|
|
# Folly runs built executables during the build, so they need access to the installed DLLs.
|
2017-06-02 02:09:01 +08:00
|
|
|
set(ENV{PATH} "$ENV{PATH};${CURRENT_INSTALLED_DIR}/bin;${CURRENT_INSTALLED_DIR}/debug/bin")
|
2017-05-09 11:52:53 +08:00
|
|
|
|
2017-10-06 08:49:28 +08:00
|
|
|
vcpkg_install_cmake()
|
2017-05-06 17:55:19 +08:00
|
|
|
|
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
|
|
|
|
vcpkg_fixup_cmake_targets()
|
|
|
|
|
2017-06-02 02:09:01 +08:00
|
|
|
# changes target search path
|
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/share/folly/folly-targets.cmake FOLLY_MODULE)
|
|
|
|
string(REPLACE "${CURRENT_INSTALLED_DIR}/lib/" "" FOLLY_MODULE "${FOLLY_MODULE}")
|
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/folly/folly-targets.cmake "${FOLLY_MODULE}")
|
|
|
|
|
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)
|