1 Folly: Facebook Open-source Library
2 -----------------------------------
6 Folly (acronymed loosely after Facebook Open Source Library) is a
7 library of C++11 components designed with practicality and efficiency
8 in mind. **Folly contains a variety of core library components used extensively
9 at Facebook**. In particular, it's often a dependency of Facebook's other
10 open source C++ efforts and place where those projects can share code.
12 It complements (as opposed to competing against) offerings
13 such as Boost and of course `std`. In fact, we embark on defining our
14 own component only when something we need is either not available, or
15 does not meet the needed performance profile. We endeavor to remove
16 things from folly if or when `std` or Boost obsoletes them.
18 Performance concerns permeate much of Folly, sometimes leading to
19 designs that are more idiosyncratic than they would otherwise be (see
20 e.g. `PackedSyncPtr.h`, `SmallLocks.h`). Good performance at large
21 scale is a unifying theme in all of Folly.
25 Folly is a collection of relatively independent components, some as
26 simple as a few symbols. There is no restriction on internal
27 dependencies, meaning that a given folly module may use any other
30 All symbols are defined in the top-level namespace `folly`, except of
31 course macros. Macro names are ALL_UPPERCASE and should be prefixed
32 with `FOLLY_`. Namespace `folly` defines other internal namespaces
33 such as `internal` or `detail`. User code should not depend on symbols
36 Folly has an `experimental` directory as well. This designation connotes
37 primarily that we feel the API may change heavily over time. This code,
38 typically, is still in heavy use and is well tested.
42 At the top level Folly uses the classic "stuttering" scheme
43 `folly/folly` used by Boost and others. The first directory serves as
44 an installation root of the library (with possible versioning a la
45 `folly-1.0/`), and the second is to distinguish the library when
46 including files, e.g. `#include <folly/FBString.h>`.
48 The directory structure is flat (mimicking the namespace structure),
49 i.e. we don't have an elaborate directory hierarchy (it is possible
50 this will change in future versions). The subdirectory `experimental`
51 contains files that are used inside folly and possibly at Facebook but
52 not considered stable enough for client use. Your code should not use
53 files in `folly/experimental` lest it may break when you update Folly.
55 The `folly/folly/test` subdirectory includes the unittests for all
56 components, usually named `ComponentXyzTest.cpp` for each
57 `ComponentXyz.*`. The `folly/folly/docs` directory contains
62 Because of folly's fairly flat structure, the best way to see what's in it
63 is to look at the headers in [top level `folly/` directory](https://github.com/facebook/folly/tree/master/folly). You can also
64 check the [`docs` folder](folly/docs) for documentation, starting with the
65 [overview](folly/docs/Overview.md).
67 Folly is published on Github at https://github.com/facebook/folly
73 folly requires gcc 4.8+ and a version of boost compiled with C++11 support.
75 Please download googletest from
76 https://googletest.googlecode.com/files/gtest-1.7.0.zip and unzip it in the
77 folly/test subdirectory.
81 This release is old, requiring many upgrades. However, since Travis CI runs
82 on 12.04, `folly/build/deps_ubuntu_12.04.sh` is provided, and upgrades all
83 the required packages.
87 The following packages are required (feel free to cut and paste the apt-get
91 sudo apt-get install \
99 libdouble-conversion-dev \
112 If advanced dubugging functionality for tests are required
115 sudo apt-get install \
121 #### Ubuntu 14.04 LTS
123 The packages listed above for Ubuntu 13.10 are required, as well as:
126 sudo apt-get install \
130 The above packages are sufficient for Ubuntu 13.10 and Ubuntu 14.04.
132 In the folly directory, run
143 folly is available as a Formula and releases may be built via `brew install folly`.
145 You may also use `folly/build/bootstrap-osx-homebrew.sh` to build against `master`:
149 ./build/bootstrap-osx-homebrew.sh
156 Install the required packages from MacPorts:
175 Download and install double-conversion:
178 git clone https://github.com/google/double-conversion.git
180 cmake -DBUILD_SHARED_LIBS=ON .
185 Download and install folly with the parameters listed below:
188 git clone https://github.com/facebook/folly.git
191 ./configure CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib"
196 #### Other Linux distributions
198 - double-conversion (https://github.com/google/double-conversion)
200 Download and build double-conversion.
201 You may need to tell configure where to find it.
203 [double-conversion/] `ln -s src double-conversion`
205 [folly/] `./configure LDFLAGS=-L$DOUBLE_CONVERSION_HOME/ CPPFLAGS=-I$DOUBLE_CONVERSION_HOME/`
207 [folly/] `LD_LIBRARY_PATH=$DOUBLE_CONVERSION_HOME/ make`
209 - additional platform specific dependencies:
226 - double-conversion-devel