blob: 7e74b89f9e8dba911f6d47ef2ce1bb10a308839d [file] [log] [blame] [view]
Pascal Bach6eb015a2014-04-17 16:19:07 +02001# Build compiler using CMake
2
henrique55087a42014-06-17 12:36:39 +02003Use the following steps to build using cmake:
Pascal Bach6eb015a2014-04-17 16:19:07 +02004
Roger Meier746952e2014-06-14 21:59:24 +02005 mkdir build
6 cd build
7 cmake ..
8 make
Pascal Bach6eb015a2014-04-17 16:19:07 +02009
henrique55087a42014-06-17 12:36:39 +020010
11### Create an eclipse project
12
13 mkdir build_ec && cd build_ec
14 cmake -G "Eclipse CDT4 - Unix Makefiles" ..
15 make
16
17Now 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 Bach6eb015a2014-04-17 16:19:07 +020028## Build on windows
29
henrique55087a42014-06-17 12:36:39 +020030In order to build on windows a few additional steps are necessary:
Pascal Bach6eb015a2014-04-17 16:19:07 +020031
321. Download winflexbison from http://sourceforge.net/projects/winflexbison/
332. Extract the winflex bison files to for e.g. C:\winflexbison
343. 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
henrique55087a42014-06-17 12:36:39 +020038
39### Create a Visual Studio project
40
41 mkdir build_vs && cd build_vs
42 cmake -G "Visual Studio 12" ..
43
44Now open the folder build_vs using Visual Studio 2013.
45
46
47
48
Roger Meier746952e2014-06-14 21:59:24 +020049# Building the Thrift IDL compiler in Windows
50
henrique55087a42014-06-17 12:36:39 +020051If you don't want to use CMake you can use the already available Visual Studio
522010 solution.
Roger Meier746952e2014-06-14 21:59:24 +020053The Visual Studio project contains pre-build commands to generate the
54thriftl.cc, thrifty.cc and thrifty.hh files which are necessary to build
55the compiler. These depend on bison, flex and their dependencies to
56work properly. If this doesn't work on a system, try these manual
57pre-build steps.
58
59Open compiler.sln and remove the Pre-build commands under the project's
60 Properties -> Build Events -> Pre-Build Events.
61
62Download flex & bison from http://jaisantonyk.wordpress.com/2008/03/16/lex-and-yaccbison-in-windows/
63Download bison.simple in addition to bison.exe . This build of bison is easier to use
64than the one on sourceforge which has a myriad of dependencies.
65Place these binaries somewhere in the path.
66
67From a command prompt:
68> cd thrift/compiler/cpp
69> flex -osrc\thriftl.cc src\thriftl.ll
70In the generated thriftl.cc, comment out #include <unistd.h>
71
72Place 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
76Bison 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
80Download inttypes.h from the interwebs and place it in an include path
81location (e.g. thrift/compiler/cpp/src).
82
83Build the compiler in Visual Studio.