CMakeLists.txt 4.1 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 15
aux_source_directory(metrics metrics_files)

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
        ${metrics_files}
G
groot 已提交
39
        )
X
xj.lin 已提交
40

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

Y
yu yunfeng 已提交
44

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

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

G
groot 已提交
93

Y
yu yunfeng 已提交
94 95

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

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

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

add_library(metrics STATIC ${metrics_files})
#target_link_libraries(metrics ${metrics_lib})

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

Y
yu yunfeng 已提交
121 122


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

Y
yangwei.yao 已提交
139 140 141 142 143
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 已提交
144

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

Y
yu yunfeng 已提交
151 152 153 154 155 156 157 158 159
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})