| James E. King III | 278528c | 2019-01-11 12:17:44 -0500 | [diff] [blame] | 1 | # Apache Thrift - CMake Build |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 2 | |
| 3 | ## Goal |
| James E. King III | 278528c | 2019-01-11 12:17:44 -0500 | [diff] [blame] | 4 | |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 5 | Extend Apache Thrift's *make cross* approach to the build system. |
| 6 | |
| 7 | Due to growing the field of operating system support, a proper executable |
| 8 | and library detection mechanism running on as much platforms as possible |
| 9 | becomes required. The other aspect to simplify the release process and |
| 10 | package generation process. |
| 11 | |
| 12 | As nice side benefit of CMake is the generation of development environment |
| 13 | specific soultion files. => No solution files within source tree. |
| 14 | |
| James E. King III | 278528c | 2019-01-11 12:17:44 -0500 | [diff] [blame] | 15 | ## Prerequisites |
| 16 | |
| 17 | These are language-specific, however for C++ you must provide: |
| 18 | |
| 19 | - Boost |
| 20 | - OpenSSL |
| 21 | |
| 22 | You may optionally provide: |
| 23 | |
| 24 | - libevent |
| 25 | - zlib |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 26 | |
| 27 | ## Usage |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 28 | |
| James E. King III | 278528c | 2019-01-11 12:17:44 -0500 | [diff] [blame] | 29 | To use CMake you first create an out-of-tree build directory, then use |
| 30 | CMake to generate a build framework, then build: |
| 31 | |
| 32 | mkdir /tmp/build |
| 33 | cd /tmp/build |
| 34 | cmake /location/to/thrift |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 35 | |
| 36 | if you use a specific toolchain pass it to cmake, the same for options: |
| 37 | |
| Roger Meier | 4ead520 | 2015-05-15 16:21:41 +0200 | [diff] [blame] | 38 | cmake -DCMAKE_TOOLCHAIN_FILE=../build/cmake/mingw32-toolchain.cmake .. |
| Roger Meier | a6b6633 | 2015-05-15 15:21:50 +0200 | [diff] [blame] | 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 | |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 43 | and 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 III | 278528c | 2019-01-11 12:17:44 -0500 | [diff] [blame] | 50 | or on Windows, the following will produce a solution file you can use |
| 51 | inside 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 | <!-- |
| 59 | To generate an installer and distribution package do this: |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 60 | |
| 61 | cpack |
| James E. King III | 278528c | 2019-01-11 12:17:44 -0500 | [diff] [blame] | 62 | --> |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 63 | |
| 64 | ## TODO |
| James E. King III | 278528c | 2019-01-11 12:17:44 -0500 | [diff] [blame] | 65 | |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 66 | * git hash or tag based versioning depending on source state |
| 67 | * build tutorial |
| 68 | * build test |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 69 | * enable/disable |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 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 |
| James E. King III | 278528c | 2019-01-11 12:17:44 -0500 | [diff] [blame] | 78 | * merge into /README.md |