CMakeLists.txt 5.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)
X
xj.lin 已提交
13
aux_source_directory(wrapper wrapper_files)
Y
yu yunfeng 已提交
14
#aux_source_directory(metrics metrics_files)
Y
yu yunfeng 已提交
15

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

G
groot 已提交
21

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

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

G
groot 已提交
32
set(service_files
G
groot 已提交
33
        thrift/gen-cpp/MegasearchService.cpp
G
groot 已提交
34 35
        thrift/gen-cpp/megasearch_constants.cpp
        thrift/gen-cpp/megasearch_types.cpp
G
groot 已提交
36
        )
G
groot 已提交
37

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

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

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

Z
zhiru 已提交
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
#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
        boost_system_static
        boost_filesystem_static
        boost_serialization_static
        bzip2
        easyloggingpp
        faiss
        gtest
Z
zhiru 已提交
81 82
        gtest_main
        gmock
Z
zhiru 已提交
83 84 85 86 87 88 89 90 91 92 93 94 95
        lapack
        lz4
        openblas
        rocksdb
        snappy
        sqlite
#        sqlite_orm
        thrift
        yaml-cpp
        zlib
        zstd
        )

X
xj.lin 已提交
96 97 98 99 100 101 102 103 104 105 106 107
if (GPU_VERSION STREQUAL "ON")
    link_directories(/usr/local/cuda/lib64)
    set(engine_libs
            pthread
            libfaiss.a
            libgomp.a
            libopenblas.a
            libgfortran.a
            libquadmath.a
            cudart
            cublas
            libsqlite3.a
Y
yu yunfeng 已提交
108 109 110
#            libprometheus-cpp-push.a
#            libprometheus-cpp-pull.a
#            libprometheus-cpp-core.a
X
xj.lin 已提交
111 112 113 114 115 116 117 118 119 120
            )
else()
    set(engine_libs
            pthread
            libfaiss.a
            libgomp.a
            libopenblas.a
            libgfortran.a
            libquadmath.a
            libsqlite3.a
Y
yu yunfeng 已提交
121 122 123
#            libprometheus-cpp-push.a
#            libprometheus-cpp-pull.a
#            libprometheus-cpp-core.a
Y
yangwei.yao 已提交
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
            )
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 已提交
139 140
endif ()

G
groot 已提交
141

Y
yu yunfeng 已提交
142 143

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

Y
yu yunfeng 已提交
146 147
add_library(metrics STATIC ${metrics_files})

Y
yangwei.yao 已提交
148 149
if (ENABLE_LICENSE STREQUAL "ON")
        add_library(vecwise_license STATIC ${license_check_files})
Z
zhiru 已提交
150
        target_link_libraries(vecwise_license ${license_libs} ${third_party_libs})
Y
yangwei.yao 已提交
151 152
endif ()

Y
yu yunfeng 已提交
153 154 155 156 157 158
#set(metrics_lib
#        libprometheus-cpp-push.a
#        libprometheus-cpp-pull.a
#        libprometheus-cpp-core.a
#        )

Y
yu yunfeng 已提交
159
#add_library(vecwise_engine STATIC ${metrics_files} )
Y
yu yunfeng 已提交
160 161
#target_link_libraries(metrics ${metrics_lib})

G
groot 已提交
162
set(server_libs
G
groot 已提交
163
        vecwise_engine
J
jinhai 已提交
164 165
        librocksdb.a
        libthrift.a
G
groot 已提交
166
        pthread
J
jinhai 已提交
167 168 169 170 171 172 173
        libyaml-cpp.a
        libboost_system.a
        libboost_filesystem.a
        libsnappy.a
        libbz2.a
        libz.a
        libzstd.a
174
        liblz4.a
X
xj.lin 已提交
175
        dl
G
groot 已提交
176
        )
G
groot 已提交
177

Z
zhiru 已提交
178 179 180 181 182 183
add_executable(vecwise_server
        ${config_files}
        ${server_files}
        ${utils_files}
        ${service_files}
        ${metrics_files}
Z
zhiru 已提交
184
        #${EASYLOGGINGPP_INCLUDE_DIR}/easylogging++.cc
Z
zhiru 已提交
185 186
        )

Y
yangwei.yao 已提交
187
if (ENABLE_LICENSE STREQUAL "ON")
Z
zhiru 已提交
188
        target_link_libraries(vecwise_server ${server_libs} vecwise_license ${third_party_libs})
Y
yangwei.yao 已提交
189
else ()
Z
zhiru 已提交
190
        target_link_libraries(vecwise_server ${server_libs} ${third_party_libs})
Y
yangwei.yao 已提交
191
endif()
J
jinhai 已提交
192

Y
yangwei.yao 已提交
193
if (ENABLE_LICENSE STREQUAL "ON")
Z
zhiru 已提交
194
        add_executable(get_sys_info ${get_sys_info_files})
Y
yu yunfeng 已提交
195
        add_executable(license_generator ${license_generator_files})
Z
zhiru 已提交
196 197 198 199 200 201

        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 已提交
202
endif ()
203

Y
yu yunfeng 已提交
204 205
install(TARGETS vecwise_server DESTINATION bin)

Y
yu yunfeng 已提交
206
add_subdirectory(sdk)
Y
yu yunfeng 已提交
207 208 209 210 211 212
#target_link_libraries(
#        libprometheus-cpp-push.a
#        libprometheus-cpp-pull.a
#        libprometheus-cpp-core.a
#        pthread
#        z
Y
yu yunfeng 已提交
213 214
#        ${CURL_LIBRARIES})