-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathCMakeLists.txt
100 lines (85 loc) · 3 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
cmake_minimum_required(VERSION 2.8)
project(ctp-swig)
set(BUILD_SHARED_LIBS true)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_VERBOSE_MAKEFILE true)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
if(WIN32)
set(CMAKE_INSTALL_PREFIX $ENV{HOMEPATH})
else()
set(CMAKE_INSTALL_PREFIX $ENV{HOME})
endif()
if(WIN32)
set(CTP_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/ctp/api/trade/win/public)
set(CTP_LIBRARY_DIRS ${PROJECT_SOURCE_DIR}/ctp/api/trade/win/lib ${PROJECT_SOURCE_DIR}/ctp/api/risk/lib)
elseif(UNIX)
set(CTP_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/ctp/api/trade/linux64/public)
set(CTP_LIBRARY_DIRS ${PROJECT_SOURCE_DIR}/ctp/api/trade/linux64/lib)
endif()
if(WIN32)
find_library(CTP_MDUSER_LIBRARY NAMES thostmduserapi PATHS ${CTP_LIBRARY_DIRS})
find_library(CTP_TRADE_LIBRARY NAMES thosttraderapi PATHS ${CTP_LIBRARY_DIRS})
find_library(CTP_RISK_LIBRARY NAMES riskuserapi PATHS ${CTP_LIBRARY_DIRS})
if(CTP_MDUSER_LIBRARY AND CTP_TRADE_LIBRARY AND CTP_RISK_LIBRARY)
set(CTP_LIBRARIES ${CTP_MDUSER_LIBRARY} ${CTP_TRADE_LIBRARY} ${CTP_RISK_LIBRARY})
set(CTP_SHAREDLIBFILES ${PROJECT_SOURCE_DIR}/ctp/api/risk/lib/riskuserapi.dll
${PROJECT_SOURCE_DIR}/ctp/api/trade/win/lib/thostmduserapi.dll
${PROJECT_SOURCE_DIR}/ctp/api/trade/win/lib/thosttraderapi.dll
)
endif()
elseif(UNIX)
find_library(CTP_MDUSER_LIBRARY thostmduserapi PATHS ${CTP_LIBRARY_DIRS})
find_library(CTP_TRADE_LIBRARY thosttraderapi PATHS ${CTP_LIBRARY_DIRS})
if(CTP_MDUSER_LIBRARY AND CTP_TRADE_LIBRARY)
set(CTP_LIBRARIES ${CTP_MDUSER_LIBRARY} ${CTP_TRADE_LIBRARY})
set(CTP_SHAREDLIBFILES ${CTP_LIBRARIES})
endif()
endif()
include_directories(${CTP_INCLUDE_DIRS})
file(COPY ${CTP_SHAREDLIBFILES} DESTINATION "${CMAKE_INSTALL_PREFIX}/local/lib")
find_package(SWIG REQUIRED)
if(SWIG_FOUND)
include(${SWIG_USE_FILE})
find_package(Java)
find_package(JNI)
find_package(Ruby)
find_package(PythonInterp)
find_package(PythonLibs)
find_package(R)
find_package(CSharp)
find_package(Mono)
# use $ENV{LUA_DIR}
find_package(Lua51)
find_package(PerlLibs)
find_package(TCL)
find_package(Octave)
if(JNI_FOUND)
# add_subdirectory(java)
endif()
if(RUBY_FOUND)
# add_subdirectory(ruby)
endif(RUBY_FOUND)
if(R_FOUND)
# add_subdirectory(R)
endif(R_FOUND)
if(PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND)
add_subdirectory(python)
endif()
if(CSharp_FOUND OR MONO_FOUND)
# add_subdirectory(csharp)
endif()
if(LUA51_FOUND)
# add_subdirectory(lua)
endif(LUA51_FOUND)
if(TCL_FOUND)
# add_subdirectory(tcl)
endif(TCL_FOUND)
if(PERLLIBS_FOUND)
# add_subdirectory(perl)
endif(PERLLIBS_FOUND)
if(OCTAVE_FOUND)
# add_subdirectory(octave)
endif(OCTAVE_FOUND)
endif()
#add_subdirectory(code)
#add_subdirectory(test)