This commit is contained in:
Christopher Warrington 2015-12-18 13:48:09 -08:00
Родитель d576674432
Коммит cbe804b70f
1 изменённых файлов: 44 добавлений и 43 удалений

Просмотреть файл

@ -4,9 +4,9 @@
Bond Bond
==== ====
Bond is an open source, cross-platform framework for working with schematized Bond is an open source, cross-platform framework for working with schematized
data. It supports cross-language serialization/deserialization and powerful data. It supports cross-language serialization/deserialization and powerful
generic mechanisms for efficiently manipulating data. Bond is broadly used at generic mechanisms for efficiently manipulating data. Bond is broadly used at
Microsoft in high scale services. Microsoft in high scale services.
Bond is published on GitHub at [https://github.com/Microsoft/bond/](https://github.com/Microsoft/bond/). Bond is published on GitHub at [https://github.com/Microsoft/bond/](https://github.com/Microsoft/bond/).
@ -24,14 +24,14 @@ For a discussion how Bond compares to similar frameworks see [Why Bond](https://
Dependencies Dependencies
------------ ------------
The Bond repository uses Git submodules and should be cloned with the The Bond repository uses Git submodules and should be cloned with the
`--recursive` flag: `--recursive` flag:
git clone --recursive https://github.com/Microsoft/bond.git git clone --recursive https://github.com/Microsoft/bond.git
In order to build Bond you will need CMake (2.8.12+), Haskell (ghc 7.4+ and In order to build Bond you will need CMake (2.8.12+), Haskell (ghc 7.4+ and
cabal-install 1.18+) and Boost (1.54+). The core Bond C++ library can be used cabal-install 1.18+) and Boost (1.54+). The core Bond C++ library can be used
with C++03 compilers, although Python support, unit tests and various examples with C++03 compilers, although Python support, unit tests and various examples
require some C++11 features. require some C++11 features.
Following are specific instructions for building on various platforms. Following are specific instructions for building on various platforms.
@ -41,7 +41,7 @@ Following are specific instructions for building on various platforms.
Bond can be built with Clang (3.4+) or GNU C++ (4.7+). We recommend the latest Bond can be built with Clang (3.4+) or GNU C++ (4.7+). We recommend the latest
version of Clang as it's much faster with template-heavy code like Bond. version of Clang as it's much faster with template-heavy code like Bond.
Run the following commands to install the minimal set of packages needed to Run the following commands to install the minimal set of packages needed to
build the core Bond library on Ubuntu 14.04: build the core Bond library on Ubuntu 14.04:
sudo apt-get install \ sudo apt-get install \
@ -64,10 +64,10 @@ In the root `bond` directory run:
make make
sudo make install sudo make install
The `build` directory is just an example. Any directory can be used for build The `build` directory is just an example. Any directory can be used as the build
destination. destination.
In order to build all the C++ and Python tests and examples, a few more In order to build all the C++ and Python tests and examples, a few more
packages are needed: packages are needed:
sudo apt-get install \ sudo apt-get install \
@ -78,18 +78,18 @@ packages are needed:
cabal install happy cabal install happy
Running the following command in the build directory will build and execute all Running the following command in the build directory will build and execute all
the tests and examples: the tests and examples:
make --jobs 8 check make --jobs 8 check
(unit tests are large so you may want to run 4-8 build jobs in parallel, (The unit tests are large so you may want to run 4-8 build jobs in parallel,
assuming you have enough memory) assuming you have enough memory.)
### OS X ### OS X
Install XCode and then run the following command to install required packages Install Xcode and then run the following command to install the required
using Homebrew ([http://brew.sh/](http://brew.sh/)): packages using Homebrew ([http://brew.sh/](http://brew.sh/)):
brew install \ brew install \
cmake \ cmake \
@ -98,15 +98,15 @@ using Homebrew ([http://brew.sh/](http://brew.sh/)):
boost \ boost \
boost-python boost-python
(boost-python is optional and only needed for Python support) (boost-python is optional and only needed for Python support.)
Update cabal package database and install `happy` (only needed for tests): Update the cabal package database and install `happy` (only needed for tests):
cabal update cabal update
cabal install happy cabal install happy
Bond can be built on OS X using either standard \*nix makefiles or XCode. In Bond can be built on OS X using either standard \*nix makefiles or Xcode. In
order to generate and build makefiles, in the root `bond` directory run: order to generate and build from makefiles, in the root `bond` directory run:
mkdir build mkdir build
cd build cd build
@ -114,12 +114,12 @@ order to generate and build makefiles, in the root `bond` directory run:
make make
sudo make install sudo make install
Alternatively, you can generate XCode project by passing `-G Xcode` option to Alternatively, you can generate Xcode projects by passing the `-G Xcode` option
cmake: to cmake:
cmake -G Xcode .. cmake -G Xcode ..
You can build and run unit tests by building the `check` target in XCode or by You can build and run unit tests by building the `check` target in Xcode or by
running make in the build directory: running make in the build directory:
make --jobs 8 check make --jobs 8 check
@ -129,10 +129,11 @@ boost-python from source:
brew install --build-from-source boost-python brew install --build-from-source boost-python
and tell cmake the location of Homebrew's libpython by setting `PYTHON_LIBRARY` and tell cmake the location of Homebrew's libpython by setting the
variable, e.g.: `PYTHON_LIBRARY` variable, e.g.:
cmake .. -DPYTHON_LIBRARY=/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib cmake .. \
-DPYTHON_LIBRARY=/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib
### Windows ### Windows
@ -144,17 +145,17 @@ Install the following tools:
- CMake ([http://www.cmake.org/download/](http://www.cmake.org/download/)) - CMake ([http://www.cmake.org/download/](http://www.cmake.org/download/))
- Haskell Platform ([http://haskell.org/platform/](http://haskell.org/platform/)) - Haskell Platform ([http://haskell.org/platform/](http://haskell.org/platform/))
If you are building on a network behind a proxy, set the environment variable If you are building on a network behind a proxy, set the environment variable
`HTTP_PROXY`, e.g.: `HTTP_PROXY`, e.g.:
set HTTP_PROXY=http://your-proxy-name:80 set HTTP_PROXY=http://your-proxy-name:80
Update cabal package database: Update the cabal package database:
cabal update cabal update
Now you are ready to build the C# version of Bond. Open the solution file Now you are ready to build the C# version of Bond. Open the solution file
`cs\cs.sln` in Visual Studio 2013 and build as usual. The C# unit tests can `cs\cs.sln` in Visual Studio and build as usual. The C# unit tests can
also be run from within the solution. also be run from within the solution.
The C++ and Python versions of Bond additionally require: The C++ and Python versions of Bond additionally require:
@ -162,28 +163,28 @@ The C++ and Python versions of Bond additionally require:
- Boost 1.54+ ([http://www.boost.org/users/download/](http://www.boost.org/users/download/)) - Boost 1.54+ ([http://www.boost.org/users/download/](http://www.boost.org/users/download/))
- Python 2.7 ([https://www.python.org/downloads/](https://www.python.org/downloads/)) - Python 2.7 ([https://www.python.org/downloads/](https://www.python.org/downloads/))
You may need to set the environment variables `BOOST_ROOT` and `BOOST_LIBRARYDIR` You may need to set the environment variables `BOOST_ROOT` and `BOOST_LIBRARYDIR`
to specify where Boost and its pre-built libraries for your environment can be to specify where Boost and its pre-built libraries for your environment can be
found, e.g.: found, e.g.:
set BOOST_ROOT=D:\boost_1_57_0 set BOOST_ROOT=D:\boost_1_57_0
set BOOST_LIBRARYDIR=D:\boost_1_57_0\lib64-msvc-12.0 set BOOST_LIBRARYDIR=D:\boost_1_57_0\lib64-msvc-12.0
The core Bond library and most examples only require Boost headers. The The core Bond library and most examples only require Boost headers. The
pre-built libraries are only needed for unit tests and Python support. If Boost pre-built libraries are only needed for unit tests and Python support. If Boost
or Python libraries are not found on the system, then some tests and examples will or Python libraries are not found on the system, then some tests and examples will
not be built. not be built.
In order to configure solution for Visual Studio 2013 run the following In order to generate a solution to build the C++ and Python versions with Visual
commands from the root `bond` directory: Studio 2013 run the following commands from the root `bond` directory:
mkdir build mkdir build
cd build cd build
cmake -G "Visual Studio 12 2013 Win64" .. cmake -G "Visual Studio 12 2013 Win64" ..
Instead of `cmake` you can also use `cmake-gui` and specify configuration Instead of `cmake` you can also use `cmake-gui` and specify configuration
settings in the UI. This configuration step has to be performed only once. From settings in the UI. This configuration step has to be performed only once. From
now on you can use the generated solution `build\bond.sln` from Visual Studio then on you can use the generated solution `build\bond.sln` from Visual Studio
or build from command line using `cmake`: or build from command line using `cmake`:
set PreferredToolArchitecture=x64 set PreferredToolArchitecture=x64
@ -194,9 +195,9 @@ In order to build and execute the unit tests and examples run:
cmake --build . --target check -- /maxcpucount:8 cmake --build . --target check -- /maxcpucount:8
Setting `PreferredToolArchitecture=x64` selects the 64-bit toolchain which Setting `PreferredToolArchitecture=x64` selects the 64-bit toolchain which
dramatically improves build speed (Bond unit tests are too big to build with dramatically improves build speed. (The Bond unit tests are too big to build
32-bit tools). This variable works for Visual Studio 2013 or 2015. For VS 2012 set the with 32-bit tools.) This variable works for Visual Studio 2013 or 2015. For
following variable instead: Visual Studio 2012 set the following environment variable instead:
set _IsNativeEnvironment=true set _IsNativeEnvironment=true