CMakeLists.txt 4.9 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)
G
groot 已提交
12
aux_source_directory(db db_files)
X
xj.lin 已提交
13
#aux_source_directory(wrapper wrapper_files)
14
aux_source_directory(metrics metrics_files)
X
MS-154  
xj.lin 已提交
15
aux_source_directory(wrapper/knowhere knowhere_files)
Y
yu yunfeng 已提交
16

G
groot 已提交
17 18 19 20 21 22 23 24 25
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 已提交
26
set(service_files
G
groot 已提交
27 28 29
        thrift/gen-cpp/MilvusService.cpp
        thrift/gen-cpp/milvus_constants.cpp
        thrift/gen-cpp/milvus_types.cpp
Y
yu yunfeng 已提交
30 31
        metrics/SystemInfo.cpp
        metrics/SystemInfo.h
G
groot 已提交
32 33
        server/ThreadPoolServer.cpp
        server/ThreadPoolServer.h
G
groot 已提交
34
        )
G
groot 已提交
35

G
groot 已提交
36
set(engine_files
J
jinhai 已提交
37
        ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
G
groot 已提交
38
        ${cache_files}
G
groot 已提交
39
        ${db_files}
G
groot 已提交
40
        ${db_scheduler_files}
G
groot 已提交
41
        ${wrapper_files}
Y
yu yunfeng 已提交
42
        ${metrics_files}
X
MS-154  
xj.lin 已提交
43
        ${knowhere_files}
G
groot 已提交
44
        )
X
xj.lin 已提交
45

46 47 48 49
set(s3_client_files
        storage/s3/S3ClientWrapper.cpp
        storage/s3/S3ClientWrapper.h)

G
groot 已提交
50
include_directories(/usr/include)
Z
zhiru 已提交
51
include_directories("${CUDA_TOOLKIT_ROOT_DIR}/include")
G
groot 已提交
52
include_directories(thrift/gen-cpp)
Z
zhiru 已提交
53
include_directories(/usr/include/mysql)
J
jinhai 已提交
54

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

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

Y
yudong.cai 已提交
97 98 99 100 101
if (MILVUS_ENABLE_PROFILING STREQUAL "ON")
    set(third_party_libs ${third_party_libs}
            gperftools
            libunwind)
endif()
Z
zhiru 已提交
102

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

120 121

if (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
W
wxyu 已提交
122 123 124 125 126 127
    set(engine_libs
	    ${engine_libs}
	    libquadmath.a
	    )
endif ()

Y
yu yunfeng 已提交
128

G
groot 已提交
129 130
cuda_add_library(milvus_engine STATIC ${engine_files})
target_link_libraries(milvus_engine ${engine_libs} ${third_party_libs})
G
groot 已提交
131

Y
yu yunfeng 已提交
132 133
add_library(metrics STATIC ${metrics_files})

Z
zhiru 已提交
134
set(metrics_lib
135
        easyloggingpp
Z
zhiru 已提交
136
        yaml-cpp
Z
zhiru 已提交
137 138 139 140
        prometheus-cpp-push
        prometheus-cpp-pull
        prometheus-cpp-core
        )
Y
yu yunfeng 已提交
141

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

G
groot 已提交
144
set(server_libs
G
groot 已提交
145
        milvus_engine
G
groot 已提交
146
        pthread
X
xj.lin 已提交
147
        dl
Y
yu yunfeng 已提交
148
        metrics
G
groot 已提交
149
        )
G
groot 已提交
150

S
starlord 已提交
151 152 153 154 155 156 157 158 159 160 161
set(knowhere_libs
        knowhere
        SPTAGLibStatic
        arrow
        jemalloc_pic
        faiss
        openblas
        lapack
        tbb
        )

G
groot 已提交
162
add_executable(milvus_server
Z
zhiru 已提交
163 164 165 166 167 168 169 170
        ${config_files}
        ${server_files}
        ${utils_files}
        ${service_files}
        ${metrics_files}
        )


S
starlord 已提交
171 172 173 174 175
target_link_libraries(milvus_server
        ${server_libs}
        ${third_party_libs}
        ${knowhere_libs}
        )
176

G
groot 已提交
177
install(TARGETS milvus_server DESTINATION bin)
Y
yu yunfeng 已提交
178

179
install(FILES
X
xj.lin 已提交
180 181
        ${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
182 183 184
        ${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 已提交
185
        DESTINATION lib)
Z
update  
zhiru 已提交
186

S
starlord 已提交
187
add_subdirectory(sdk)