ArchiveorgSoftwareAn open-source C++ library developed and used at Facebook. Folly (acronymed loosely after Facebook Open Source Library) is alibrary of C++14 components designed with practicality and efficiencyin mind. Folly contains a variety of core library components used extensivelyat Facebook. In particular, it's often a dependency of Facebook's otheropen source C++ efforts and place where those projects can share code.It complements (as opposed to competing against) offeringssuch as Boost and of course std. In fact, we embark on defining ourown component only when something we need is either not available, ordoes not meet the needed performance profile. We endeavor to removethings from folly if or when std or Boost obsoletes them.Performance concerns permeate much of Folly, sometimes leading todesigns that are more idiosyncratic than they would otherwise be (seee.g. PackedSyncPtr.h, SmallLocks.h). Good performance at largescale is a unifying theme in all of Folly.Check it out in the intro video Folly is a collection of relatively independent components, some assimple as a few symbols. There is no restriction on internaldependencies, meaning that a given folly module may use any otherfolly components.All symbols are defined in the top-level namespace folly, except ofcourse macros. Macro names are ALL_UPPERCASE and should be prefixedwith FOLLY_. Namespace folly defines other internal namespacessuch as internal or detail. User code should not depend on symbolsin those namespaces.Folly has an experimental directory as well. This designation connotesprimarily that we feel the API may change heavily over time. This code,typically, is still in heavy use and is well tested.At the top level Folly uses the classic "stuttering" schemefolly/folly used by Boost and others. The first directory serves asan installation root of the library (with possible versioning a lafolly-1.0/), and the second is to distinguish the library whenincluding files, e.g. #include <folly/FBString.h>.The directory structure is flat (mimicking the namespace structure),i.e. we don't have an elaborate directory hierarchy (it is possiblethis will change in future versions). The subdirectory experimentalcontains files that are used inside folly and possibly at Facebook butnot considered stable enough for client use. Your code should not usefiles in folly/experimental lest it may break when you update Folly.The folly/folly/test subdirectory includes the unittests for allcomponents, usually named ComponentXyzTest.cpp for eachComponentXyz.*. The folly/folly/docs directory containsdocumentation.Because of folly's fairly flat structure, the best way to see what's in itis to look at the headers in top level <code>folly/</code> directory[1]. You can alsocheck the <code>docs</code> folder[2] for documentation, starting with theoverview[3].Folly is published on GitHub at https://github.com/facebook/follyBecause folly does not provide any ABI compatibility guarantees from commit tocommit, we generally recommend building folly as a static library.folly supports gcc (5.1+), clang, or MSVC. It should run on Linux (x86-32,x86-64, and ARM), iOS, macOS, and Windows (x86-64). The CMake build is onlytested on some of these platforms; at a minimum, we aim to support macOS andLinux (on the latest Ubuntu LTS release or newer.)getdeps.pyThis script is used by many of Meta's OSS tools. It will download and build all of the necessary dependencies first, and will then invoke cmake etc to build folly. This will help ensure that you build with relevant versions of all of the dependent libraries, taking into account what versions are installed locally on your system.It's written in python so you'll need python3.6 or later on your PATH. It works on Linux, macOS and Windows.The settings for folly's cmake build are held in its getdeps manifest build/fbcode_builder/manifests/folly, which you can edit locally if desired.DependenciesIf on Linux or MacOS (with homebrew installed) you can install system dependencies to save building them:# Clone the repogit clone https://github.com/facebook/folly# Install dependenciescd follysudo ./build/fbcode_builder/getdeps.py install-system-deps --recursiveIf you'd like to see the packages before installing them:./build/fbcode_builder/getdeps.py install-system-deps --dry-run --recursiveOn other platforms or if on Linux and without system dependencies getdeps.py will mostly download and build them for you during the build step.Some of the dependencies getdeps.py uses and installs are:a version of boost compiled with C++14 support.googletest is required to build and run folly's testsBuildThis script will download and build all of the necessary dependencies first,and will then invoke cmake etc to build folly. This will help ensure that you build with relevant versions of all of the dependent libraries, taking into account what versions are installed locally on your system.getdeps.py currently requires python 3.6+ to be on your path.getdeps.py will invoke cmake etc# Clone the repogit clone https://github.com/facebook/follycd folly# Build, using system dependencies if availablepython3 ./build/fbcode_builder/getdeps.py --allow-system-packages buildIt puts output in its scratch area:installed/folly/lib/libfolly.a: LibraryYou can also specify a --scratch-path argument to controlthe location of the scratch directory used for the build. You can find the default scratch install location from logs or with python3 ./build/fbcode_builder/getdeps.py show-inst-dirThere are also--install-dir and --install-prefix arguments to provide some morefine-grained control of the installation directories. However, given thatfolly provides no compatibility guarantees between commits we generallyrecommend building and installing the libraries to a temporary location, andthen pointing your project's build at this temporary location, rather thaninstalling folly in the traditional system installation directories. e.g., if you are building with CMake you can use the CMAKE_PREFIX_PATH variable to allow CMake to find folly in this temporary installation directory whenbuilding your project.If you want to invoke cmake again to iterate, there is a helpful run_cmake.py script output in the scratch build directory. You can find the scratch build directory from logs or with python3 ./build/fbcode_builder/getdeps.py show-build-dirRun testsBy default getdeps.py will build the tests for folly. To run them:cd follypython3 ./build/fbcode_builder/getdeps.py --allow-system-packages testbuild.sh/build.bat wrapperbuild.sh can be used on Linux and MacOS, on Windows usethe build.bat script instead. Its a wrapper around getdeps.pyBuild with cmake directlyIf you don't want to let getdeps invoke cmake for you then by default, building the tests is disabled as part of the CMake all target.To build the tests, specify -DBUILD_TESTS=ON to CMake at configure time.NB if you want to invoke cmake again to iterate on a getdeps.py build, there is a helpful run_cmake.py script output in the scratch-path build directory. You can find the scratch build directory from logs or with python3 ./build/fbcode_builder/getdeps.py show-build-dirRunning tests with ctests also works if you cd to the build dir, e.g. (cd $(python3 ./build/fbcode_builder/getdeps.py show-build-dir) && ctest)`Finding dependencies in non-default locationsIf you have boost, gtest, or other dependencies installed in a non-defaultlocation, you can use the CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATHvariables to make CMAKE look also look for header files and libraries innon-standard locations. For example, to also search the directories/alt/include/path1 and /alt/include/path2 for header files and thedirectories /alt/lib/path1 and /alt/lib/path2 for libraries, you can invokecmake as follows:cmake \ -DCMAKE_INCLUDE_PATH=/alt/include/path1:/alt/include/path2 \ -DCMAKE_LIBRARY_PATH=/alt/lib/path1:/alt/lib/path2 ...Ubuntu LTS, CentOS Stream, FedoraUse the getdeps.py approach above. We test in CI on Ubuntu LTS, and occasionally on other distros.If you find the set of system packages is not quite right for your chosen distro, you can specify distro version specific overrides in the dependency manifests (e.g. https://github.com/facebook/folly/blob/main/build/fbcode_builder/manifests/boost ). You could probably make it work on most recent Ubuntu/Debian or Fedora/Redhat derived distributions.At time of writing (Dec 2021) there is a build break on GCC 11.x based systems in langbadgetest. If you don't need badge functionality you can work around by commenting it out from CMakeLists.txt (unfortunately fbthrift does need it)Windows (Vcpkg)Note that many tests are disabled for folly Windows builds, you can see them in the log from the cmake configure step, or by looking for WINDOWS_DISABLED in CMakeLists.txtThat said, getdeps.py builds work on Windows and are tested in CI.If you prefer, you can try Vcpkg. folly is available in Vcpkg[4] and releases may be built via vcpkg install folly:x64-windows.You may also use vcpkg install folly:x64-windows --head to build against main.macOSgetdeps.py builds work on macOS and are tested in CI, however if you prefer, you can try one of the macOS package managersHomebrewfolly is available as a Formula and releases may be built via brew install folly.You may also use folly/build/bootstrap-osx-homebrew.sh to build against main: ./folly/build/bootstrap-osx-homebrew.shThis will create a build directory _build in the top-level.MacPortsInstall the required packages from MacPorts: sudo port install \ boost \ cmake \ gflags \ git \ google-glog \ libevent \ libtool \ lz4 \ lzma \ openssl \ snappy \ xz \ zlibDownload and install double-conversion: git clone https://github.com/google/double-conversion.git cd double-conversion cmake -DBUILD_SHARED_LIBS=ON . make sudo make installDownload and install folly with the parameters listed below: git clone https://github.com/facebook/folly.git cd folly mkdir _build cd _build cmake .. make sudo make install To restore the repository download the bundle wget https://archive.org/download/github.com-facebook-folly_-_2022-12-02_16-06-27/facebook-folly_-_2022-12-02_16-06-27.bundle and run: git clone facebook-folly_-_2022-12-02_16-06-27.bundle Source: https://github.com/facebook/folly[5]Uploader: facebook[6]Upload date: 2022-12-02 References^ top level folly/ directory (github.com)^ docs folder (archive.org)^ overview (archive.org)^ Vcpkg (github.com)^ https://github.com/facebook/folly (github.com)^ facebook (github.com)

weiterlesen: RSS Quelle öffnen