-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
155 lines (121 loc) · 4.69 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
cmake_minimum_required(VERSION 3.19)
project(quik-connector)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(MSVC_COMPILE_FLAGS "/MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MSVC_COMPILE_FLAGS}")
option(USE_LUA_VERSION_5_4 "Build QUIK connector with LUA 5.4.1 otherwise with LUA 5.3.5" OFF)
if (USE_LUA_VERSION_5_4)
set(LUA_VERSION 5.4.1)
set(LUA_LIB_VERSION 54)
else()
set(LUA_VERSION 5.3.5)
set(LUA_LIB_VERSION 53)
endif()
message(STATUS "Build QUIK connector with LUA version: ${LUA_VERSION}")
set(SQLITE_CPP_WRAPPER_VERSION 3.1.1)
set(LZMA_VERSION 5.2.5)
set(JSON_VERSION 3.9.1)
set(YAML_CPP_VERSION 0.7.0)
set(SPDLOG_VERSION 1.9.0)
set(CPP_REDIS_VERSION 4.3.1)
set(CPP_HTTP_VERSION 0.9.7)
set(OPENSSL_VERSION 1.1.1l)
set(CROSSGUID_VERSION 0.2.2)
set(EFSW_VERSION 1.1.0)
set(GOOGLE_TEST_FRAMEWORK_VERSION 1.11.0)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
message(STATUS "Starting build QUIK connector Release...")
endif()
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/build-dependencies.cmake)
# Add definition QUIK_LUA_VERSION for version.h file
add_definitions(-DQUIK_LUA_VERSION="${LUA_VERSION}")
# Add definition INCLUDE_QUIK_FUNCTIONS_TEST_CALL for library.cpp file to call test functions
option(INCLUDE_QUIK_FUNCTIONS_TEST_CALL "Include call of test functions to validate proper QUIK functions work" OFF)
if (INCLUDE_QUIK_FUNCTIONS_TEST_CALL)
add_definitions(-DINCLUDE_QUIK_FUNCTIONS_TEST_CALL="${INCLUDE_QUIK_FUNCTIONS_TEST_CALL}")
endif(INCLUDE_QUIK_FUNCTIONS_TEST_CALL)
# Add definition TA_LIB to use ta_lib indicators
option(QUIK_INCLUDE_TA_LIB "Include TA-LIB indicators library" OFF)
if (QUIK_INCLUDE_TA_LIB)
add_definitions(-DTA_LIB="${QUIK_INCLUDE_TA_LIB}")
endif()
# Add definition OPENSSL_LIB to use openssl library
option(QUIK_INCLUDE_OPENSSL "Include OPENSSL library" OFF)
if (QUIK_INCLUDE_OPENSSL)
add_definitions(-DOPENSSL_LIB="${QUIK_INCLUDE_OPENSSL}")
endif()
file(GLOB_RECURSE QUIK_INCLUDE_FILES "src/*.h")
file(GLOB_RECURSE QUIK_SRC_FILES "src/*.cpp")
# Remove library.h and .cpp, quik-tools.cpp files to define them in separate variables
list(REMOVE_ITEM INCLUDE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/library.h")
list(REMOVE_ITEM SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/library.cpp" "apps/tools/quik-flags-debug.cpp")
set(QUIK_DLL_INC_FILE "src/library.h")
set(QUIK_DLL_SRC_FILE "src/library.cpp")
set(QUIK_DLL_VERSION_FILE "src/version.rc")
add_library(
quik-connector
SHARED
${QUIK_INCLUDE_FILES}
${QUIK_SRC_FILES}
${QUIK_DLL_INC_FILE}
${QUIK_DLL_SRC_FILE}
${QUIK_DLL_VERSION_FILE}
)
include_directories(
${SQLiteCpp_SOURCE_DIR}/include
${liblzma_SOURCE_DIR}/src/liblzma/api
${crossguid_SOURCE_DIR}
external/lua-${LUA_VERSION}/src
)
set(
QUIK_LINK_LIBRARIES
liblzma
sqlite3
SQLiteCpp
spdlog
nlohmann_json::nlohmann_json
yaml-cpp
cpp_redis
httplib
xg # crossguid library
efsw # file system watcher
${CMAKE_CURRENT_BINARY_DIR}/../external/lua-${LUA_VERSION}/build/lua${LUA_LIB_VERSION}.lib
)
if (QUIK_INCLUDE_OPENSSL)
include_directories(
external/openssl-${OPENSSL_VERSION}/include
external/openssl-${OPENSSL_VERSION}/build/include
)
target_link_libraries(quik-connector ${CMAKE_CURRENT_BINARY_DIR}/../external/openssl-${OPENSSL_VERSION}/build/libssl.lib)
target_link_libraries(quik-connector ${CMAKE_CURRENT_BINARY_DIR}/../external/openssl-${OPENSSL_VERSION}/build/libcrypto.lib)
endif()
if (QUIK_INCLUDE_TA_LIB)
include_directories(external/ta-lib/include)
target_link_libraries(quik-connector ${CMAKE_CURRENT_BINARY_DIR}/../external/ta-lib/lib/ta_libc_cdr.lib)
endif()
target_link_libraries(quik-connector ${QUIK_LINK_LIBRARIES})
option(QUIK_BUILD_TOOLS "Build QUIK tools binaries files" OFF)
if(QUIK_BUILD_TOOLS)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /MANIFEST:NO")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MANIFEST:NO")
add_library(
quik-connector-static
STATIC
${QUIK_INCLUDE_FILES}
${QUIK_SRC_FILES}
${QUIK_DLL_INC_FILE}
${QUIK_DLL_SRC_FILE}
${QUIK_DLL_VERSION_FILE}
)
target_link_libraries(quik-connector-static ${QUIK_LINK_LIBRARIES})
add_executable(quik-flags-debug "apps/tools/quik-flags-debug.cpp")
target_link_libraries(quik-flags-debug PUBLIC quik-connector-static)
endif(QUIK_BUILD_TOOLS)
option(QUIK_BUILD_TESTS "Build tests" OFF)
if (QUIK_BUILD_TESTS)
# Add build tests rules
endif(QUIK_BUILD_TESTS)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/create-output-directory-tree.cmake)