blob: a0eb859bd24db952aa68d98ae977b3e4db010549 [file] [log] [blame] [view]
James E. King III278528c2019-01-11 12:17:44 -05001# Apache Thrift - CMake Build
Pascal Bachd5f87e12014-12-12 15:59:17 +01002
3## Goal
James E. King III278528c2019-01-11 12:17:44 -05004
Pascal Bachd5f87e12014-12-12 15:59:17 +01005Extend 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
James E. King III278528c2019-01-11 12:17:44 -050015## 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
Pascal Bachd5f87e12014-12-12 15:59:17 +010026
27## Usage
Pascal Bachd5f87e12014-12-12 15:59:17 +010028
James E. King III278528c2019-01-11 12:17:44 -050029To 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
Pascal Bachd5f87e12014-12-12 15:59:17 +010035
36if you use a specific toolchain pass it to cmake, the same for options:
37
Roger Meier4ead5202015-05-15 16:21:41 +020038 cmake -DCMAKE_TOOLCHAIN_FILE=../build/cmake/mingw32-toolchain.cmake ..
Roger Meiera6b66332015-05-15 15:21:50 +020039 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
Pascal Bachd5f87e12014-12-12 15:59:17 +010043and 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
James E. King III278528c2019-01-11 12:17:44 -050050or 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:
Pascal Bachd5f87e12014-12-12 15:59:17 +010060
61 cpack
James E. King III278528c2019-01-11 12:17:44 -050062-->
Pascal Bachd5f87e12014-12-12 15:59:17 +010063
64## TODO
James E. King III278528c2019-01-11 12:17:44 -050065
Pascal Bachd5f87e12014-12-12 15:59:17 +010066* git hash or tag based versioning depending on source state
67* build tutorial
68* build test
Pascal Bachd5f87e12014-12-12 15:59:17 +010069* enable/disable
Pascal Bachd5f87e12014-12-12 15:59:17 +010070* 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
James E. King III278528c2019-01-11 12:17:44 -050078* merge into /README.md