| Pascal Bach | 6eb015a | 2014-04-17 16:19:07 +0200 | [diff] [blame] | 1 | # Build compiler using CMake |
| 2 | |
| henrique | 55087a4 | 2014-06-17 12:36:39 +0200 | [diff] [blame^] | 3 | Use the following steps to build using cmake: |
| Pascal Bach | 6eb015a | 2014-04-17 16:19:07 +0200 | [diff] [blame] | 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 | |
| henrique | 55087a4 | 2014-06-17 12:36:39 +0200 | [diff] [blame^] | 10 | |
| 11 | ### Create an eclipse project |
| 12 | |
| 13 | mkdir build_ec && cd build_ec |
| 14 | cmake -G "Eclipse CDT4 - Unix Makefiles" .. |
| 15 | make |
| 16 | |
| 17 | Now open the folder build_ec using eclipse. |
| 18 | |
| 19 | |
| 20 | ### Cross compile using mingw32 |
| 21 | |
| 22 | mkdir build_mingw32 && cd build_mingw32 |
| 23 | cmake -DCMAKE_TOOLCHAIN_FILE=../../../contrib/mingw32-toolchain.cmake .. |
| 24 | make |
| 25 | |
| 26 | |
| 27 | |
| Pascal Bach | 6eb015a | 2014-04-17 16:19:07 +0200 | [diff] [blame] | 28 | ## Build on windows |
| 29 | |
| henrique | 55087a4 | 2014-06-17 12:36:39 +0200 | [diff] [blame^] | 30 | In order to build on windows a few additional steps are necessary: |
| Pascal Bach | 6eb015a | 2014-04-17 16:19:07 +0200 | [diff] [blame] | 31 | |
| 32 | 1. Download winflexbison from http://sourceforge.net/projects/winflexbison/ |
| 33 | 2. Extract the winflex bison files to for e.g. C:\winflexbison |
| 34 | 3. Make the CMake variables point to the correct binaries. |
| 35 | * FLEX_EXECUTBALE = C:/winbuild/win_flex.exe |
| 36 | * BISON_EXECUTBALE = C:/winbuild/win_bison.exe |
| 37 | |
| henrique | 55087a4 | 2014-06-17 12:36:39 +0200 | [diff] [blame^] | 38 | |
| 39 | ### Create a Visual Studio project |
| 40 | |
| 41 | mkdir build_vs && cd build_vs |
| 42 | cmake -G "Visual Studio 12" .. |
| 43 | |
| 44 | Now open the folder build_vs using Visual Studio 2013. |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| Roger Meier | 746952e | 2014-06-14 21:59:24 +0200 | [diff] [blame] | 49 | # Building the Thrift IDL compiler in Windows |
| 50 | |
| henrique | 55087a4 | 2014-06-17 12:36:39 +0200 | [diff] [blame^] | 51 | If you don't want to use CMake you can use the already available Visual Studio |
| 52 | 2010 solution. |
| Roger Meier | 746952e | 2014-06-14 21:59:24 +0200 | [diff] [blame] | 53 | The Visual Studio project contains pre-build commands to generate the |
| 54 | thriftl.cc, thrifty.cc and thrifty.hh files which are necessary to build |
| 55 | the compiler. These depend on bison, flex and their dependencies to |
| 56 | work properly. If this doesn't work on a system, try these manual |
| 57 | pre-build steps. |
| 58 | |
| 59 | Open compiler.sln and remove the Pre-build commands under the project's |
| 60 | Properties -> Build Events -> Pre-Build Events. |
| 61 | |
| 62 | Download flex & bison from http://jaisantonyk.wordpress.com/2008/03/16/lex-and-yaccbison-in-windows/ |
| 63 | Download bison.simple in addition to bison.exe . This build of bison is easier to use |
| 64 | than the one on sourceforge which has a myriad of dependencies. |
| 65 | Place these binaries somewhere in the path. |
| 66 | |
| 67 | From a command prompt: |
| 68 | > cd thrift/compiler/cpp |
| 69 | > flex -osrc\thriftl.cc src\thriftl.ll |
| 70 | In the generated thriftl.cc, comment out #include <unistd.h> |
| 71 | |
| 72 | Place a copy of bison.simple in thrift/compiler/cpp |
| 73 | > bison -y -o "src/thrifty.cc" --defines src/thrifty.yy |
| 74 | > move src\thrifty.cc.hh src\thrifty.hh |
| 75 | |
| 76 | 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". |
| 77 | |
| 78 | > move src\windows\version.h.in src\windows\version.h |
| 79 | |
| 80 | Download inttypes.h from the interwebs and place it in an include path |
| 81 | location (e.g. thrift/compiler/cpp/src). |
| 82 | |
| 83 | Build the compiler in Visual Studio. |