CMakeLists.txt 6.8 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.
#-------------------------------------------------------------------------------

Y
yu yunfeng 已提交
7

J
jinhai 已提交
8 9 10
aux_source_directory(cache cache_files)
aux_source_directory(config config_files)
aux_source_directory(server server_files)
K
kun yu 已提交
11 12
aux_source_directory(server/grpc_impl grpcserver_files)
aux_source_directory(server/thrift_impl thriftserver_files)
J
jinhai 已提交
13
aux_source_directory(utils utils_files)
G
groot 已提交
14
aux_source_directory(db db_files)
X
xj.lin 已提交
15
aux_source_directory(wrapper wrapper_files)
16
aux_source_directory(metrics metrics_files)
Y
yu yunfeng 已提交
17

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

Y
yu yunfeng 已提交
32
set(license_generator_files
Y
yangwei.yao 已提交
33 34
        license/LicenseGenerator.cpp
        license/LicenseLibrary.cpp
Y
yu yunfeng 已提交
35
        )
J
jinhai 已提交
36

G
groot 已提交
37
set(service_files
G
groot 已提交
38 39 40
        thrift/gen-cpp/MilvusService.cpp
        thrift/gen-cpp/milvus_constants.cpp
        thrift/gen-cpp/milvus_types.cpp
Y
yu yunfeng 已提交
41 42
        metrics/SystemInfo.cpp
        metrics/SystemInfo.h
K
kun yu 已提交
43 44
        server/thrift_impl/ThreadPoolServer.cpp
        server/thrift_impl/ThreadPoolServer.h
K
kun yu 已提交
45 46 47 48
        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 已提交
49
        )
G
groot 已提交
50

G
groot 已提交
51
set(engine_files
J
jinhai 已提交
52
        ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
G
groot 已提交
53
        ${cache_files}
G
groot 已提交
54
        ${db_files}
G
groot 已提交
55
        ${db_scheduler_files}
G
groot 已提交
56
        ${wrapper_files}
Y
yu yunfeng 已提交
57
        ${metrics_files}
G
groot 已提交
58
        )
X
xj.lin 已提交
59

Y
yu yunfeng 已提交
60
set(get_sys_info_files
Y
yangwei.yao 已提交
61
        license/GetSysInfo.cpp)
J
jinhai 已提交
62

63 64 65 66
set(s3_client_files
        storage/s3/S3ClientWrapper.cpp
        storage/s3/S3ClientWrapper.h)

G
groot 已提交
67
include_directories(/usr/include)
Z
zhiru 已提交
68
include_directories("${CUDA_TOOLKIT_ROOT_DIR}/include")
G
groot 已提交
69
include_directories(thrift/gen-cpp)
Z
zhiru 已提交
70
include_directories(/usr/include/mysql)
K
kun yu 已提交
71 72
include_directories(grpc/gen-status)
include_directories(grpc/gen-milvus)
J
jinhai 已提交
73

Y
yudong.cai 已提交
74 75 76 77
if (MILVUS_ENABLE_PROFILING STREQUAL "ON")
    SET(PROFILER_LIB profiler)
endif()

Z
zhiru 已提交
78 79
set(third_party_libs
        easyloggingpp
G
groot 已提交
80 81
        sqlite
        thrift
K
kun yu 已提交
82 83 84
        grpc
        grpc++
        grpcpp_channelz
G
groot 已提交
85
        yaml-cpp
Z
zhiru 已提交
86
        faiss
Z
zhiru 已提交
87 88 89
        prometheus-cpp-push
        prometheus-cpp-pull
        prometheus-cpp-core
G
groot 已提交
90 91 92 93 94
        boost_system_static
        boost_filesystem_static
        boost_serialization_static
        bzip2
        lz4
Z
zhiru 已提交
95 96 97
        snappy
        zlib
        zstd
Z
zhiru 已提交
98
        mysqlpp
Y
yudong.cai 已提交
99
        ${PROFILER_LIB}
Y
yu yunfeng 已提交
100
        ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
Z
zhiru 已提交
101
        )
Z
zhiru 已提交
102

103 104
if (MEGASEARCH_WITH_ARROW STREQUAL "ON")
    set(third_party_libs ${third_party_libs} arrow)
Z
zhiru 已提交
105
endif()
106
if(${BUILD_FAISS_WITH_MKL} STREQUAL "ON")
Z
zhiru 已提交
107 108 109 110 111 112 113 114
    set(third_party_libs ${third_party_libs}
            ${MKL_LIBS}
            ${MKL_LIBS})
else()
    set(third_party_libs ${third_party_libs}
            lapack
            openblas)
endif()
Z
zhiru 已提交
115

X
xj.lin 已提交
116
if (GPU_VERSION STREQUAL "ON")
Z
zhiru 已提交
117
    link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64")
