[
https://issues.apache.org/jira/browse/THRIFT-2571?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14501483#comment-14501483
]
James E. King, III commented on THRIFT-2571:
--------------------------------------------
I'm on the development tip. I'm using this to start up the environment (using
MSVC10 and Boost 1.58 built for 64-bit only, all variants):
{quote}
"C:\Program Files (x86)\CMake\bin\cmake.exe" ..\thrift -G"NMake Makefiles"
-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
-DLIBEVENT_ROOT=C:\Users\Jim\workspace\libevent
{quote}
I found I had to add the following to build/cmake/DefinePlatformSpecific.cmake
in the MSVC section:
{noformat}
# Disable boost auto linking pragmas - cmake includes the right files
add_definitions("-DBOOST_ALL_NO_LIB")
{noformat}
Without doing that, the build for thriftd.dll would fail:
{noformat}
Linking CXX shared library ..\..\bin\thriftd.dll
LINK : fatal error LNK1104: cannot open file
'libboost_thread-vc100-mt-gd-1_58.lib'
{noformat}
With that fix, I ran into an issue where libevent defines a header called
"event.h", and so does the Windows Platform SDK. The windows one gets used
instead of the libevent one, so it fails when compiling the non-blocking
server. I had to make a copy of libevent\include\event2\event.h and put it
into libevent\include, since it looks like the libevent\include folder is the
one that one wants on the include path. I also had to change
FindLibevent.cmake as follows:
{noformat}
set(LibEvent_EXTRA_PREFIXES /usr/local /opt/local "$ENV{HOME}"
"${LIBEVENT_ROOT}")
foreach(prefix ${LibEvent_EXTRA_PREFIXES})
list(APPEND LibEvent_INCLUDE_PATHS "${prefix}/include")
list(APPEND LibEvent_LIBRARIES_PATHS "${prefix}")
list(APPEND LibEvent_LIBRARIES_PATHS "${prefix}/lib")
endforeach()
{noformat}
I added LIBEVENT_ROOT and I added the non-"/lib" LibEvent_LIBRARIES search path.
Unfortunately I still cannot build the nonblocking server because "event.h" is
loading the Platform SDK one. But I am more than half way built!
> Simplify cross compilation using CMake
> --------------------------------------
>
> Key: THRIFT-2571
> URL: https://issues.apache.org/jira/browse/THRIFT-2571
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (General)
> Affects Versions: 1.0
> Reporter: Pascal Bach
> Assignee: Henrique Mendonça
> Priority: Minor
> Fix For: 0.9.2
>
>
> Using CMake would simplify cross compilation.
> The for example the same build script can be used to build:
> - Native for Linux using GCC
> - Native for Windows using Visual Studio
> - Cross compile for ARM on Linux
> - Cross compile for Windows form Linux using mingw32
> It also makes it easy to generate project files for Eclipse or Visual Studio.
> h2. Some examples:
> {code:title=Create an eclipse project|borderStyle=solid}
> mkdir build_ec && cd build_ec
> cmake -G "Eclipse CDT4 - Unix Makefiles" ../compiler/cpp
> make
> {code}
> Now open the folder build_ec using eclipse.
> {code:title=Create a Visual Studio project (Windows only)|borderStyle=solid}
> mkdir build_vs && cd build_vs
> cmake -G "Visual Studio 12" ../compiler/cpp
> {code}
> Now open the folder build_vs using Visual Studio.
> {code:title=Cross compile using mingw32|borderStyle=solid}
> mkdir build_mingw32 && cd build_mingw32
> cmake -DCMAKE_TOOLCHAIN_FILE=../contrib/mingw32-toolchain.cmake
> ../compiler/cpp
> make
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)