From d98c0d990a39318fdc27425432cbf46ec552f119 Mon Sep 17 00:00:00 2001 From: lhzw Date: Sat, 13 Feb 2016 21:42:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0CMakeLists=20x64=20linux?= =?UTF-8?q?=E5=88=86=E6=94=AF=EF=BC=8C=E8=BF=90=E8=A1=8Cbuild.sh=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E7=9B=B4=E6=8E=A5=E5=AE=8C=E6=88=90md,=20td=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E5=BA=93=E7=BC=96=E8=AF=91=EF=BC=8C=20=E5=BB=BA?= =?UTF-8?q?=E7=AB=8B=E8=BD=AF=E9=93=BE=E6=8E=A5=E8=87=B3test=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=EF=BC=8C=E6=96=B9=E4=BE=BF=E6=B5=8B=E8=AF=95=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vn.ctp/CMakeLists.txt | 27 ++++++++++++++++++++++----- vn.ctp/build.sh | 15 +++++++++++++++ 2 files changed, 37 insertions(+), 5 deletions(-) create mode 100755 vn.ctp/build.sh diff --git a/vn.ctp/CMakeLists.txt b/vn.ctp/CMakeLists.txt index 9392bbe1..ed2a498a 100644 --- a/vn.ctp/CMakeLists.txt +++ b/vn.ctp/CMakeLists.txt @@ -7,7 +7,7 @@ if (CMAKE_COMPILER_IS_GNUC OR CMAKE_COMPILER_IS_GNUCXX) endif () set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) -set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) +set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib) option(USE_64BITS "comiple 64bits" ON) if (USE_64BITS) @@ -16,7 +16,14 @@ if (USE_64BITS) #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") endif() -set(CTPAPI_PATH ctpapi) +if (WIN32) + set(CTPAPI_PATH ctpapi) +elseif (UNIX) + message("Under unix: " ${CMAKE_SIZEOF_VOID_P}) + if (CMAKE_SIZEOF_VOID_P MATCHES "8") + set(CTPAPI_PATH ctpapi/x64_linux) + endif() +endif() include_directories(${CTPAPI_PATH}) set(CTPAPI_LIBRARY ) find_library(CTPAPI_MD_LIBRARY @@ -47,17 +54,27 @@ if (BUILD_CTP_TD) endif() -set(PYTHON_INCLUDE_PATH C:/Python27/include) set(PYTHON_LIBRARY ) +if (WIN32) +set(PYTHON_INCLUDE_PATH C:/Python27/include) find_library(PYTHON_LIBRARY NAMES python27 PATHS C:/Python27/libs) include_directories(${PYTHON_INCLUDE_PATH}) +else() +set(PYTHON_INCLUDE_PATH /usr/include/python2.7/) +find_library(PYTHON_LIBRARY + NAMES python2.7 + PATHS /usr/lib/x86_64-linux-gnu) +include_directories(${PYTHON_INCLUDE_PATH}) +endif() # 链接boost库,anaconda -set(Boost_USE_STATIC_LIBS ON) #链接boost静态库 +if (WIN32) + set(Boost_USE_STATIC_LIBS ON) #链接boost静态库 +endif() set(Boost_USE_MULTITHREADED ON) -find_package(Boost 1.57.0 COMPONENTS python thread date_time system chrono REQUIRED) # 如果boost库没有完全编译,需要将编译的库明确地指出,否者message(${Boost_LIBRARIES})会出错 +find_package(Boost 1.55.0 COMPONENTS python thread date_time system chrono REQUIRED) # 如果boost库没有完全编译,需要将编译的库明确地指出,否者message(${Boost_LIBRARIES})会出错 if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) endif() diff --git a/vn.ctp/build.sh b/vn.ctp/build.sh new file mode 100755 index 00000000..15332fb6 --- /dev/null +++ b/vn.ctp/build.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Written by Suzhengchun on 20160213 + +set -e +BUILDDIR=build +rm -rf $BUILDDIR +if [ ! -f $BUILDDIR ]; then + mkdir -p $BUILDDIR +fi +pushd $BUILDDIR +cmake .. +make VERBOSE=1 -j 2 +ln -fs `pwd`/lib/libvnctpmd.so ../vnctpmd/test +ln -fs `pwd`/lib/libvnctptd.so ../vnctptd/test +popd