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

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}
        )

J
jinhai 已提交
26
set(license_check_files
Y
yangwei.yao 已提交
27 28 29 30
        license/LicenseLibrary.cpp
        license/LicenseCheck.cpp
        )

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

G
groot 已提交
36
set(service_files
G
groot 已提交
37 38 39
        thrift/gen-cpp/MilvusService.cpp
        thrift/gen-cpp/milvus_constants.cpp
        thrift/gen-cpp/milvus_types.cpp
Y
yu yunfeng 已提交
40 41
        metrics/SystemInfo.cpp
        metrics/SystemInfo.h
G
groot 已提交
42 43
        server/ThreadPoolServer.cpp
        server/ThreadPoolServer.h
G
groot 已提交
44
        )
G
groot 已提交
45

G
groot 已提交
46
set(engine_files
J
jinhai 已提交
47
        ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
G
groot 已提交
48
        ${cache_files}
G
groot 已提交
49
        ${db_files}
G
groot 已提交
50
        ${db_scheduler_files}
G
groot 已提交
51
        ${wrapper_files}
Y
yu yunfeng 已提交
52
        ${metrics_files}
X
MS-154  
xj.lin 已提交
53
        ${knowhere_files}
G
groot 已提交
54
        )
X
xj.lin 已提交
55

Y
yu yunfeng 已提交
56
set(get_sys_info_files
Y
yangwei.yao 已提交
57
        license/GetSysInfo.cpp)
J
jinhai 已提交
58

59 60 61 62
set(s3_client_files
        storage/s3/S3ClientWrapper.cpp
        storage/s3/S3ClientWrapper.h)

G
groot 已提交
63
include_directories(/usr/include)
Z
zhiru 已提交
64
include_directories("${CUDA_TOOLKIT_ROOT_DIR}/include")
G
groot 已提交
65
include_directories(thrift/gen-cpp)
Z
zhiru 已提交
66
include_directories(/usr/include/mysql)
J
jinhai 已提交
67

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

98 99
if (MEGASEARCH_WITH_ARROW STREQUAL "ON")
    set(third_party_libs ${third_party_libs} arrow)
Z
zhiru 已提交
100
endif()
101
if(${BUILD_FAISS_WITH_MKL} STREQUAL "ON")
Z
zhiru 已提交
102 103 104 105 106 107 108
    set(third_party_libs ${third_party_libs}
            ${MKL_LIBS})
else()
    set(third_party_libs ${third_party_libs}
            lapack
            openblas)
endif()
Z
zhiru 已提交
109

Y
yudong.cai 已提交
110 111 112 113 114
if (MILVUS_ENABLE_PROFILING STREQUAL "ON")
    set(third_party_libs ${third_party_libs}
            gperftools
            libunwind)
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
    set(engine_libs
            pthread
            libgomp.a
            libgfortran.a
Y
yu yunfeng 已提交
122
            ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
X
xj.lin 已提交
123 124 125 126 127 128
            )
else()
    set(engine_libs
            pthread
            libgomp.a
            libgfortran.a
Y
yu yunfeng 已提交
129
            ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
Y
yangwei.yao 已提交
130 131 132
            )
endif ()

133 134

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

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

G
groot 已提交
152

Y
yu yunfeng 已提交
153

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

Y
yu yunfeng 已提交
157 158
add_library(metrics STATIC ${metrics_files})

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

Z
zhiru 已提交
164
set(metrics_lib
165
        easyloggingpp
Z
zhiru 已提交
166
        yaml-cpp
Z
zhiru 已提交
167 168 169 170
        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

S
starlord 已提交
181 182 183 184 185 186 187 188 189 190 191
set(knowhere_libs
        knowhere
        SPTAGLibStatic
        arrow
        jemalloc_pic
        faiss
        openblas
        lapack
        tbb
        )

G
groot 已提交
192
add_executable(milvus_server
Z
zhiru 已提交
193 194 195 196 197 198 199
        ${config_files}
        ${server_files}
        ${utils_files}
        ${service_files}
        ${metrics_files}
        )

Y
yangwei.yao 已提交
200
if (ENABLE_LICENSE STREQUAL "ON")
S
starlord 已提交
201 202 203 204 205
        target_link_libraries(milvus_server
                ${server_libs}
                license_check
                ${third_party_libs}
                ${knowhere_libs})
Y
yangwei.yao 已提交
206
else ()
S
starlord 已提交
207 208 209 210 211
        target_link_libraries(milvus_server
                ${server_libs}
                ${third_party_libs}
                ${knowhere_libs}
                )
Y
yangwei.yao 已提交
212
endif()
J
jinhai 已提交
213

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

G
groot 已提交
218
        target_link_libraries(get_sys_info ${license_libs} license_check ${third_party_libs})
Z
zhiru 已提交
219 220 221 222
        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 已提交
223
endif ()
224

G
groot 已提交
225
install(TARGETS milvus_server DESTINATION bin)
Y
yu yunfeng 已提交
226

227
install(FILES
X
xj.lin 已提交
228 229
        ${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
230 231 232
        ${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 已提交
233
        DESTINATION lib)
Z
update  
zhiru 已提交
234

S
starlord 已提交
235
add_subdirectory(sdk)