diff options
| author | Arkadiy Shapkin <arkady.shapkin@gmail.com> | 2017-05-06 12:55:19 +0300 |
|---|---|---|
| committer | Arkadiy Shapkin <arkady.shapkin@gmail.com> | 2017-05-09 01:14:09 +0300 |
| commit | 0aa8055fbd8e721f1829d73f92eaf3868bd70a36 (patch) | |
| tree | b802dd2e9702e3c84542e86ab20af13d5bf4b2fe | |
| parent | 8fa5f3fd68ee6673e810f4b425c3e61dfad342fa (diff) | |
| download | vcpkg-0aa8055fbd8e721f1829d73f92eaf3868bd70a36.tar.gz vcpkg-0aa8055fbd8e721f1829d73f92eaf3868bd70a36.zip | |
[folly] Initial commit for Facebook Folly library
| -rw-r--r-- | ports/folly/CONTROL | 4 | ||||
| -rw-r--r-- | ports/folly/fix-cmakelists.patch | 89 | ||||
| -rw-r--r-- | ports/folly/portfile.cmake | 47 |
3 files changed, 140 insertions, 0 deletions
diff --git a/ports/folly/CONTROL b/ports/folly/CONTROL new file mode 100644 index 000000000..754bebb67 --- /dev/null +++ b/ports/folly/CONTROL @@ -0,0 +1,4 @@ +Source: folly +Version: v2017.05.08.00 +Description: An open-source C++ library developed and used at Facebook. The library is UNSTABLE on Windows +Build-Depends: zlib, openssl, boost, libevent, double-conversion, glog, gflags, lz4, liblzma, snappy diff --git a/ports/folly/fix-cmakelists.patch b/ports/folly/fix-cmakelists.patch new file mode 100644 index 000000000..9f5700dbb --- /dev/null +++ b/ports/folly/fix-cmakelists.patch @@ -0,0 +1,89 @@ +diff --git a/CMake/folly-deps.cmake b/CMake/folly-deps.cmake +index 211c6fbf..988225a2 100755 +--- a/CMake/folly-deps.cmake ++++ b/CMake/folly-deps.cmake +@@ -11,8 +11,8 @@ find_package(Boost 1.55.0 MODULE + REQUIRED + ) + find_package(DoubleConversion MODULE REQUIRED) +-find_package(GFlags MODULE REQUIRED) +-find_package(GLog MODULE REQUIRED) ++find_package(gflags CONFIG REQUIRED) ++find_package(glog CONFIG REQUIRED) + find_package(LibEvent MODULE REQUIRED) + find_package(OpenSSL MODULE REQUIRED) + find_package(PThread MODULE) +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 38886d65..4c796eac 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,15 +1,8 @@ + cmake_minimum_required(VERSION 3.4.0 FATAL_ERROR) + +-# Unfortunately, CMake doesn't easily provide us a way to merge static +-# libraries, which is what we want to do to generate the main folly library, so +-# we do a bit of a workaround here to inject a property into the generated +-# project files that will only get enabled for the folly target. Ugly, but +-# the alternatives are far, far worse. + if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio 15( 2017)? Win64") +- set(CMAKE_GENERATOR_TOOLSET "v141</PlatformToolset></PropertyGroup><ItemDefinitionGroup Condition=\"'$(ProjectName)'=='folly'\"><ProjectReference><LinkLibraryDependencies>true</LinkLibraryDependencies></ProjectReference></ItemDefinitionGroup><PropertyGroup><PlatformToolset>v141") + set(MSVC_IS_2017 ON) + elseif ("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 14 2015 Win64") +- set(CMAKE_GENERATOR_TOOLSET "v140</PlatformToolset></PropertyGroup><ItemDefinitionGroup Condition=\"'$(ProjectName)'=='folly'\"><ProjectReference><LinkLibraryDependencies>true</LinkLibraryDependencies></ProjectReference></ItemDefinitionGroup><PropertyGroup><PlatformToolset>v140") + set(MSVC_IS_2017 OFF) + else() + message(FATAL_ERROR "This build script only supports building Folly on 64-bit Windows with Visual Studio 2015 or Visual Studio 2017.") +@@ -122,7 +115,8 @@ add_library(folly_base STATIC + ) + auto_source_group(folly ${FOLLY_DIR} ${files} ${hfiles}) + apply_folly_compile_options_to_target(folly_base) +-target_include_directories(folly_base PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) ++target_include_directories(folly_base PUBLIC ++ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>) + # Add the generated files to the correct source group. + source_group("folly" FILES ${CMAKE_CURRENT_BINARY_DIR}/folly/folly-config.h) + source_group("folly\\build" FILES +@@ -133,10 +127,9 @@ source_group("folly\\build" FILES + ) + + target_include_directories(folly_base +- PUBLIC ++ PRIVATE + ${DOUBLE_CONVERSION_INCLUDE_DIR} + ${LIBGFLAGS_INCLUDE_DIR} +- ${LIBGLOG_INCLUDE_DIR} + ${LIBEVENT_INCLUDE_DIR} + ) + target_link_libraries(folly_base +@@ -151,13 +144,13 @@ target_link_libraries(folly_base + ${DOUBLE_CONVERSION_LIBRARY} + ${LIBEVENT_LIB} + ${LIBGFLAGS_LIBRARY} +- ${LIBGLOG_LIBRARY} ++ glog::glog + OpenSSL::SSL + OpenSSL::Crypto + Ws2_32.lib + ) + if (FOLLY_HAVE_PTHREAD) +- target_include_directories(folly_base PUBLIC ${LIBPTHREAD_INCLUDE_DIRS}) ++ target_include_directories(folly_base PRIVATE ${LIBPTHREAD_INCLUDE_DIRS}) + target_link_libraries(folly_base PUBLIC ${LIBPTHREAD_LIBRARIES}) + endif() + +@@ -199,13 +192,10 @@ add_library(folly ${CMAKE_CURRENT_BINARY_DIR}/folly_dep.cpp) + apply_folly_compile_options_to_target(folly) + source_group("" FILES ${CMAKE_CURRENT_BINARY_DIR}/folly_dep.cpp) + +-# Rather than list the dependencies in two places, we apply them directly on +-# the folly_base target and then copy them over to the folly target. +-get_target_property(FOLLY_LINK_LIBRARIES folly_base INTERFACE_LINK_LIBRARIES) +-target_link_libraries(folly PUBLIC ${FOLLY_LINK_LIBRARIES}) ++target_link_libraries(folly PUBLIC folly_base) + target_include_directories(folly PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>) + +-install(TARGETS folly ++install(TARGETS folly folly_base + EXPORT folly + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib diff --git a/ports/folly/portfile.cmake b/ports/folly/portfile.cmake new file mode 100644 index 000000000..75dceb5af --- /dev/null +++ b/ports/folly/portfile.cmake @@ -0,0 +1,47 @@ +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) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO facebook/folly + REF v2017.05.08.00 + SHA512 1f689ec288e2a5de28223bddd68fdbb37c26c46ed9d9b831cacc46580788b9bf8eed151a043a4905172e509c70ed3d845689bf2c0cd45ce05fbe76907e2049aa + HEAD_REF master +) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES "${CMAKE_CURRENT_LIST_DIR}/fix-cmakelists.patch" +) + +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} + OPTIONS + -DMSVC_USE_STATIC_RUNTIME=${MSVC_USE_STATIC_RUNTIME} +) + +vcpkg_install_cmake() + +vcpkg_copy_pdbs() + +vcpkg_fixup_cmake_targets() + +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) |
