THRIFT-2667 create Windows Installer via CPack
Signed-off-by: Roger Meier <roger@apache.org>
diff --git a/compiler/cpp/CMakeLists.txt b/compiler/cpp/CMakeLists.txt
index 152e5db..43c37cc 100644
--- a/compiler/cpp/CMakeLists.txt
+++ b/compiler/cpp/CMakeLists.txt
@@ -147,6 +147,30 @@
target_link_libraries(thrift libparse)
-if(NOT WIN32)
- install(TARGETS thrift DESTINATION bin)
+install(TARGETS thrift DESTINATION bin)
+
+# create a Distribution Package for the Apache Thrift Compiler
+set(CPACK_PACKAGE_NAME "Apache Thrift")
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Apache Thrift Compiler")
+set(CPACK_PACKAGE_VENDOR "Apache Software Foundation" )
+set(CPACK_PACKAGE_CONTACT "dev@thrift.apache.org")
+set(CPACK_PACKAGE_VERSION ${thrift_VERSION})
+set(CPACK_PACKAGE_VERSION_MAJOR ${thrift_VERSION_MAJOR} )
+set(CPACK_PACKAGE_VERSION_MINOR ${thrift_VERSION_MINOR} )
+set(CPACK_PACKAGE_VERSION_PATCH ${thrift_VERSION_PATCH} )
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../../LICENSE")
+
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ set(CPACK_GENERATOR "NSIS")
+ set(CPACK_NSIS_HELP_LINK "http://thrift.apache.org")
+ set(CPACK_NSIS_MENU_LINKS
+ "http://thrift.apache.org" "Apache Thrift - Web Site"
+ "https://issues.apache.org/jira/browse/THRIFT" "Apache Thrift - Issues")
+ set(CPACK_NSIS_CONTACT ${CPACK_PACKAGE_CONTACT})
+ set(CPACK_NSIS_MODIFY_PATH "ON")
+ set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
+else()
+ set(CPACK_GENERATOR "DEB" )
+ set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
endif()
+include(CPack)
diff --git a/compiler/cpp/README.md b/compiler/cpp/README.md
index 7e74b89..3c40809 100644
--- a/compiler/cpp/README.md
+++ b/compiler/cpp/README.md
@@ -23,7 +23,12 @@
cmake -DCMAKE_TOOLCHAIN_FILE=../../../contrib/mingw32-toolchain.cmake ..
make
+### Generate a Windows Installer Package of the Apache Thrift Compiler
+ cmake -DCMAKE_TOOLCHAIN_FILE=../../../contrib/mingw32-toolchain.cmake -DTHRIFT_COMPILER_HS=OFF ..
+ cpack
+
+Haskell uses C++ features not supported by mingw32 such as auto or nullptr, that's why we disable it.
## Build on windows
diff --git a/contrib/Vagrantfile b/contrib/Vagrantfile
index 5eec59f..c99719c 100644
--- a/contrib/Vagrantfile
+++ b/contrib/Vagrantfile
@@ -78,7 +78,7 @@
# CSharp
sudo apt-get install -qq mono-gmcs mono-devel libmono-system-web2.0-cil
-sudo apt-get install -qq mingw32 mingw32-binutils mingw32-runtime
+sudo apt-get install -qq mingw32 mingw32-binutils mingw32-runtime nsis
# Customize the system
# ---
diff --git a/contrib/installDependencies.sh b/contrib/installDependencies.sh
index 343ea7e..d52c0fa 100755
--- a/contrib/installDependencies.sh
+++ b/contrib/installDependencies.sh
@@ -66,4 +66,4 @@
# CSharp
sudo apt-get install -qq mono-gmcs mono-devel libmono-system-web2.0-cil
-sudo apt-get install -qq mingw32 mingw32-binutils mingw32-runtime
+sudo apt-get install -qq mingw32 mingw32-binutils mingw32-runtime nsis
diff --git a/doc/install/debian.md b/doc/install/debian.md
index 6b8b3d3..a05afcc 100644
--- a/doc/install/debian.md
+++ b/doc/install/debian.md
@@ -30,7 +30,7 @@
* Haskell
* ghc6 cabal-install libghc6-binary-dev libghc6-network-dev libghc6-http-dev
* Thrift Compiler for Windows
- * mingw32 mingw32-binutils mingw32-runtime
+ * mingw32 mingw32-binutils mingw32-runtime nsis
## Additional reading