You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2015/05/15 15:44:41 UTC
[2/2] thrift git commit: THRIFT-2850 CMake: improve Windows support
THRIFT-2850 CMake: improve Windows support
use YY_NO_UNISTD_H and remove --wincompat
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/86fded21
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/86fded21
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/86fded21
Branch: refs/heads/master
Commit: 86fded21b55573bb9240552a284f1f3d7255bd32
Parents: 516e28a
Author: Roger Meier <ro...@apache.org>
Authored: Fri May 15 12:01:38 2015 +0200
Committer: Roger Meier <ro...@apache.org>
Committed: Fri May 15 15:44:22 2015 +0200
----------------------------------------------------------------------
build/cmake/DefinePlatformSpecifc.cmake | 2 +-
compiler/cpp/CMakeLists.txt | 4 +---
compiler/cpp/README.md | 27 +++++++++++++++------------
compiler/cpp/src/thriftl.ll | 2 ++
4 files changed, 19 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/86fded21/build/cmake/DefinePlatformSpecifc.cmake
----------------------------------------------------------------------
diff --git a/build/cmake/DefinePlatformSpecifc.cmake b/build/cmake/DefinePlatformSpecifc.cmake
index 515bb18..db411d5 100644
--- a/build/cmake/DefinePlatformSpecifc.cmake
+++ b/build/cmake/DefinePlatformSpecifc.cmake
@@ -65,7 +65,7 @@ if(MSVC)
# Windows build does not know how to make a shared library yet
# as there are no __declspec(dllexport) or exports files in the project.
if (WITH_SHARED_LIB)
- message (FATAL_ERROR "Windows build does not support shared library output yet!")
+ message (FATAL_ERROR "Windows build does not support shared library output yet, please set -DWITH_SHARED_LIB=off")
endif()
elseif(UNIX)
http://git-wip-us.apache.org/repos/asf/thrift/blob/86fded21/compiler/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/compiler/cpp/CMakeLists.txt b/compiler/cpp/CMakeLists.txt
index 5642d16..01e229d 100644
--- a/compiler/cpp/CMakeLists.txt
+++ b/compiler/cpp/CMakeLists.txt
@@ -19,10 +19,8 @@
# Windows has a different header
if(MSVC)
- set(FLEX_FLAGS "--wincompat") # Don't use unistd.h on windows
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/windows/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
else()
- set(FLEX_FLAGS " ")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
endif()
@@ -31,7 +29,7 @@ find_package(BISON REQUIRED)
# Create flex and bison files and build the lib parse static library
BISON_TARGET(thrifty ${CMAKE_CURRENT_SOURCE_DIR}/src/thrifty.yy ${CMAKE_CURRENT_BINARY_DIR}/thrifty.cc)
-FLEX_TARGET(thriftl ${CMAKE_CURRENT_SOURCE_DIR}/src/thriftl.ll ${CMAKE_CURRENT_BINARY_DIR}/thriftl.cc COMPILE_FLAGS ${FLEX_FLAGS})
+FLEX_TARGET(thriftl ${CMAKE_CURRENT_SOURCE_DIR}/src/thriftl.ll ${CMAKE_CURRENT_BINARY_DIR}/thriftl.cc)
ADD_FLEX_BISON_DEPENDENCY(thriftl thrifty)
# HACK: Work around the fact that bison crates a .hh file but we need a .h file
http://git-wip-us.apache.org/repos/asf/thrift/blob/86fded21/compiler/cpp/README.md
----------------------------------------------------------------------
diff --git a/compiler/cpp/README.md b/compiler/cpp/README.md
index fdc6451..b4a159f 100644
--- a/compiler/cpp/README.md
+++ b/compiler/cpp/README.md
@@ -25,24 +25,27 @@ Now open the folder build_ec using eclipse.
## Build on windows
-In order to build on windows a few additional steps are necessary:
+### using Git Bash
+Git Bash provides flex and bison, so you just need to do this:
+
+ mkdir build_vs && cd build_vs
+ cmake -DWITH_SHARED_LIB=off ..
+
+### using Win flex-bison
+
+In order to build on windows with winflexbison 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_EXECUTABLE = C:/winbuild/win_flex.exe
* BISON_EXECUTABLE = C:/winbuild/win_bison.exe
-
-
-### Create a Visual Studio project
-
- mkdir build_vs && cd build_vs
- cmake -G "Visual Studio 12" ..
-
-Now open the folder build_vs using Visual Studio 2013.
-
-
-
+4. Generate a Visual Studio project:
+```
+mkdir build_vs && cd build_vs
+cmake -G "Visual Studio 12" -DWITH_SHARED_LIB=off ..
+```
+5. Now open the folder build_vs using Visual Studio 2013.
# Building the Thrift IDL compiler in Windows
http://git-wip-us.apache.org/repos/asf/thrift/blob/86fded21/compiler/cpp/src/thriftl.ll
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thriftl.ll b/compiler/cpp/src/thriftl.ll
index a8ffe57..11ba1b9 100644
--- a/compiler/cpp/src/thriftl.ll
+++ b/compiler/cpp/src/thriftl.ll
@@ -43,6 +43,8 @@
#pragma warning(disable:4102)
//avoid isatty redefinition
#define YY_NEVER_INTERACTIVE 1
+
+#define YY_NO_UNISTD_H 1
#endif
#include <cassert>