CMakeLists.txt 7.3 KB
Newer Older
J
jinhai 已提交
1 2 3 4 5 6
#-------------------------------------------------------------------------------
# Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
# Unauthorized copying of this file, via any medium is strictly prohibited.
# Proprietary and confidential.
#-------------------------------------------------------------------------------

J
jinhai 已提交
7 8 9
aux_source_directory(cache cache_files)
aux_source_directory(config config_files)
aux_source_directory(server server_files)
K
kun yu 已提交
10 11
aux_source_directory(server/grpc_impl grpcserver_files)
aux_source_directory(server/thrift_impl thriftserver_files)
J
jinhai 已提交
12
aux_source_directory(utils utils_files)
G
groot 已提交
13 14 15 16
aux_source_directory(db db_main_files)
aux_source_directory(db/engine db_engine_files)
aux_source_directory(db/insert db_insert_files)
aux_source_directory(db/meta db_meta_files)
17
aux_source_directory(metrics metrics_files)
X
MS-154  
xj.lin 已提交
18
aux_source_directory(wrapper/knowhere knowhere_files)
G
groot 已提交
19
aux_source_directory(scheduler new_scheduler_files)
Y
yu yunfeng 已提交
20

G
groot 已提交
21 22 23 24 25 26 27 28
aux_source_directory(db/scheduler scheduler_files)
aux_source_directory(db/scheduler/context scheduler_context_files)
aux_source_directory(db/scheduler/task scheduler_task_files)
set(db_scheduler_files
        ${scheduler_files}
        ${scheduler_context_files}
        ${scheduler_task_files}
        )
J
jinhai 已提交
29
set(license_check_files
Y
yangwei.yao 已提交
30 31 32 33
        license/LicenseLibrary.cpp
        license/LicenseCheck.cpp
        )

Y
yu yunfeng 已提交
34
set(license_generator_files
Y
yangwei.yao 已提交
35 36
        license/LicenseGenerator.cpp
        license/LicenseLibrary.cpp
Y
yu yunfeng 已提交
37
        )
G
groot 已提交
38

Y
Yu Kun 已提交
39
if (MILVUS_WITH_THRIFT STREQUAL "ON")
Z
zhiru 已提交
40
set(thrift_service_files
G
groot 已提交
41 42 43
        thrift/gen-cpp/MilvusService.cpp
        thrift/gen-cpp/milvus_constants.cpp
        thrift/gen-cpp/milvus_types.cpp
Y
yu yunfeng 已提交
44 45
        metrics/SystemInfo.cpp
        metrics/SystemInfo.h
K
kun yu 已提交
46 47
        server/thrift_impl/ThreadPoolServer.cpp
        server/thrift_impl/ThreadPoolServer.h
Z
zhiru 已提交
48
        )
Y
Yu Kun 已提交
49
else()
Z
zhiru 已提交
50 51 52
set(grpc_service_files
        metrics/SystemInfo.cpp
        metrics/SystemInfo.h
K
kun yu 已提交
53 54 55 56
        grpc/gen-milvus/milvus.grpc.pb.cc
        grpc/gen-milvus/milvus.pb.cc
        grpc/gen-status/status.grpc.pb.cc
        grpc/gen-status/status.pb.cc
G
groot 已提交
57
        )
Y
Yu Kun 已提交
58
endif()
G
groot 已提交
59

G
groot 已提交
60
set(db_files
J
jinhai 已提交
61
        ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
G
groot 已提交
62
        ${cache_files}
G
groot 已提交
63 64 65 66
        ${db_main_files}
        ${db_engine_files}
        ${db_insert_files}
        ${db_meta_files}
G
groot 已提交
67
        ${db_scheduler_files}
G
groot 已提交
68
        ${new_scheduler_files}
Y
yu yunfeng 已提交
69
        ${metrics_files}
X
MS-154  
xj.lin 已提交
70
        ${knowhere_files}
G
groot 已提交
71
        )
X
xj.lin 已提交
72

73 74 75 76
set(s3_client_files
        storage/s3/S3ClientWrapper.cpp
        storage/s3/S3ClientWrapper.h)

