THRIFT-2835 Add possibility to distribute generators separately from thrift core, and load them dynamically
Client: Compiler
Patch: Nobuaki Sukegawa, rebased by dtmuller
Also fixed by dtmuller:
* Add plugin namespace for erlang language binding
* Fix unit test test_const_value
* Don't clear type cache with every t_program conversion
* Type "wb" may not be supported by popen on non-Windows platforms
* Fix constness of AST type signatures
diff --git a/lib/cpp/CMakeLists.txt b/lib/cpp/CMakeLists.txt
index 33cefcb..d07b400 100755
--- a/lib/cpp/CMakeLists.txt
+++ b/lib/cpp/CMakeLists.txt
@@ -17,13 +17,6 @@
# under the License.
#
-# Find required packages
-if(WITH_BOOSTTHREADS)
- find_package(Boost 1.53.0 REQUIRED COMPONENTS system thread)
-else()
- find_package(Boost 1.53.0 REQUIRED)
-endif()
-
include_directories(SYSTEM "${Boost_INCLUDE_DIRS}")
include_directories(src)
diff --git a/lib/cpp/Makefile.am b/lib/cpp/Makefile.am
index 6fd15d2..2a1cca8 100755
--- a/lib/cpp/Makefile.am
+++ b/lib/cpp/Makefile.am
@@ -28,8 +28,12 @@
SUBDIRS = .
if WITH_TESTS
+# This file is needed by compiler with plugin, while test/Makefile.am needs compiler
+# So test directory is directly picked by top level Makefile.am for plugin build
+if !WITH_PLUGIN
SUBDIRS += test
endif
+endif
pkgconfigdir = $(libdir)/pkgconfig
diff --git a/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp b/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
index c46cc14..d3ec722 100644
--- a/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
+++ b/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
@@ -524,7 +524,7 @@
std::string doubleToString(double d) {
std::ostringstream str;
str.imbue(std::locale::classic());
- const double max_digits10 = 2 + std::numeric_limits<double>::digits10;
+ const int max_digits10 = 2 + std::numeric_limits<double>::digits10;
str.precision(max_digits10);
str << d;
return str.str();
diff --git a/lib/cpp/src/thrift/protocol/TProtocol.h b/lib/cpp/src/thrift/protocol/TProtocol.h
index 1b46faf..448c4fe 100644
--- a/lib/cpp/src/thrift/protocol/TProtocol.h
+++ b/lib/cpp/src/thrift/protocol/TProtocol.h
@@ -20,6 +20,11 @@
#ifndef _THRIFT_PROTOCOL_TPROTOCOL_H_
#define _THRIFT_PROTOCOL_TPROTOCOL_H_ 1
+#ifdef _WIN32
+// Need to come before any Windows.h includes
+#include <Winsock2.h>
+#endif
+
#include <thrift/transport/TTransport.h>
#include <thrift/protocol/TProtocolException.h>
diff --git a/lib/cpp/src/thrift/windows/GetTimeOfDay.cpp b/lib/cpp/src/thrift/windows/GetTimeOfDay.cpp
index fba077c..820828f 100644
--- a/lib/cpp/src/thrift/windows/GetTimeOfDay.cpp
+++ b/lib/cpp/src/thrift/windows/GetTimeOfDay.cpp
@@ -21,8 +21,6 @@
#include <thrift/thrift-config.h>
// win32
-#include <time.h>
-
#if defined(__MINGW32__)
#include <sys/time.h>
#endif
diff --git a/lib/cpp/src/thrift/windows/GetTimeOfDay.h b/lib/cpp/src/thrift/windows/GetTimeOfDay.h
index 6e90ba1..762ac5e 100644
--- a/lib/cpp/src/thrift/windows/GetTimeOfDay.h
+++ b/lib/cpp/src/thrift/windows/GetTimeOfDay.h
@@ -29,6 +29,7 @@
#endif
#include <thrift/thrift-config.h>
+#include <time.h>
struct thrift_timespec {
int64_t tv_sec;
diff --git a/lib/cpp/src/thrift/windows/config.h b/lib/cpp/src/thrift/windows/config.h
index 108e05b..8650103 100644
--- a/lib/cpp/src/thrift/windows/config.h
+++ b/lib/cpp/src/thrift/windows/config.h
@@ -30,6 +30,7 @@
// use std::thread in MSVC11 (2012) or newer
#if _MSC_VER >= 1700
+#define HAVE_STDINT_H 1
#define USE_STD_THREAD 1
// otherwise use boost threads
#else
diff --git a/lib/cpp/test/CMakeLists.txt b/lib/cpp/test/CMakeLists.txt
index 7c7e320..cbeff08 100644
--- a/lib/cpp/test/CMakeLists.txt
+++ b/lib/cpp/test/CMakeLists.txt
@@ -17,15 +17,8 @@
# under the License.
#
-# Find required packages
-set(Boost_USE_STATIC_LIBS ON) # Force the use of static boost test framework
-find_package(Boost 1.53.0 REQUIRED COMPONENTS chrono filesystem system thread unit_test_framework)
include_directories(SYSTEM "${Boost_INCLUDE_DIRS}")
-if (WITH_DYN_LINK_TEST)
- add_definitions( -DBOOST_TEST_DYN_LINK )
-endif()
-
#Make sure gen-cpp files can be included
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
diff --git a/lib/cpp/test/Makefile.am b/lib/cpp/test/Makefile.am
index 4e76ce8..6f46117 100755
--- a/lib/cpp/test/Makefile.am
+++ b/lib/cpp/test/Makefile.am
@@ -358,7 +358,7 @@
gen-cpp/ChildService.cpp gen-cpp/ChildService.h gen-cpp/ParentService.cpp gen-cpp/ParentService.h gen-cpp/proc_types.cpp gen-cpp/proc_types.h: processor/proc.thrift
$(THRIFT) --gen cpp:templates,cob_style $<
-AM_CPPFLAGS = $(BOOST_CPPFLAGS) -I$(top_srcdir)/lib/cpp/src -D__STDC_LIMIT_MACROS
+AM_CPPFLAGS = $(BOOST_CPPFLAGS) -I$(top_srcdir)/lib/cpp/src -D__STDC_LIMIT_MACROS -I.
AM_LDFLAGS = $(BOOST_LDFLAGS)
AM_CXXFLAGS = -Wall -Wextra -pedantic