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 81 82 83 84 85 86 87 88 89 90 91 92 93
#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
        lapack
        lz4
        openblas
        rocksdb
        snappy
        sqlite
#        sqlite_orm
        thrift
        yaml-cpp
        zlib
        zstd
        )

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

G
groot 已提交
139

Y
yu yunfeng 已提交
140 141

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

Y
yu yunfeng 已提交
144 145
add_library(metrics STATIC ${metrics_files})

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

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

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

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

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

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

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

        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 已提交
200
endif ()
201

Y
yu yunfeng 已提交
202 203
install(TARGETS vecwise_server DESTINATION bin)

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