G
groot 已提交
77
include_directories(/usr/include)
Z
zhiru 已提交
78
include_directories("${CUDA_TOOLKIT_ROOT_DIR}/include")
G
groot 已提交
79
include_directories(thrift/gen-cpp)
Z
zhiru 已提交
80
include_directories(/usr/include/mysql)
K
kun yu 已提交
81 82
include_directories(grpc/gen-status)
include_directories(grpc/gen-milvus)
J
jinhai 已提交
83

Y
Yu Kun 已提交
84
if (MILVUS_WITH_THRIFT STREQUAL "ON")
Y
Yu Kun 已提交
85
    set(client_thrift_lib
Z
zhiru 已提交
86
            thrift)
Y
Yu Kun 已提交
87
else()
Y
Yu Kun 已提交
88
    set(client_grpc_lib
Z
zhiru 已提交
89 90 91 92 93
            grpcpp_channelz
            grpc++
            grpc
            grpc_protobuf
            grpc_protoc)
Y
Yu Kun 已提交
94
endif()
J
jinhai 已提交
95

Z
zhiru 已提交
96
set(third_party_libs
X
MS-154  
xj.lin 已提交
97 98 99 100 101 102 103
        knowhere
        SPTAGLibStatic
        arrow
        jemalloc_pic
        faiss
        openblas
        lapack
Z
zhiru 已提交
104
        easyloggingpp
G
groot 已提交
105
        sqlite
Y
Yu Kun 已提交
106 107
        ${client_thrift_lib}
        ${client_grpc_lib}
G
groot 已提交
108
        yaml-cpp
Z
zhiru 已提交
109 110 111
        prometheus-cpp-push
        prometheus-cpp-pull
        prometheus-cpp-core
G
groot 已提交
112 113 114 115 116
        boost_system_static
        boost_filesystem_static
        boost_serialization_static
        bzip2
        lz4
Z
zhiru 已提交
117 118 119
        snappy
        zlib
        zstd
X
MS-154  
xj.lin 已提交
120 121
        cudart
        cublas
Z
zhiru 已提交
122
        mysqlpp
Y
yu yunfeng 已提交
123
        ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
G
groot 已提交
124
        cudart
Z
zhiru 已提交
125
        )
Z
zhiru 已提交
126

127 128
if (MEGASEARCH_WITH_ARROW STREQUAL "ON")
    set(third_party_libs ${third_party_libs} arrow)
Z
zhiru 已提交
129
endif()
130
if(${BUILD_FAISS_WITH_MKL} STREQUAL "ON")
Z
zhiru 已提交
131 132 133 134 135 136 137
    set(third_party_libs ${third_party_libs}
            ${MKL_LIBS})
else()
    set(third_party_libs ${third_party_libs}
            lapack
            openblas)
endif()
Z
zhiru 已提交
138

Y
yudong.cai 已提交
139 140 141 142 143
if (MILVUS_ENABLE_PROFILING STREQUAL "ON")
    set(third_party_libs ${third_party_libs}
            gperftools
            libunwind)
endif()
Z
zhiru 已提交
144

X
xj.lin 已提交
145
if (GPU_VERSION STREQUAL "ON")
Z
zhiru 已提交
146
    link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64")
X
xj.lin 已提交
147 148 149 150
    set(engine_libs
            pthread
            libgomp.a
            libgfortran.a
Y
yu yunfeng 已提交
151
            ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
X
xj.lin 已提交
152 153 154 155 156 157
            )
else()
    set(engine_libs
            pthread
            libgomp.a
            libgfortran.a
Y
yu yunfeng 已提交
158
            ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
Y
yangwei.yao 已提交
159 160 161
            )
endif ()

162 163

