Folly项目的Cmake文件

时间:2019-06-09 03:15:35

标签: c++ folly

我正在尝试写一个玩具示例来使用Facebook的private async void BtnTest_Click(object sender, RoutedEventArgs e) { await TestAsync(); } private async Task TestAsync() { Task<StorageFolder> pickedFolder = MyPickFolderAsync(); await MyTestAsync(...); //this method does something with pickedFolder folder but that is not relevant to this post since we don't even get to this line in debug mode as the Windows dialog hangs before we get to this line } private async Task<StorageFolder> MyPickFolderAsync() { Windows.Storage.Pickers.FolderPicker folderPicker = new Windows.Storage.Pickers.FolderPicker(); folderPicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Downloads; folderPicker.FileTypeFilter.Add("*"); Windows.Storage.StorageFolder folder = await folderPicker.PickSingleFolderAsync(); if (folder != null) { // Application now has read/write access to all contents in the picked folder (including other sub-folder contents) Windows.Storage.AccessCache.StorageApplicationPermissions. FutureAccessList.AddOrReplace("PickedFolderToken", folder); //this.textBlock.Text = "Picked folder: " + folder.Name; } else { //this.textBlock.Text = "Operation cancelled."; } return folder; } library。该程序包含以下内容:

Folly

问题是我不确定编译这样的程序需要哪些库。如果有人可以为#include <utility> #include <iostream> #include <folly/Format.h> #include <folly/futures/Future.h> #include <folly/executors/ThreadedExecutor.h> #include <folly/Uri.h> #include <folly/FBString.h> static void print_uri(const folly::fbstring &address) { const folly::Uri uri(address); const auto authority = folly::format("The authority from {} is {}", uri.fbstr(), uri.authority()); std::cout << authority << std::endl; } int main() { folly::ThreadedExecutor executor; folly::Promise<folly::fbstring> promise; folly::Future<folly::fbstring> future = promise.getSemiFuture().via(&executor); folly::Future<folly::Unit> unit = std::move(future).thenValue(print_uri); promise.setValue("https://conan.io/"); std::move(unit).get(); return 0; } 项目共享CMakeList.txt文件,我将不胜感激。

1 个答案:

答案 0 :(得分:0)

这里是制作CMakeLists.txt项目所必需的Folly

cmake_minimum_required(VERSION 3.7)
find_package(Boost REQUIRED)
find_package(folly REQUIRED)
find_package(Threads REQUIRED)
find_package(gflags REQUIRED)

set(CMAKE_CXX_STANDARD 14)
#include_directories(${Boost_INCLUDE_DIRS})
#include_directories(${folly_INCLUDE_DIRS})

set_and_check(FOLLY_INCLUDE_DIR /usr/local/include/folly)
set_and_check(FOLLY_CMAKE_DIR /usr/local/lib/cmake/folly)
if (NOT TARGET Folly::folly)
  include("${FOLLY_CMAKE_DIR}/folly-targets.cmake")
endif()


set(FOLLY_LIBRARIES Folly::folly)

if (NOT folly_FIND_QUIETLY)
  message(STATUS "Found folly: ${PACKAGE_PREFIX_DIR}")
endif()

add_executable(HelloWorld main.cpp)
target_link_libraries(HelloWorld ${Boost_LIBRARIES} ${FOLLY_LIBRARIES})