THRIFT-4732: windows cmake refinements and add windows docker build support
diff --git a/compiler/cpp/CMakeLists.txt b/compiler/cpp/CMakeLists.txt
index 0df790e..96efe65 100644
--- a/compiler/cpp/CMakeLists.txt
+++ b/compiler/cpp/CMakeLists.txt
@@ -16,18 +16,11 @@
# specific language governing permissions and limitations
# under the License.
#
-cmake_minimum_required(VERSION 2.8.12)
+
+cmake_minimum_required(VERSION 3.3)
+project("thrift-compiler" VERSION ${PACKAGE_VERSION})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/thrift/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/thrift/version.h)
-if(MSVC)
- # The winflexbison generator outputs some macros that conflict with the Visual Studio 2010 copy of stdint.h
- # This might be fixed in later versions of Visual Studio, but an easy solution is to include stdint.h first
- if(HAVE_STDINT_H)
- add_definitions(-D__STDC_FORMAT_MACROS)
- add_definitions(-D__STDC_LIMIT_MACROS)
- add_definitions(/FI"stdint.h")
- endif(HAVE_STDINT_H)
-endif()
find_package(FLEX REQUIRED)
find_package(BISON REQUIRED)
@@ -78,36 +71,37 @@
endmacro()
# The following compiler can be enabled or disabled
-THRIFT_ADD_COMPILER(c_glib "Enable compiler for C with Glib" ON)
-THRIFT_ADD_COMPILER(cpp "Enable compiler for C++" ON)
-THRIFT_ADD_COMPILER(java "Enable compiler for Java" ON)
THRIFT_ADD_COMPILER(as3 "Enable compiler for ActionScript 3" ON)
-THRIFT_ADD_COMPILER(dart "Enable compiler for Dart" ON)
-THRIFT_ADD_COMPILER(haxe "Enable compiler for Haxe" ON)
-THRIFT_ADD_COMPILER(csharp "Enable compiler for C#" ON)
-THRIFT_ADD_COMPILER(netcore "Enable compiler for .NET Core" ON)
-THRIFT_ADD_COMPILER(py "Enable compiler for Python 2.0" ON)
-THRIFT_ADD_COMPILER(rb "Enable compiler for Ruby" ON)
-THRIFT_ADD_COMPILER(perl "Enable compiler for Perl" ON)
-THRIFT_ADD_COMPILER(php "Enable compiler for PHP" ON)
-THRIFT_ADD_COMPILER(erl "Enable compiler for Erlang" ON)
+THRIFT_ADD_COMPILER(c_glib "Enable compiler for C with Glib" ON)
+THRIFT_ADD_COMPILER(cl "Enable compiler for Common LISP" ON)
THRIFT_ADD_COMPILER(cocoa "Enable compiler for Cocoa Objective-C" ON)
-THRIFT_ADD_COMPILER(swift "Enable compiler for Cocoa Swift" ON)
-THRIFT_ADD_COMPILER(st "Enable compiler for Smalltalk" ON)
-THRIFT_ADD_COMPILER(ocaml "Enable compiler for OCaml" ON)
+THRIFT_ADD_COMPILER(cpp "Enable compiler for C++" ON)
+THRIFT_ADD_COMPILER(csharp "Enable compiler for C#" ON)
+THRIFT_ADD_COMPILER(d "Enable compiler for D" ON)
+THRIFT_ADD_COMPILER(dart "Enable compiler for Dart" ON)
+THRIFT_ADD_COMPILER(delphi "Enable compiler for Delphi" ON)
+THRIFT_ADD_COMPILER(erl "Enable compiler for Erlang" ON)
+THRIFT_ADD_COMPILER(go "Enable compiler for Go" ON)
+THRIFT_ADD_COMPILER(gv "Enable compiler for GraphViz" ON)
+THRIFT_ADD_COMPILER(haxe "Enable compiler for Haxe" ON)
THRIFT_ADD_COMPILER(hs "Enable compiler for Haskell" ON)
-THRIFT_ADD_COMPILER(xsd "Enable compiler for XSD" ON)
THRIFT_ADD_COMPILER(html "Enable compiler for HTML Documentation" ON)
+THRIFT_ADD_COMPILER(java "Enable compiler for Java" ON)
+THRIFT_ADD_COMPILER(javame "Enable compiler for Java ME" ON)
THRIFT_ADD_COMPILER(js "Enable compiler for JavaScript" ON)
THRIFT_ADD_COMPILER(json "Enable compiler for JSON" ON)
-THRIFT_ADD_COMPILER(javame "Enable compiler for Java ME" ON)
-THRIFT_ADD_COMPILER(delphi "Enable compiler for Delphi" ON)
-THRIFT_ADD_COMPILER(go "Enable compiler for Go" ON)
-THRIFT_ADD_COMPILER(d "Enable compiler for D" ON)
THRIFT_ADD_COMPILER(lua "Enable compiler for Lua" ON)
-THRIFT_ADD_COMPILER(gv "Enable compiler for GraphViz" ON)
+THRIFT_ADD_COMPILER(netcore "Enable compiler for .NET Core" ON)
+THRIFT_ADD_COMPILER(ocaml "Enable compiler for OCaml" ON)
+THRIFT_ADD_COMPILER(perl "Enable compiler for Perl" ON)
+THRIFT_ADD_COMPILER(php "Enable compiler for PHP" ON)
+THRIFT_ADD_COMPILER(py "Enable compiler for Python 2.0" ON)
+THRIFT_ADD_COMPILER(rb "Enable compiler for Ruby" ON)
THRIFT_ADD_COMPILER(rs "Enable compiler for Rust" ON)
+THRIFT_ADD_COMPILER(st "Enable compiler for Smalltalk" ON)
+THRIFT_ADD_COMPILER(swift "Enable compiler for Cocoa Swift" ON)
THRIFT_ADD_COMPILER(xml "Enable compiler for XML" ON)
+THRIFT_ADD_COMPILER(xsd "Enable compiler for XSD" ON)
# Thrift is looking for include files in the src directory
# we also add the current binary directory for generated files
diff --git a/compiler/cpp/test/CMakeLists.txt b/compiler/cpp/test/CMakeLists.txt
index 572b558..373cb78 100644
--- a/compiler/cpp/test/CMakeLists.txt
+++ b/compiler/cpp/test/CMakeLists.txt
@@ -31,18 +31,10 @@
plugin/conversion_test.cc
)
add_executable(plugintest ${plugintest_SOURCES})
- if(WITH_SHARED_LIB AND NOT MSVC)
- target_link_libraries(plugintest
- thriftc
- ${Boost_LIBRARIES}
- )
- else()
- target_link_libraries(plugintest
- thriftc_static
- thrift_static
- ${Boost_LIBRARIES}
- )
- endif()
+ target_link_libraries(plugintest
+ thriftc
+ ${Boost_LIBRARIES}
+ )
add_test(NAME PluginUnitTest COMMAND plugintest)
set(thrift-gen-mycpp_SOURCES
@@ -50,11 +42,7 @@
plugin/cpp_plugin.cc
)
add_executable(thrift-gen-mycpp ${thrift-gen-mycpp_SOURCES})
- if(WITH_SHARED_LIB AND NOT MSVC)
- target_link_libraries(thrift-gen-mycpp thriftc)
- else()
- target_link_libraries(thrift-gen-mycpp thriftc_static thrift_static)
- endif()
+ target_link_libraries(thrift-gen-mycpp thriftc)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(BUILDTYPE "Debug")
@@ -91,5 +79,9 @@
endforeach()
-find_package(PythonInterp REQUIRED)
-add_test(NAME StalenessCheckTest COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/compiler/staleness_check.py ${THRIFT_COMPILER})
+find_package(PythonInterp QUIET)
+if(PYTHONINTERP_FOUND)
+ add_test(NAME StalenessCheckTest COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/compiler/staleness_check.py ${THRIFT_COMPILER})
+else()
+ message(WARNING "Skipping StalenessCheckTest as there is no python interpreter available.")
+endif()
\ No newline at end of file