CMakeLists.txt 6.2 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
        thrift/gen-cpp/MegasearchService.cpp
G
groot 已提交
35 36
        thrift/gen-cpp/megasearch_constants.cpp
        thrift/gen-cpp/megasearch_types.cpp
Y
yu yunfeng 已提交
37
        metrics/SystemInfo.cpp metrics/SystemInfo.h server/MegasearchThreadPoolServer.cpp server/MegasearchThreadPoolServer.h)
G
groot 已提交
38

Y
yu yunfeng 已提交
39
set(vecwise_engine_files
J
jinhai 已提交
40
        ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
G
groot 已提交
41
        ${cache_files}
G
groot 已提交
42
        ${db_files}
G
groot 已提交
43
        ${db_scheduler_files}
G
groot 已提交
44
        ${wrapper_files}
Y
yu yunfeng 已提交
45 46
#        metrics/Metrics.cpp
        ${metrics_files}
G
groot 已提交
47
        )
X
xj.lin 已提交
48

Y
yu yunfeng 已提交
49
set(get_sys_info_files
Y
yangwei.yao 已提交
50
        license/GetSysInfo.cpp)
J
jinhai 已提交
51

G
groot 已提交
52
include_directories(/usr/include)
X
xj.lin 已提交
53
include_directories(/usr/local/cuda/include)
G
groot 已提交
54
include_directories(thrift/gen-cpp)
J
jinhai 已提交
55

Y
yu yunfeng 已提交
56

Z
zhiru 已提交
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
#target_link_libraries(megasearch boost_system_static)
#target_link_libraries(megasearch boost_filesystem_static)
#target_link_libraries(megasearch boost_serialization_static)
#target_link_libraries(megasearch bzip2)
#target_link_libraries(megasearch easyloggingpp)
#target_link_libraries(megasearch faiss)
#target_link_libraries(megasearch gtest)
#target_link_libraries(megasearch lapack)
#target_link_libraries(megasearch lz4)
#target_link_libraries(megasearch openblas)
#target_link_libraries(megasearch rocksdb)
#target_link_libraries(megasearch snappy)
#target_link_libraries(megasearch sqlite)
#target_link_libraries(megasearch sqlite_orm)
#target_link_libraries(megasearch thrift)
#target_link_libraries(megasearch yaml-cpp)
#target_link_libraries(megasearch zlib)
#target_link_libraries(megasearch zstd)

set(third_party_libs
        easyloggingpp
G
groot 已提交
78 79 80 81
        sqlite
        #        sqlite_orm
        thrift
        yaml-cpp
Z
zhiru 已提交
82 83 84
        faiss
        lapack
        openblas
Z
zhiru 已提交
85 86 87
        prometheus-cpp-push
        prometheus-cpp-pull
        prometheus-cpp-core
88
        civetweb
G
groot 已提交
89 90 91 92 93
        boost_system_static
        boost_filesystem_static
        boost_serialization_static
        bzip2
        lz4
Z
zhiru 已提交
94 95 96
        snappy
        zlib
        zstd
Y
yu yunfeng 已提交
97
        ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
Z
zhiru 已提交
98 99
        )

X
xj.lin 已提交
100 101 102 103 104
if (GPU_VERSION STREQUAL "ON")
    link_directories(/usr/local/cuda/lib64)
    set(engine_libs
            pthread
            libfaiss.a
105
            libgpufaiss.a
X
xj.lin 已提交
106 107 108 109 110 111 112
            libgomp.a
            libopenblas.a
            libgfortran.a
            libquadmath.a
            cudart
            cublas
            libsqlite3.a
113 114 115
            libprometheus-cpp-push.a
            libprometheus-cpp-pull.a
            libprometheus-cpp-core.a
Y
yu yunfeng 已提交
116
            ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
X
xj.lin 已提交
117 118 119 120 121 122 123 124 125 126
            )
else()
    set(engine_libs
            pthread
            libfaiss.a
            libgomp.a
            libopenblas.a
            libgfortran.a
            libquadmath.a
            libsqlite3.a
127 128 129
            libprometheus-cpp-push.a
            libprometheus-cpp-pull.a
            libprometheus-cpp-core.a
Y
yu yunfeng 已提交
130
            ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
Y
yangwei.yao 已提交
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
            )
