diff --git a/.gitignore b/.gitignore index a859a730..6698ba31 100644 --- a/.gitignore +++ b/.gitignore @@ -38,5 +38,11 @@ Release/ *.dump *.vssettings +<<<<<<< HEAD # 不想同步的 -*.local \ No newline at end of file +*.local +======= +vn.ctp/build/* +vn.lts/build/* +.idea +>>>>>>> 65aac25731772259bf2d4049e7adbe92750ea01d diff --git a/vn.ctp/CMakeLists.txt b/vn.ctp/CMakeLists.txt new file mode 100644 index 00000000..9392bbe1 --- /dev/null +++ b/vn.ctp/CMakeLists.txt @@ -0,0 +1,74 @@ +cmake_minimum_required(VERSION 2.8) +project(vn_ctp_api) + +set(CMAKE_BUILD_TYPE "Release") +if (CMAKE_COMPILER_IS_GNUC OR CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++11") +endif () + +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) +set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) + +option(USE_64BITS "comiple 64bits" ON) +if (USE_64BITS) + add_definitions(-DUSE_64BITS) + #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") + #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") +endif() + +set(CTPAPI_PATH ctpapi) +include_directories(${CTPAPI_PATH}) +set(CTPAPI_LIBRARY ) +find_library(CTPAPI_MD_LIBRARY + NAMES thostmduserapi + PATHS ${CTPAPI_PATH}) +find_library(CTPAPI_TD_LIBRARY + NAMES thosttraderapi + PATHS ${CTPAPI_PATH}) + +set (vnctpmd ) +set (vnctptd ) + +option(BUILD_CTP_MD "build ctp md" ON) +if (BUILD_CTP_MD) + add_definitions(-DBUILD_CTP_MD) + set(CTP_MD_PATH vnctpmd/vnctpmd) + include_directories(CTP_MD_PATH) + set(VN_CTP_MD_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/vnctpmd/vnctpmd/vnctpmd.cpp) + add_library(vnctpmd SHARED ${VN_CTP_MD_SOURCE}) +endif() +option(BUILD_CTP_TD "build ctp td" ON) +if (BUILD_CTP_TD) + add_definitions(-DBUILD_CTP_MD) + set(CTP_TD_PATH vnctptd/vnctptd) + include_directories(CTP_TD_PATH) + set(VN_CTP_TD_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/vnctptd/vnctptd/vnctptd.cpp) + add_library(vnctptd SHARED ${VN_CTP_TD_SOURCE}) +endif() + + +set(PYTHON_INCLUDE_PATH C:/Python27/include) +set(PYTHON_LIBRARY ) +find_library(PYTHON_LIBRARY + NAMES python27 + PATHS C:/Python27/libs) +include_directories(${PYTHON_INCLUDE_PATH}) + +# 链接boost库,anaconda +set(Boost_USE_STATIC_LIBS ON) #链接boost静态库 +set(Boost_USE_MULTITHREADED ON) +find_package(Boost 1.57.0 COMPONENTS python thread date_time system chrono REQUIRED) # 如果boost库没有完全编译,需要将编译的库明确地指出,否者message(${Boost_LIBRARIES})会出错 +if(Boost_FOUND) + include_directories(${Boost_INCLUDE_DIRS}) +endif() + +target_link_libraries(vnctpmd ${Boost_LIBRARIES} ${PYTHON_LIBRARY} ${CTPAPI_MD_LIBRARY}) +set(MD_DLL "${LIBRARY_OUTPUT_PATH}/Release/vnctpmd.dll") +if (EXISTS ${MD_DLL}) + file(RENAME ${MD_DLL} ${LIBRARY_OUTPUT_PATH}/Release/vnctpmd.pyd) +endif() +target_link_libraries(vnctptd ${Boost_LIBRARIES} ${PYTHON_LIBRARY} ${CTPAPI_TD_LIBRARY}) +set(TD_DLL ${LIBRARY_OUTPUT_PATH}/Release/vnctptd.dll) +if (EXISTS ${TD_DLL}) + file(RENAME ${TD_DLL} ${LIBRARY_OUTPUT_PATH}/Release/vnctptd.pyd) +endif() diff --git a/vn.ctp/readme.md b/vn.ctp/readme.md new file mode 100644 index 00000000..6ad7996d --- /dev/null +++ b/vn.ctp/readme.md @@ -0,0 +1,30 @@ +# Ŀ¼DZCTP +--------------------- + +# Ŀ¼˵ +------------ +## vnctpmd: API + +# +---------- + +* 鰲װλϱһ£ȫװ32λͬʱ32λ +* cmake:װ°汾cmake,ñ뻷 +* [Boost1.57.0](http://sourceforge.net/projects/boost/files/boost/1.57.0/)⣺ķԲο[Boost Getting Started](http://www.boost.org/doc/libs/1_58_0/more/getting_started/)½ǵ +** ûeg: BOOST_ROOT = C:\boost_1_57_0 +** 32λ⻹64λѡ +** Ҫboost python, thread, system, chrono, date_time5⣺ȫ˷ѴʱӲ̿ռ䡣 +** boost pythonĶ̬64bitsܱ벻ɹѡaddress-model=64߱뾲̬ + +* [Anaconda1.9.2](http://repo.continuum.io/archive/index.html): ذPythonа +* 빤ߣwindowsѡvisual studio 2013linuxʹg++ + +# +------------- + +* vn.ctpĿ¼½ļУΪbuild, ʱļļ +* й룺cmake-gui .. cmakeý +* configure +* generateûдóɹ +* buildĿ¼˫vn_ctp_api.sln򿪽 +* 밴ť,release