CMakeLists.txt 5.0 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 11
aux_source_directory(cache cache_files)
aux_source_directory(config config_files)
aux_source_directory(server server_files)
aux_source_directory(utils utils_files)
S
starlord 已提交
12 13 14 15
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)
16
aux_source_directory(metrics metrics_files)
X
MS-154  
xj.lin 已提交
17
aux_source_directory(wrapper/knowhere knowhere_files)
Y
yu yunfeng 已提交
18

G
groot 已提交
19 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}
        )

G
groot 已提交
28
set(service_files
G
groot 已提交
29 30 31
        thrift/gen-cpp/MilvusService.cpp
        thrift/gen-cpp/milvus_constants.cpp
        thrift/gen-cpp/milvus_types.cpp
Y
yu yunfeng 已提交
32 33
        metrics/SystemInfo.cpp
        metrics/SystemInfo.h
G
groot 已提交
34 35
        server/ThreadPoolServer.cpp
        server/ThreadPoolServer.h
G
groot 已提交
36
        )
G
groot 已提交
37

S
starlord 已提交
38
set(db_files
J
jinhai 已提交
39
        ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
G
groot 已提交
40
        ${cache_files}
S
starlord 已提交
41 42 43 44
        ${db_main_files}
        ${db_engine_files}
        ${db_insert_files}
        ${db_meta_files}
G
groot 已提交
45
        ${db_scheduler_files}
Y
yu yunfeng 已提交
46
        ${metrics_files}
X
MS-154  
xj.lin 已提交
47
        ${knowhere_files}
G
groot 已提交
48
        )
X
xj.lin 已提交
49

50 51 52 53
set(s3_client_files
        storage/s3/S3ClientWrapper.cpp
        storage/s3/S3ClientWrapper.h)

G
groot 已提交
54
include_directories(/usr/include)
Z
zhiru 已提交
55
include_directories("${CUDA_TOOLKIT_ROOT_DIR}/include")
G
groot 已提交
56
include_directories(thrift/gen-cpp)
Z
zhiru 已提交
57
include_directories(/usr/include/mysql)
J
jinhai 已提交
58

Z
zhiru 已提交
59
set(third_party_libs
X
MS-154  
xj.lin 已提交
60 61 62 63 64 65 66
        knowhere
        SPTAGLibStatic
        arrow
        jemalloc_pic
        faiss
        openblas
        lapack
Z
zhiru 已提交
67
        easyloggingpp
G
groot 已提交
68 69 70
        sqlite
        thrift
        yaml-cpp
Z
zhiru 已提交
71 72 73
        prometheus-cpp-push
        prometheus-cpp-pull
        prometheus-cpp-core
G
groot 已提交
74 75 76 77 78
        boost_system_static
        boost_filesystem_static
        boost_serialization_static
        bzip2
        lz4
Z
zhiru 已提交
79 80 81
        snappy
        zlib
        zstd
X
MS-154  
xj.lin 已提交
82 83
        cudart
        cublas
Z
zhiru 已提交
84
        mysqlpp
Y
yu yunfeng 已提交
85
        ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
86
        cudart
Z
zhiru 已提交
87
        )
Z
zhiru 已提交
88

89 90
if (MEGASEARCH_WITH_ARROW STREQUAL "ON")
    set(third_party_libs ${third_party_libs} arrow)
Z
zhiru 已提交
91
endif()
92
if(${BUILD_FAISS_WITH_MKL} STREQUAL "ON")
Z
zhiru 已提交
93 94 95 96 97 98 99
    set(third_party_libs ${third_party_libs}
            ${MKL_LIBS})
else()
    set(third_party_libs ${third_party_libs}
            lapack
            openblas)
endif()
Z
zhiru 已提交
100

Y
yudong.cai 已提交
101 102 103 104 105
if (MILVUS_ENABLE_PROFILING STREQUAL "ON")
    set(third_party_libs ${third_party_libs}
            gperftools
            libunwind)
endif()
Z
zhiru 已提交
106

X
xj.lin 已提交
107
if (GPU_VERSION STREQUAL "ON")
Z
zhiru 已提交
108
    link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64")
X
xj.lin 已提交
109 110 111 112
    set(engine_libs
            pthread
            libgomp.a
            libgfortran.a
Y
yu yunfeng 已提交
113
            ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
X
xj.lin 已提交
114 115 116 117 118 119
            )
else()
    set(engine_libs
            pthread
            libgomp.a
            libgfortran.a
Y
yu yunfeng 已提交
120
            ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
Y
yangwei.yao 已提交
121 122 123
            )
endif ()

124 125

if (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
W
wxyu 已提交
126 127 128 129 130 131
    set(engine_libs
	    ${engine_libs}
	    libquadmath.a
	    )
endif ()

Y
yu yunfeng 已提交
132

S
starlord 已提交
133
cuda_add_library(milvus_engine STATIC ${db_files})
G
groot 已提交
134
target_link_libraries(milvus_engine ${engine_libs} ${third_party_libs})
G
groot 已提交
135

Y
yu yunfeng 已提交
136 137
add_library(metrics STATIC ${metrics_files})

Z
zhiru 已提交
138
set(metrics_lib
139
        easyloggingpp
Z
zhiru 已提交
140
        yaml-cpp
Z
zhiru 已提交
141 142 143 144
        prometheus-cpp-push
        prometheus-cpp-pull
        prometheus-cpp-core
        )
Y
yu yunfeng 已提交
145

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

G
groot 已提交
148
set(server_libs
G
groot 已提交
149
        milvus_engine
G
groot 已提交
150
        pthread
X
xj.lin 已提交
151
        dl
Y
yu yunfeng 已提交
152
        metrics
G
groot 已提交
153
        )
G
groot 已提交
154

S
starlord 已提交
155 156 157 158 159 160 161 162 163 164 165
set(knowhere_libs
        knowhere
        SPTAGLibStatic
        arrow
        jemalloc_pic
        faiss
        openblas
        lapack
        tbb
        )

G
groot 已提交
166
add_executable(milvus_server
Z
zhiru 已提交
167 168 169 170 171 172 173 174
        ${config_files}
        ${server_files}
        ${utils_files}
        ${service_files}
        ${metrics_files}
        )


S
starlord 已提交
175 176 177 178 179
target_link_libraries(milvus_server
        ${server_libs}
        ${third_party_libs}
        ${knowhere_libs}
        )
180

G
groot 已提交
181
install(TARGETS milvus_server DESTINATION bin)
Y
yu yunfeng 已提交
182

183
install(FILES
X
xj.lin 已提交
184 185
        ${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
186 187 188
        ${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 已提交
189
        DESTINATION lib)
Z
update  
zhiru 已提交
190

S
starlord 已提交
191
add_subdirectory(sdk)