endif ()

if (ENABLE_LICENSE STREQUAL "ON")
    link_directories(/usr/local/cuda/lib64/stubs)
    link_directories(/usr/local/cuda/lib64)
    set(license_libs
            nvidia-ml
            libboost_system.a
            libboost_filesystem.a
            libboost_serialization.a
            crypto
            cudart
            cublas
            )
X
xj.lin 已提交
146 147
endif ()

G
groot 已提交
148

Y
yu yunfeng 已提交
149 150

cuda_add_library(vecwise_engine STATIC ${vecwise_engine_files})
Z
zhiru 已提交
151
target_link_libraries(vecwise_engine ${engine_libs} ${third_party_libs})
G
groot 已提交
152

Y
yu yunfeng 已提交
153 154
add_library(metrics STATIC ${metrics_files})

Y
yangwei.yao 已提交
155 156
if (ENABLE_LICENSE STREQUAL "ON")
        add_library(vecwise_license STATIC ${license_check_files})
Z
zhiru 已提交
157
        target_link_libraries(vecwise_license ${license_libs} ${third_party_libs})
Y
yangwei.yao 已提交
158 159
endif ()

Y
yu yunfeng 已提交
160 161 162 163 164 165
#set(metrics_lib
#        libprometheus-cpp-push.a
#        libprometheus-cpp-pull.a
#        libprometheus-cpp-core.a
#        )

Y
yu yunfeng 已提交
166
#add_library(vecwise_engine STATIC ${metrics_files} )
Y
yu yunfeng 已提交
167 168
#target_link_libraries(metrics ${metrics_lib})

G
groot 已提交
169
set(server_libs
G
groot 已提交
170
        vecwise_engine
J
jinhai 已提交
171
        libthrift.a
G
groot 已提交
172
        pthread
J
jinhai 已提交
173 174 175 176 177 178 179
        libyaml-cpp.a
        libboost_system.a
        libboost_filesystem.a
        libsnappy.a
        libbz2.a
        libz.a
        libzstd.a
180
        liblz4.a
X
xj.lin 已提交
181
        dl
Y
yu yunfeng 已提交
182
        metrics
G
groot 已提交
183
        )
G
groot 已提交
184

Z
zhiru 已提交
185 186 187 188 189 190
add_executable(vecwise_server
        ${config_files}
        ${server_files}
        ${utils_files}
        ${service_files}
        ${metrics_files}
Z
zhiru 已提交
191
        #${EASYLOGGINGPP_INCLUDE_DIR}/easylogging++.cc
Z
zhiru 已提交
192 193
        )

Y
yangwei.yao 已提交
194
if (ENABLE_LICENSE STREQUAL "ON")
Z
zhiru 已提交
195
        target_link_libraries(vecwise_server ${server_libs} vecwise_license ${third_party_libs})
Y
yangwei.yao 已提交
196
else ()
Z
zhiru 已提交
197
        target_link_libraries(vecwise_server ${server_libs} ${third_party_libs})
Y
yangwei.yao 已提交
198
endif()
J
jinhai 已提交
199

Y
yangwei.yao 已提交
200
if (ENABLE_LICENSE STREQUAL "ON")
Z
zhiru 已提交
201
        add_executable(get_sys_info ${get_sys_info_files})
Y
yu yunfeng 已提交
202
        add_executable(license_generator ${license_generator_files})
Z
zhiru 已提交
203 204 205 206 207 208

        target_link_libraries(get_sys_info ${license_libs} vecwise_license ${third_party_libs})
        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 已提交
209
endif ()
210

Y
yu yunfeng 已提交
211 212
install(TARGETS vecwise_server DESTINATION bin)

Y
yu yunfeng 已提交
213
add_subdirectory(sdk)
Y
yu yunfeng 已提交
214 215 216 217 218 219
#target_link_libraries(
#        libprometheus-cpp-push.a
#        libprometheus-cpp-pull.a
#        libprometheus-cpp-core.a
#        pthread
#        z
Y
yu yunfeng 已提交
220 221
#        ${CURL_LIBRARIES})