CMakeLists.txt 4.7 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)
G
groot 已提交
13
aux_source_directory(db/scheduler db_scheduler_files)
X
xj.lin 已提交
14
aux_source_directory(wrapper wrapper_files)
15
aux_source_directory(metrics metrics_files)
Y
yu yunfeng 已提交
16

17 18 19 20
#set(metrics_files
#        metrics/Metrics.cpp
#        metrics/MetricBase.h
#)
Y
yu yunfeng 已提交
21

G
groot 已提交
22

J
jinhai 已提交
23
set(license_check_files
Y
yangwei.yao 已提交
24 25 26 27
        license/LicenseLibrary.cpp
        license/LicenseCheck.cpp
        )

Y
yu yunfeng 已提交
28
set(license_generator_files
Y
yangwei.yao 已提交
29 30
        license/LicenseGenerator.cpp
        license/LicenseLibrary.cpp
Y
yu yunfeng 已提交
31
        )
J
jinhai 已提交
32

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

G
groot 已提交
43
set(engine_files
J
jinhai 已提交
44
        ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
G
groot 已提交
45
        ${cache_files}
G
groot 已提交
46
        ${db_files}
G
groot 已提交
47
        ${db_scheduler_files}
G
groot 已提交
48
        ${wrapper_files}
Y
yu yunfeng 已提交
49 50
#        metrics/Metrics.cpp
        ${metrics_files}
G
groot 已提交
51
        )
X
xj.lin 已提交
52

Y
yu yunfeng 已提交
53
set(get_sys_info_files
Y
yangwei.yao 已提交
54
        license/GetSysInfo.cpp)
J
jinhai 已提交
55

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

Z
zhiru 已提交
60 61
set(third_party_libs
        easyloggingpp
G
groot 已提交
62 63 64
        sqlite
        thrift
        yaml-cpp
Z
zhiru 已提交
65 66 67
        faiss
        lapack
        openblas
Z
zhiru 已提交
68 69 70
        prometheus-cpp-push
        prometheus-cpp-pull
        prometheus-cpp-core
G
groot 已提交
71 72 73 74 75
        boost_system_static
        boost_filesystem_static
        boost_serialization_static
        bzip2
        lz4
Z
zhiru 已提交
76 77 78
        snappy
        zlib
        zstd
Y
yu yunfeng 已提交
79
        ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
Z
zhiru 已提交
80
        )
81 82 83
if (MEGASEARCH_WITH_ARROW STREQUAL "ON")
    set(third_party_libs ${third_party_libs} arrow)
endif() 
Z
zhiru 已提交
84

X
xj.lin 已提交
85
if (GPU_VERSION STREQUAL "ON")
Z
zhiru 已提交
86
    link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64")
X
xj.lin 已提交
87 88 89 90 91 92
    set(engine_libs
            pthread
            libgomp.a
            libgfortran.a
            cudart
            cublas
Y
yu yunfeng 已提交
93
            ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
X
xj.lin 已提交
94 95 96 97 98 99
            )
else()
    set(engine_libs
            pthread
            libgomp.a
            libgfortran.a
Y
yu yunfeng 已提交
100
            ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
Y
yangwei.yao 已提交
101 102 103 104
            )
endif ()

if (ENABLE_LICENSE STREQUAL "ON")
Z
zhiru 已提交
105 106
    link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs")
    link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64")
Y
yangwei.yao 已提交
107 108 109 110 111 112
    set(license_libs
            nvidia-ml
            crypto
            cudart
            cublas
            )
X
xj.lin 已提交
113 114
endif ()

G
groot 已提交
115

Y
yu yunfeng 已提交
116

G
groot 已提交
117 118
cuda_add_library(milvus_engine STATIC ${engine_files})
target_link_libraries(milvus_engine ${engine_libs} ${third_party_libs})
G
groot 已提交
119

Y
yu yunfeng 已提交
120 121
add_library(metrics STATIC ${metrics_files})

Y
yangwei.yao 已提交
122
if (ENABLE_LICENSE STREQUAL "ON")
G
groot 已提交
123 124
        add_library(license_check STATIC ${license_check_files})
        target_link_libraries(license_check ${license_libs} ${third_party_libs})
Y
yangwei.yao 已提交
125 126
endif ()

Z
zhiru 已提交
127 128 129 130 131
set(metrics_lib
        prometheus-cpp-push
        prometheus-cpp-pull
        prometheus-cpp-core
        )
Y
yu yunfeng 已提交
132

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

G
groot 已提交
135
set(server_libs
G
groot 已提交
136
        milvus_engine
G
groot 已提交
137
        pthread
X
xj.lin 已提交
138
        dl
Y
yu yunfeng 已提交
139
        metrics
G
groot 已提交
140
        )
G
groot 已提交
141

G
groot 已提交
142
add_executable(milvus_server
Z
zhiru 已提交
143 144 145 146 147
        ${config_files}
        ${server_files}
        ${utils_files}
        ${service_files}
        ${metrics_files}
Z
zhiru 已提交
148
        #${EASYLOGGINGPP_INCLUDE_DIR}/easylogging++.cc
Z
zhiru 已提交
149 150
        )

Y
yangwei.yao 已提交
151
if (ENABLE_LICENSE STREQUAL "ON")
G
groot 已提交
152
        target_link_libraries(milvus_server ${server_libs} license_check ${third_party_libs})
Y
yangwei.yao 已提交
153
else ()
G
groot 已提交
154
        target_link_libraries(milvus_server ${server_libs} ${third_party_libs})
Y
yangwei.yao 已提交
155
endif()
J
jinhai 已提交
156

Y
yangwei.yao 已提交
157
if (ENABLE_LICENSE STREQUAL "ON")
Z
zhiru 已提交
158
        add_executable(get_sys_info ${get_sys_info_files})
Y
yu yunfeng 已提交
159
        add_executable(license_generator ${license_generator_files})
Z
zhiru 已提交
160

G
groot 已提交
161
        target_link_libraries(get_sys_info ${license_libs} license_check ${third_party_libs})
Z
zhiru 已提交
162 163 164 165
        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 已提交
166
endif ()
167

G
groot 已提交
168
install(TARGETS milvus_server DESTINATION bin)
Y
yu yunfeng 已提交
169

Y
yu yunfeng 已提交
170
add_subdirectory(sdk)
Y
yu yunfeng 已提交
171 172 173 174 175 176
#target_link_libraries(
#        libprometheus-cpp-push.a
#        libprometheus-cpp-pull.a
#        libprometheus-cpp-core.a
#        pthread
#        z
Y
yu yunfeng 已提交
177 178
#        ${CURL_LIBRARIES})