GitHub user jeking3 opened a pull request:
https://github.com/apache/thrift/pull/456
THRIFT-2850 cmake win cpp library and unit tests
I made changes to the cmake environment so that cmake can build the
compiler, static libraries and unit tests on Windows. In my testing I found
that the shared thrift library build is not exporting any symbols so no IMPLIB
is being generated (that would be thrift.lib or thriftd.lib), so none of the
unit tests would link, nor would thriftz.
Here's the command I used to generate the environment:
mkdir thrift-build
cd thrift-build
"C:\Program Files (x86)\CMake\bin\cmake.exe" ..\thrift -G"NMake Makefiles"
-DWITH_SHARED_LIB=OFF -DWITH_BOOSTTHREADS=ON -DBOOST_ROOT=C:\Boost
-DZLIB_ROOT=C:\win3p\tools\x64\zlib-1.2.5
-DOPENSSL_ROOT_DIR=C:\win3p\tools\x64\openssl-1.0.1b
-DFLEX_EXECUTABLE=C:\Users\Jim\workspace\winflexbison\win_flex.exe
-DBISON_EXECUTABLE=C:\Users\Jim\workspace\winflexbison\win_bison.exe
You can also use -G"Visual Studio 10 Win64" to get a thrift.sln file that
you can use to load visual studio, this example is for Visual Studio 2010.
Visual Studio 2013 would be -G"Visual Studio 12 Win64".
I was not able to get the nonblocking server to build because libevent
requires autoconf to generate a "event-config.h", and the libevent nmake
project does not produce one of these, so I could not compile the non-blocking
server; further the libevent header "event.h" conflicts with the Windows
Platform SDK header Event.h, so FindLibevent.cmake always finds the Platform
SDK as an include directory, so I did not attempt to get it working right now.
Tested this on Windows and on Ubuntu 12.04 using CMake-3.2.2.
When running the tests on Windows you need to put the library paths into
your PATH environment for boost, openssl so that they can be found. The CMake
environment does not copy required libraries into the "bin" directory at this
time.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jeking3/thrift
feature/cmake-win-cpp-library-build
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/456.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #456
----
commit 4f27ece54ef90358ea2efe529786196c92d1a493
Author: Jim King <[email protected]>
Date: 2015-04-21T15:39:08Z
cmake changes for windows to build through unit tests, WITH_STATIC_LIBS
only, and resolve some compiler warnings
commit 63f9fd1ed4dd18cf531f0015750cca1773603583
Author: Jim King <[email protected]>
Date: 2015-04-21T16:00:02Z
fix cmake changes from windows on linux
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---