thrift/compiler/cpp
Roger Meier 63fcb7e756 THRIFT-2520 cpp:cob_style generates incorrect .tcc file
This closes #118

commit 22d266eefaf16f21ffd0ad193a6a54403de65197
Author: N.Sukegawa <nsukeg@gmail.com>
Date: 2014-05-07T19:36:43Z
2014-06-15 21:51:32 +02:00
..
src THRIFT-2520 cpp:cob_style generates incorrect .tcc file 2014-06-15 21:51:32 +02:00
CMakeLists.txt Allow cross build for windows using mingw32 2014-06-10 13:44:02 +02:00
compiler.sln THRIFT-1031 Patch to compile Thrift for vc++ 9.0 and 10.0 2011-09-23 14:25:22 +00:00
compiler.vcxproj THRIFT-1614: handle automake >= 1.12 yacc output name (thrifty.hh) 2013-03-07 11:24:51 -05:00
compiler.vcxproj.filters THRIFT-1614: handle automake >= 1.12 yacc output name (thrifty.hh) 2013-03-07 11:24:51 -05:00
Makefile.am THRIFT-2421: Tree/Recursive struct support in thrift 2014-04-08 22:45:01 -04:00
README.md compiler: move README_Windows.md content to README.md 2014-06-14 21:59:24 +02:00
version.h.in THRIFT-770. build: Get 'make dist' to work without first compiling source code 2010-05-03 21:33:00 +00:00

Build compiler using CMake

Use the following steps to build using cmake

mkdir build
cd build
cmake ..
make

Build on windows

In order to build on windows a few additional steps are necessary

  1. Download winflexbison from http://sourceforge.net/projects/winflexbison/
  2. Extract the winflex bison files to for e.g. C:\winflexbison
  3. Make the CMake variables point to the correct binaries.
  • FLEX_EXECUTBALE = C:/winbuild/win_flex.exe
  • BISON_EXECUTBALE = C:/winbuild/win_bison.exe

Building the Thrift IDL compiler in Windows

The Visual Studio project contains pre-build commands to generate the thriftl.cc, thrifty.cc and thrifty.hh files which are necessary to build the compiler. These depend on bison, flex and their dependencies to work properly. If this doesn't work on a system, try these manual pre-build steps.

Open compiler.sln and remove the Pre-build commands under the project's Properties -> Build Events -> Pre-Build Events.

Download flex & bison from http://jaisantonyk.wordpress.com/2008/03/16/lex-and-yaccbison-in-windows/ Download bison.simple in addition to bison.exe . This build of bison is easier to use than the one on sourceforge which has a myriad of dependencies. Place these binaries somewhere in the path.

From a command prompt:

cd thrift/compiler/cpp flex -osrc\thriftl.cc src\thriftl.ll In the generated thriftl.cc, comment out #include <unistd.h>

Place a copy of bison.simple in thrift/compiler/cpp

bison -y -o "src/thrifty.cc" --defines src/thrifty.yy move src\thrifty.cc.hh src\thrifty.hh

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".

move src\windows\version.h.in src\windows\version.h

Download inttypes.h from the interwebs and place it in an include path location (e.g. thrift/compiler/cpp/src).

Build the compiler in Visual Studio.