Skip to content

Commit

Permalink
[folly] Add a dependency on PYTHON3 (the tool)
Browse files Browse the repository at this point in the history
Rebase patch list to be compatible with previous portfile versions.
  • Loading branch information
ras0219-msft committed May 10, 2017
1 parent 4bbd508 commit 861d797
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 42 deletions.
2 changes: 1 addition & 1 deletion ports/folly/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Source: folly
Version: v2017.05.08.00-1
Version: v2017.05.08.00-2
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
44 changes: 19 additions & 25 deletions ports/folly/fix-cmakelists.patch
Original file line number Diff line number Diff line change
@@ -1,44 +1,38 @@
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..00e5307c 100755
index 38886d65..4c796eac 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,15 +1,14 @@
@@ -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")
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")
+project(${PACKAGE_NAME} CXX)
+
+if (NOT ${MSVC_CXX_ARCHITECTURE_ID} STREQUAL "x64")
+ message(FATAL_ERROR "This build script only supports building Folly on 64-bit Windows.")
+endif()
+
+if (MSVC_VERSION EQUAL 1910)
set(MSVC_IS_2017 ON)
-elseif ("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 14 2015 Win64")
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")
+elseif (MSVC_VERSION EQUAL 1900)
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.")
@@ -29,12 +28,6 @@ set(PACKAGE_BUGREPORT "https://github.com/facebook/folly/issues")
# 150+ tests in the root folder anyone? No? I didn't think so.
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

-project(${PACKAGE_NAME} CXX)
-
-# Check architecture OS
-if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
- message(FATAL_ERROR "Folly requires a 64bit OS")
-endif()
if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
message(FATAL_ERROR "You should only be using CMake to build Folly if you are on Windows!")
endif()
@@ -122,7 +115,8 @@ add_library(folly_base STATIC
)
auto_source_group(folly ${FOLLY_DIR} ${files} ${hfiles})
Expand Down
15 changes: 0 additions & 15 deletions ports/folly/fix-deps.patch

This file was deleted.

36 changes: 36 additions & 0 deletions ports/folly/fix-generators.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4c796ea..684f48f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,13 +1,5 @@
cmake_minimum_required(VERSION 3.4.0 FATAL_ERROR)

-if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio 15( 2017)? Win64")
- set(MSVC_IS_2017 ON)
-elseif ("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 14 2015 Win64")
- 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.")
-endif()
-
# includes
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
@@ -24,10 +16,14 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)

project(${PACKAGE_NAME} CXX)

-# Check architecture OS
-if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
- message(FATAL_ERROR "Folly requires a 64bit OS")
+if (NOT MSVC_VERSION LESS 1910)
+ set(MSVC_IS_2017 ON)
+elseif (NOT MSVC_VERSION LESS 1900)
+ 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.")
endif()
+
if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
message(FATAL_ERROR "You should only be using CMake to build Folly if you are on Windows!")
endif()
7 changes: 6 additions & 1 deletion ports/folly/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ endif()

include(vcpkg_common_functions)

# 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}")

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO facebook/folly
Expand All @@ -20,7 +25,7 @@ vcpkg_from_github(
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES "${CMAKE_CURRENT_LIST_DIR}/fix-cmakelists.patch"
PATCHES "${CMAKE_CURRENT_LIST_DIR}/fix-deps.patch"
PATCHES "${CMAKE_CURRENT_LIST_DIR}/fix-generators.patch"
)

if(VCPKG_CRT_LINKAGE STREQUAL static)
Expand Down

0 comments on commit 861d797

Please sign in to comment.