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)
Y
yu yunfeng 已提交
19

G
groot 已提交
20 21 22 23 24 25 26 27
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 已提交
28
set(license_check_files
Y
yangwei.yao 已提交
29 30 31 32
        license/LicenseLibrary.cpp
        license/LicenseCheck.cpp
        )

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

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

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

71 72 73 74
set(s3_client_files
        storage/s3/S3ClientWrapper.cpp
        storage/s3/S3ClientWrapper.h)

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

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

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

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

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

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

160 161

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

Y
yu yunfeng 已提交
168

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

Y
yu yunfeng 已提交
172 173
add_library(metrics STATIC ${metrics_files})

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

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

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

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

Y
Yu Kun 已提交
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
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()
    add_executable(milvus_grpc_server
            ${config_files}
            ${server_files}
            ${grpcserver_files}
            ${utils_files}
            ${grpc_service_files}
            ${metrics_files}
            )
endif()
Z
zhiru 已提交
221

Y
yangwei.yao 已提交
222
if (ENABLE_LICENSE STREQUAL "ON")
Y
Yu Kun 已提交
223 224 225 226 227 228
	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 已提交
229 230 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()
        target_link_libraries(milvus_grpc_server ${server_libs} license_check ${knowhere_libs} ${third_party_libs})
    endif()
Y
Yu Kun 已提交
234

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

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

249
install(FILES
X
xj.lin 已提交
250 251
        ${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
252 253 254
        ${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 已提交
255
        DESTINATION lib)
Z
update  
zhiru 已提交
256

G
groot 已提交
257
add_subdirectory(sdk)