Folly/Boost integration

Summary:
This change brings in Folly and Boost into our solution.

Boost is resolved with NuGet. Folly is resolved by re-using the RNW integration.

For reference:

Flipper depends on Folly. Folly depends on a few things:
- Boost
- FMT
- Glog
- Double-Conversion

Folly from RNW uses some stubs to resolve fmt, glog, and double-conversion. That's OK.

Only Boost needs resolving.

On Visual Studio, we can use the following package managers: NuGet and vcpkg.

Boost can be resolved using either.

Using NuGet as otherwise vcpkg needs to be run locally by anybody wanting to build the solution. NuGet makes things easier.

Reviewed By: aigoncharov

Differential Revision: D36759384

fbshipit-source-id: 31a9a398ce5c5dc2f3def02689ae4bb8c42fbb99
This commit is contained in:
Lorenzo Blasa
2022-07-14 06:59:11 -07:00
committed by Facebook GitHub Bot
parent 53b89f485a
commit 57e6662a46
6 changed files with 54 additions and 5 deletions

View File

@@ -68,7 +68,8 @@
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"></ImportGroup> <ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets"> <ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
@@ -102,12 +103,14 @@
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'"> <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile> <ClCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_WIN32;_CRT_SECURE_NO_WARNINGS;FOLLY_NO_CONFIG;NOMINMAX;RN_EXPORT=;JSI_EXPORT=;WIN32;_WINDLL;_HAS_AUTO_PTR_ETC;__unused=[[maybe_unused]];FOLLY_MOBILE=1;_USE_MATH_DEFINES;_UNICODE;UNICODE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;BOOST_ALL_NO_LIB=1;BOOST_ERROR_CODE_HEADER_ONLY;BOOST_NO_RTTI;BOOST_NO_TYPEID;BOOST_SYSTEM_SOURCE;USE_EDGEMODE_JSRT;WIN32_LEAN_AND_MEAN;_DEBUG;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(ProjectDir)..\..\node_modules\.fmt\fmt-7.1.3\include;$(ProjectDir)..\..\node_modules\.folly\folly-2021.06.28.00\;$(ProjectDir)..\..\node_modules\react-native-windows\stubs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'"> <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile> <ClCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_WIN32;_CRT_SECURE_NO_WARNINGS;FOLLY_NO_CONFIG;NOMINMAX;RN_EXPORT=;JSI_EXPORT=;WIN32;_WINDLL;_HAS_AUTO_PTR_ETC;__unused=[[maybe_unused]];FOLLY_MOBILE=1;_USE_MATH_DEFINES;_UNICODE;UNICODE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;BOOST_ALL_NO_LIB=1;BOOST_ERROR_CODE_HEADER_ONLY;BOOST_NO_RTTI;BOOST_NO_TYPEID;BOOST_SYSTEM_SOURCE;USE_EDGEMODE_JSRT;WIN32_LEAN_AND_MEAN;_DEBUG;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(ProjectDir)..\..\node_modules\.fmt\fmt-7.1.3\include;$(ProjectDir)..\..\node_modules\.folly\folly-2021.06.28.00\;$(ProjectDir)..\..\node_modules\react-native-windows\stubs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
@@ -130,14 +133,25 @@
<Midl Include="ReactPackageProvider.idl" /> <Midl Include="ReactPackageProvider.idl" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="cpp.hint" />
<None Include="packages.config" />
<None Include="PropertySheet.props" /> <None Include="PropertySheet.props" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Windows.CppWinRT" Version="2.0.211028.7" /> <PackageReference Include="Microsoft.Windows.CppWinRT" Version="2.0.211028.7" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\node_modules\react-native-windows\fmt\fmt.vcxproj">
<Project>{14b93dc8-fd93-4a6d-81cb-8bc96644501c}</Project>
</ProjectReference>
<ProjectReference Include="..\..\node_modules\react-native-windows\Folly\Folly.vcxproj">
<Project>{a990658c-ce31-4bcc-976f-0fc6b1af693d}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ReactNativeWindowsTargets"> <ImportGroup Label="ReactNativeWindowsTargets">
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets')" /> <Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets')" />
<Import Project="..\packages\boost.1.76.0.0\build\boost.targets" Condition="Exists('..\packages\boost.1.76.0.0\build\boost.targets')" />
</ImportGroup> </ImportGroup>
<Target Name="EnsureReactNativeWindowsTargets" BeforeTargets="PrepareForBuild"> <Target Name="EnsureReactNativeWindowsTargets" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
@@ -146,4 +160,10 @@
<Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props'))" /> <Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props'))" />
<Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets'))" /> <Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets'))" />
</Target> </Target>
</Project> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\boost.1.76.0.0\build\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost.1.76.0.0\build\boost.targets'))" />
</Target>
</Project>

View File

@@ -15,5 +15,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="PropertySheet.props" /> <None Include="PropertySheet.props" />
<None Include="cpp.hint" />
<None Include="packages.config" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -7,6 +7,8 @@
#pragma once #pragma once
#include <folly/dynamic.h>
#include <folly/json.h>
#include "JSValue.h" #include "JSValue.h"
#include "NativeModules.h" #include "NativeModules.h"

View File

@@ -0,0 +1,4 @@
// Hint files help the Visual Studio IDE interpret Visual C++ identifiers
// such as names of functions and macros.
// For more information see https://go.microsoft.com/fwlink/?linkid=865984
#define REACT_MODULE(__VA_ARGS__) INTERNAL_REACT_MODULE(__VA_ARGS__)(__VA_ARGS__)

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="boost" version="1.76.0.0" targetFramework="native" />
</packages>

View File

@@ -10,10 +10,27 @@
#define NOMINMAX #define NOMINMAX
#include <CppWinRTIncludes.h> #include <CppWinRTIncludes.h>
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <math.h>
#include <windows.h>
#include <condition_variable>
#include <functional>
#include <iostream>
#include <map>
#include <string>
#include <folly/dynamic.h>
#include <folly/json.h>
#include <hstring.h> #include <hstring.h>
#include <restrictederrorinfo.h> #include <restrictederrorinfo.h>
#include <unknwn.h> #include <unknwn.h>
#include <windows.h>
#if __has_include(<VersionMacros.h>) #if __has_include(<VersionMacros.h>)
#include <VersionMacros.h> #include <VersionMacros.h>
#endif #endif