if (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
W
wxyu 已提交
164 165 166 167 168 169
    set(engine_libs
	    ${engine_libs}
	    libquadmath.a
	    )
endif ()

Y
yu yunfeng 已提交
170

G
groot 已提交
171
cuda_add_library(milvus_engine STATIC ${db_files})
G
groot 已提交
172
target_link_libraries(milvus_engine ${engine_libs} ${third_party_libs})
G
groot 已提交
173

Y
yu yunfeng 已提交
174 175
add_library(metrics STATIC ${metrics_files})

Z
zhiru 已提交
176
set(metrics_lib
177
        easyloggingpp
Z
zhiru 已提交
178
        yaml-cpp
Z
zhiru 已提交
179 180 181 182
        prometheus-cpp-push
        prometheus-cpp-pull
        prometheus-cpp-core
        )
Y
yu yunfeng 已提交
183

Z
zhiru 已提交
184
target_link_libraries(metrics ${metrics_lib})
Y
yu yunfeng 已提交
185

G
groot 已提交
186
set(server_libs
G
groot 已提交
187
        milvus_engine
G
groot 已提交
188
        pthread
X
xj.lin 已提交
189
        dl
Y
yu yunfeng 已提交
190
        metrics
G
groot 已提交
191
        )
G
groot 已提交
192

G
groot 已提交
193 194 195 196 197 198 199 200 201 202 203
set(knowhere_libs
        knowhere
        SPTAGLibStatic
        arrow
        jemalloc_pic
        faiss
        openblas
        lapack
        tbb
        )

Y
Yu Kun 已提交
204 205 206 207 208 209 210 211 212 213
if (MILVUS_WITH_THRIFT STREQUAL "ON")
    add_executable(milvus_thrift_server
            ${config_files}
            ${server_files}
            ${thriftserver_files}
            ${utils_files}
            ${thrift_service_files}
            ${metrics_files}
            )
else()
214
    add_executable(milvus_server
Y
Yu Kun 已提交
215 216 217 218 219 220 221 222
            ${config_files}
            ${server_files}
            ${grpcserver_files}
            ${utils_files}
            ${grpc_service_files}
            ${metrics_files}
            )
endif()
Z
zhiru 已提交
223

Y
yangwei.yao 已提交
224
if (ENABLE_LICENSE STREQUAL "ON")
Y
Yu Kun 已提交
225 226 227 228 229 230
	add_executable(get_sys_info ${get_sys_info_files})
	add_executable(license_generator ${license_generator_files})

	target_link_libraries(get_sys_info ${license_libs} license_check ${third_party_libs})
	target_link_libraries(license_generator ${license_libs} ${third_party_libs})

Y
Yu Kun 已提交
231 232 233
    if(MILVUS_WITH_THRIFT STREQUAL "ON")
        target_link_libraries(milvus_thrift_server ${server_libs} license_check ${knowhere_libs} ${third_party_libs})
    else()
234
        target_link_libraries(milvus_server ${server_libs} license_check ${knowhere_libs} ${third_party_libs})
Y
Yu Kun 已提交
235
    endif()
Y
Yu Kun 已提交
236

Y
yangwei.yao 已提交
237
else ()
Y
Yu Kun 已提交
238 239 240
    if(MILVUS_WITH_THRIFT STREQUAL "ON")
        target_link_libraries(milvus_thrift_server ${server_libs} ${knowhere_libs} ${third_party_libs})
    else()
241
        target_link_libraries(milvus_server ${server_libs} ${knowhere_libs} ${third_party_libs})
Y
Yu Kun 已提交
242
    endif()
Y
yangwei.yao 已提交
243
endif()
244

Y
Yu Kun 已提交
245 246 247
if (MILVUS_WITH_THRIFT STREQUAL "ON")
    install(TARGETS milvus_thrift_server DESTINATION bin)
else()
248
    install(TARGETS milvus_server DESTINATION bin)
Y
Yu Kun 已提交
249
endif()
Y
yu yunfeng 已提交
250

251
install(FILES
X
xj.lin 已提交
252 253
        ${KNOWHERE_BUILD_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}tbb${CMAKE_SHARED_LIBRARY_SUFFIX}
        ${KNOWHERE_BUILD_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}tbb${CMAKE_SHARED_LIBRARY_SUFFIX}.2
254 255 256
        ${CMAKE_BINARY_DIR}/mysqlpp_ep-prefix/src/mysqlpp_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}mysqlpp${CMAKE_SHARED_LIBRARY_SUFFIX}
        ${CMAKE_BINARY_DIR}/mysqlpp_ep-prefix/src/mysqlpp_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}mysqlpp${CMAKE_SHARED_LIBRARY_SUFFIX}.3
        ${CMAKE_BINARY_DIR}/mysqlpp_ep-prefix/src/mysqlpp_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}mysqlpp${CMAKE_SHARED_LIBRARY_SUFFIX}.3.2.4
Z
zhiru 已提交
257
        DESTINATION lib)
Z
update  
zhiru 已提交
258

G
groot 已提交
259
add_subdirectory(sdk)