1# Apache Thrift - CMake Build
2
3## Goal
4
5Extend Apache Thrift's *make cross* approach to the build system.
6
7Due to growing the field of operating system support, a proper executable
8and library detection mechanism running on as much platforms as possible
9becomes required. The other aspect to simplify the release process and
10package generation process.
11
12As nice side benefit of CMake is the generation of development environment
13specific soultion files. => No solution files within source tree.
14
15## Prerequisites
16
17These are language-specific, however for C++ you must provide:
18
19- Boost
20- OpenSSL
21
22You may optionally provide:
23
24- libevent
25- zlib
26
27## Usage
28
29To use CMake you first create an out-of-tree build directory, then use
30CMake to generate a build framework, then build:
31
32    mkdir /tmp/build
33    cd /tmp/build
34    cmake /location/to/thrift
35
36if you use a specific toolchain pass it to cmake, the same for options:
37
38    cmake -DCMAKE_TOOLCHAIN_FILE=../build/cmake/mingw32-toolchain.cmake ..
39    cmake -DCMAKE_C_COMPILER=clang-3.5 -DCMAKE_CXX_COMPILER=clang++-3.5 ..
40    cmake -DTHRIFT_COMPILER_HS=OFF ..
41    cmake -DWITH_ZLIB=ON ..
42
43and open the development environment you like with the solution or do this:
44
45    make
46    make check
47    make cross
48    make dist
49
50or on Windows, the following will produce a solution file you can use
51inside Visual Studio:
52
53    cmake -G "Visual Studio 15 2017 Win64" \
54      -DBOOST_ROOT=C:/3rdparty/boost_1_69_0 \
55      -DBOOST_LIBRARYDIR=C:/3rdparty/boost_1_69_0/lib64-msvc-14.1^
56      -DZLIB_ROOT=C:/3rdparty/zlib-1.2.11
57
58<!--
59To generate an installer and distribution package do this:
60
61    cpack
62-->
63
64## TODO
65
66* git hash or tag based versioning depending on source state
67* build tutorial
68* build test
69* enable/disable
70* make cross
71* make dist (create an alias to make package_source)
72* make doc
73* cpack (C++ and make dist only ?)
74  * thrift-compiler
75  * libthrift
76  * tutorial
77  * test
78* merge into /README.md