| Pascal Bach | 6eb015a | 2014-04-17 16:19:07 +0200 | [diff] [blame] | 1 | # Build compiler using CMake |
| 2 | |
| 3 | Use the following steps to build using cmake |
| 4 | |
| Roger Meier | 746952e | 2014-06-14 21:59:24 +0200 | [diff] [blame] | 5 | mkdir build |
| 6 | cd build |
| 7 | cmake .. |
| 8 | make |
| Pascal Bach | 6eb015a | 2014-04-17 16:19:07 +0200 | [diff] [blame] | 9 | |
| 10 | ## Build on windows |
| 11 | |
| 12 | In order to build on windows a few additional steps are necessary |
| 13 | |
| 14 | 1. Download winflexbison from http://sourceforge.net/projects/winflexbison/ |
| 15 | 2. Extract the winflex bison files to for e.g. C:\winflexbison |
| 16 | 3. Make the CMake variables point to the correct binaries. |
| 17 | * FLEX_EXECUTBALE = C:/winbuild/win_flex.exe |
| 18 | * BISON_EXECUTBALE = C:/winbuild/win_bison.exe |
| 19 | |
| Roger Meier | 746952e | 2014-06-14 21:59:24 +0200 | [diff] [blame] | 20 | # Building the Thrift IDL compiler in Windows |
| 21 | |
| 22 | The Visual Studio project contains pre-build commands to generate the |
| 23 | thriftl.cc, thrifty.cc and thrifty.hh files which are necessary to build |
| 24 | the compiler. These depend on bison, flex and their dependencies to |
| 25 | work properly. If this doesn't work on a system, try these manual |
| 26 | pre-build steps. |
| 27 | |
| 28 | Open compiler.sln and remove the Pre-build commands under the project's |
| 29 | Properties -> Build Events -> Pre-Build Events. |
| 30 | |
| 31 | Download flex & bison from http://jaisantonyk.wordpress.com/2008/03/16/lex-and-yaccbison-in-windows/ |
| 32 | Download bison.simple in addition to bison.exe . This build of bison is easier to use |
| 33 | than the one on sourceforge which has a myriad of dependencies. |
| 34 | Place these binaries somewhere in the path. |
| 35 | |
| 36 | From a command prompt: |
| 37 | > cd thrift/compiler/cpp |
| 38 | > flex -osrc\thriftl.cc src\thriftl.ll |
| 39 | In the generated thriftl.cc, comment out #include <unistd.h> |
| 40 | |
| 41 | Place a copy of bison.simple in thrift/compiler/cpp |
| 42 | > bison -y -o "src/thrifty.cc" --defines src/thrifty.yy |
| 43 | > move src\thrifty.cc.hh src\thrifty.hh |
| 44 | |
| 45 | Bison might generate the yacc header file "thrifty.cc.h" with just one h ".h" extension; in this case you'll have to rename to "thrifty.h". |
| 46 | |
| 47 | > move src\windows\version.h.in src\windows\version.h |
| 48 | |
| 49 | Download inttypes.h from the interwebs and place it in an include path |
| 50 | location (e.g. thrift/compiler/cpp/src). |
| 51 | |
| 52 | Build the compiler in Visual Studio. |