blob: 0e853fba15d0a8159c987ca0a0e18b0df8921415 [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
Roger Meier311f7152014-08-17 22:24:30 +020020### Cross compile using mingw32 and generate a Windows Installer with CPack
henrique55087a42014-06-17 12:36:39 +020021
22 mkdir build_mingw32 && cd build_mingw32
Konrad Grochowski99b9e1d2014-10-01 00:14:14 +020023 cmake -DCMAKE_TOOLCHAIN_FILE=../../../contrib/mingw32-toolchain.cmake ..
Roger Meier87202602014-08-15 22:16:02 +020024 cpack
25
Pascal Bach6eb015a2014-04-17 16:19:07 +020026## Build on windows
27
henrique55087a42014-06-17 12:36:39 +020028In order to build on windows a few additional steps are necessary:
Pascal Bach6eb015a2014-04-17 16:19:07 +020029
301. Download winflexbison from http://sourceforge.net/projects/winflexbison/
312. Extract the winflex bison files to for e.g. C:\winflexbison
323. Make the CMake variables point to the correct binaries.
33 * FLEX_EXECUTBALE = C:/winbuild/win_flex.exe
34 * BISON_EXECUTBALE = C:/winbuild/win_bison.exe
35
henrique55087a42014-06-17 12:36:39 +020036
37### Create a Visual Studio project
38
39 mkdir build_vs && cd build_vs
40 cmake -G "Visual Studio 12" ..
41
42Now open the folder build_vs using Visual Studio 2013.
43
44
45
46
Roger Meier746952e2014-06-14 21:59:24 +020047# Building the Thrift IDL compiler in Windows
48
henrique55087a42014-06-17 12:36:39 +020049If you don't want to use CMake you can use the already available Visual Studio
502010 solution.
Roger Meier746952e2014-06-14 21:59:24 +020051The Visual Studio project contains pre-build commands to generate the
52thriftl.cc, thrifty.cc and thrifty.hh files which are necessary to build
53the compiler. These depend on bison, flex and their dependencies to
54work properly. If this doesn't work on a system, try these manual
55pre-build steps.
56
57Open compiler.sln and remove the Pre-build commands under the project's
58 Properties -> Build Events -> Pre-Build Events.
59
60Download flex & bison from http://jaisantonyk.wordpress.com/2008/03/16/lex-and-yaccbison-in-windows/
61Download bison.simple in addition to bison.exe . This build of bison is easier to use
62than the one on sourceforge which has a myriad of dependencies.
63Place these binaries somewhere in the path.
64
65From a command prompt:
66> cd thrift/compiler/cpp
67> flex -osrc\thriftl.cc src\thriftl.ll
68In the generated thriftl.cc, comment out #include <unistd.h>
69
70Place a copy of bison.simple in thrift/compiler/cpp
71> bison -y -o "src/thrifty.cc" --defines src/thrifty.yy
72> move src\thrifty.cc.hh src\thrifty.hh
73
74Bison 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".
75
76> move src\windows\version.h.in src\windows\version.h
77
78Download inttypes.h from the interwebs and place it in an include path
79location (e.g. thrift/compiler/cpp/src).
80
81Build the compiler in Visual Studio.