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

G
groot 已提交
16

J
jinhai 已提交
17
set(license_check_files
Y
yangwei.yao 已提交
18 19 20 21
        license/LicenseLibrary.cpp
        license/LicenseCheck.cpp
        )

Y
yu yunfeng 已提交
22
set(license_generator_files
Y
yangwei.yao 已提交
23 24
        license/LicenseGenerator.cpp
        license/LicenseLibrary.cpp
Y
yu yunfeng 已提交
25
        ../unittest/metrics/counter_test.cpp ../unittest/metrics/metrics_test.cpp)
J
jinhai 已提交
26

G
groot 已提交
27 28
set(service_files
        thrift/gen-cpp/VecService.cpp
G
groot 已提交
29 30
        thrift/gen-cpp/megasearch_constants.cpp
        thrift/gen-cpp/megasearch_types.cpp
G
groot 已提交
31
        )
G
groot 已提交
32

Y
yu yunfeng 已提交
33
set(vecwise_engine_files
J
jinhai 已提交
34
        ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
G
groot 已提交
35
        ${cache_files}
G
groot 已提交
36
        ${db_files}
G
groot 已提交
37
        ${wrapper_files}
Y
yu yunfeng 已提交
38 39
        metrics/Metrics.cpp
#        ${metrics_files}
G
groot 已提交
40
        )
X
xj.lin 已提交
41

Y
yu yunfeng 已提交
42
set(get_sys_info_files
Y
yangwei.yao 已提交
43
        license/GetSysInfo.cpp)
J
jinhai 已提交
44

Y
yu yunfeng 已提交
45

G
groot 已提交
46
include_directories(/usr/include)
X
xj.lin 已提交
47
include_directories(/usr/local/cuda/include)
J
jinhai 已提交
48

X
xj.lin 已提交
49 50 51 52 53 54 55 56 57 58 59 60
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 已提交
61 62 63
#            libprometheus-cpp-push.a
#            libprometheus-cpp-pull.a
#            libprometheus-cpp-core.a
X
xj.lin 已提交
64 65 66 67 68 69 70 71 72 73
            )
else()
    set(engine_libs
            pthread
            libfaiss.a
            libgomp.a
            libopenblas.a
            libgfortran.a
            libquadmath.a
            libsqlite3.a
Y
yu yunfeng 已提交
74 75 76
#            libprometheus-cpp-push.a
#            libprometheus-cpp-pull.a
#            libprometheus-cpp-core.a
Y
yangwei.yao 已提交
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
            )
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 已提交
92 93
endif ()

G
groot 已提交
94

Y
yu yunfeng 已提交
95 96

cuda_add_library(vecwise_engine STATIC ${vecwise_engine_files})
X
xj.lin 已提交
97
target_link_libraries(vecwise_engine ${engine_libs})
G
groot 已提交
98

Y
yangwei.yao 已提交
99 100 101 102 103
if (ENABLE_LICENSE STREQUAL "ON")
        add_library(vecwise_license STATIC ${license_check_files})
        target_link_libraries(vecwise_license ${license_libs})
endif ()

Y
yu yunfeng 已提交
104 105 106 107 108 109
#set(metrics_lib
#        libprometheus-cpp-push.a
#        libprometheus-cpp-pull.a
#        libprometheus-cpp-core.a
#        )

Y
yu yunfeng 已提交
110
#add_library(metrics STATIC ${metrics_files} metrics/MetricBase.h)
Y
yu yunfeng 已提交
111 112
#target_link_libraries(metrics ${metrics_lib})

G
groot 已提交
113
add_executable(vecwise_server
G
groot 已提交
114 115 116
        ${config_files}
        ${server_files}
        ${utils_files}
G
groot 已提交
117
        ${service_files}
Y
yu yunfeng 已提交
118
#        ${metrics_files}
G
groot 已提交
119
        ${VECWISE_THIRD_PARTY_BUILD}/include/easylogging++.cc
G
groot 已提交
120 121
        )

Y
yu yunfeng 已提交
122 123


G
groot 已提交
124
set(server_libs
G
groot 已提交
125
        vecwise_engine
J
jinhai 已提交
126 127
        librocksdb.a
        libthrift.a
G
groot 已提交
128
        pthread
J
jinhai 已提交
129 130 131 132 133 134 135
        libyaml-cpp.a
        libboost_system.a
        libboost_filesystem.a
        libsnappy.a
        libbz2.a
        libz.a
        libzstd.a
136
        liblz4.a
X
xj.lin 已提交
137
        dl
G
groot 已提交
138
        )
G
groot 已提交
139

Y
yangwei.yao 已提交
140 141 142 143 144
if (ENABLE_LICENSE STREQUAL "ON")
        target_link_libraries(vecwise_server ${server_libs} vecwise_license)
else ()
        target_link_libraries(vecwise_server ${server_libs})
endif()
J
jinhai 已提交
145

Y
yangwei.yao 已提交
146
if (ENABLE_LICENSE STREQUAL "ON")
Y
yu yunfeng 已提交
147
        add_executable(license_generator ${license_generator_files})
Y
yangwei.yao 已提交
148 149 150
        target_link_libraries(get_sys_info ${license_libs} vecwise_license)
        target_link_libraries(license_generator ${license_libs})
endif ()
151

Y
yu yunfeng 已提交
152 153 154 155 156 157 158 159 160
install(TARGETS vecwise_server DESTINATION bin)

#target_link_libraries(
#        libprometheus-cpp-push.a
#        libprometheus-cpp-pull.a
#        libprometheus-cpp-core.a
#        pthread
#        z
#        ${CURL_LIBRARIES})