X
xj.lin 已提交
118 119 120 121 122 123
    set(engine_libs
            pthread
            libgomp.a
            libgfortran.a
            cudart
            cublas
Y
yu yunfeng 已提交
124
            ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
X
xj.lin 已提交
125 126 127 128 129 130
            )
else()
    set(engine_libs
            pthread
            libgomp.a
            libgfortran.a
Y
yu yunfeng 已提交
131
            ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
Y
yangwei.yao 已提交
132 133 134
            )
endif ()

135 136

if (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
W
wxyu 已提交
137 138 139 140 141 142
    set(engine_libs
	    ${engine_libs}
	    libquadmath.a
	    )
endif ()

Y
yangwei.yao 已提交
143
if (ENABLE_LICENSE STREQUAL "ON")
Z
zhiru 已提交
144 145
    link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs")
    link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64")
Y
yangwei.yao 已提交
146 147 148 149 150 151
    set(license_libs
            nvidia-ml
            crypto
            cudart
            cublas
            )
X
xj.lin 已提交
152 153
endif ()

G
groot 已提交
154

Y
yu yunfeng 已提交
155

G
groot 已提交
156 157
cuda_add_library(milvus_engine STATIC ${engine_files})
target_link_libraries(milvus_engine ${engine_libs} ${third_party_libs})
G
groot 已提交
158

Y
yu yunfeng 已提交
159 160
add_library(metrics STATIC ${metrics_files})

Y
yangwei.yao 已提交
161
if (ENABLE_LICENSE STREQUAL "ON")
G
groot 已提交
162 163
        add_library(license_check STATIC ${license_check_files})
        target_link_libraries(license_check ${license_libs} ${third_party_libs})
Y
yangwei.yao 已提交
164 165
endif ()

Z
zhiru 已提交
166 167 168 169 170
set(metrics_lib
        prometheus-cpp-push
        prometheus-cpp-pull
        prometheus-cpp-core
        )
Y
yu yunfeng 已提交
171

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

G
groot 已提交
174
set(server_libs
G
groot 已提交
175
        milvus_engine
G
groot 已提交
176
        pthread
X
xj.lin 已提交
177
        dl
Y
yu yunfeng 已提交
178
        metrics
G
groot 已提交
179
        )
G
groot 已提交
180

K
kun yu 已提交
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
if (MILVUS_ENABLE_THRIFT STREQUAL "ON")
    add_executable(milvus_thrift_server
            ${config_files}
            ${server_files}
            ${thriftserver_files}
            ${utils_files}
            ${service_files}
            ${metrics_files}
            )
else()
    add_executable(milvus_grpc_server
            ${config_files}
            ${server_files}
            ${grpcserver_files}
            ${utils_files}
            ${service_files}
            ${metrics_files}
            )
endif()

Z
zhiru 已提交
201

Y
yangwei.yao 已提交
202
if (ENABLE_LICENSE STREQUAL "ON")
K
kun yu 已提交
203 204 205 206 207
    if(MILVUS_ENABLE_THRIFT STREQUAL "ON")
        target_link_libraries(milvus_thrift_server ${server_libs} license_check ${third_party_libs})
    else()
        target_link_libraries(milvus_grpc_server ${server_libs} license_check ${third_party_libs})
    endif()
Y
yangwei.yao 已提交
208
else ()
K
kun yu 已提交
209 210 211 212 213
    if(MILVUS_ENABLE_THRIFT STREQUAL "ON")
        target_link_libraries(milvus_thrift_server ${server_libs} ${third_party_libs})
    else()
        target_link_libraries(milvus_grpc_server ${server_libs} ${third_party_libs})
    endif()
Y
yangwei.yao 已提交
214
endif()
J
jinhai 已提交
215

Y
yangwei.yao 已提交
216
if (ENABLE_LICENSE STREQUAL "ON")
Z
zhiru 已提交
217
        add_executable(get_sys_info ${get_sys_info_files})
Y
yu yunfeng 已提交
218
        add_executable(license_generator ${license_generator_files})
Z
zhiru 已提交
219

G
groot 已提交
220
        target_link_libraries(get_sys_info ${license_libs} license_check ${third_party_libs})
Z
zhiru 已提交
221 222 223 224
        target_link_libraries(license_generator ${license_libs} ${third_party_libs})

        install(TARGETS get_sys_info DESTINATION bin)
        install(TARGETS license_generator DESTINATION bin)
Y
yangwei.yao 已提交
225
endif ()
226

K
kun yu 已提交
227 228 229 230 231
if (MILVUS_ENABLE_THRIFT STREQUAL "ON")
    install(TARGETS milvus_thrift_server DESTINATION bin)
else()
    install(TARGETS milvus_grpc_server DESTINATION bin)
endif()
Y
yu yunfeng 已提交
232

233 234 235 236
install(FILES
        ${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 已提交
237
        DESTINATION lib)
Z
update  
zhiru 已提交
238

K
kun yu 已提交
239
add_subdirectory(sdk)