CMakeLists.txt 4.3 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

Y
yu yunfeng 已提交
50

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

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

G
groot 已提交
100

Y
yu yunfeng 已提交
101 102

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

Y
yu yunfeng 已提交
105 106
add_library(metrics STATIC ${metrics_files})

Y
yangwei.yao 已提交
107 108 109 110 111
if (ENABLE_LICENSE STREQUAL "ON")
        add_library(vecwise_license STATIC ${license_check_files})
        target_link_libraries(vecwise_license ${license_libs})
endif ()

Y
yu yunfeng 已提交
112 113 114 115 116 117
#set(metrics_lib
#        libprometheus-cpp-push.a
#        libprometheus-cpp-pull.a
#        libprometheus-cpp-core.a
#        )

Y
yu yunfeng 已提交
118
#add_library(vecwise_engine STATIC ${metrics_files} )
Y
yu yunfeng 已提交
119 120
#target_link_libraries(metrics ${metrics_lib})

G
groot 已提交
121
add_executable(vecwise_server
G
groot 已提交
122 123 124
        ${config_files}
        ${server_files}
        ${utils_files}
G
groot 已提交
125
        ${service_files}
Y
yu yunfeng 已提交
126
        ${metrics_files}
G
groot 已提交
127
        ${VECWISE_THIRD_PARTY_BUILD}/include/easylogging++.cc
G
groot 已提交
128 129
        )

Y
yu yunfeng 已提交
130 131


G
groot 已提交
132
set(server_libs
G
groot 已提交
133
        vecwise_engine
J
jinhai 已提交
134 135
        librocksdb.a
        libthrift.a
G
groot 已提交
136
        pthread
J
jinhai 已提交
137 138 139 140 141 142 143
        libyaml-cpp.a
        libboost_system.a
        libboost_filesystem.a
        libsnappy.a
        libbz2.a
        libz.a
        libzstd.a
144
        liblz4.a
X
xj.lin 已提交
145
        dl
G
groot 已提交
146
        )
G
groot 已提交
147

Y
yangwei.yao 已提交
148 149 150 151 152
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 已提交
153

Y
yangwei.yao 已提交
154
if (ENABLE_LICENSE STREQUAL "ON")
Y
yu yunfeng 已提交
155
        add_executable(license_generator ${license_generator_files})
Y
yangwei.yao 已提交
156 157 158
        target_link_libraries(get_sys_info ${license_libs} vecwise_license)
        target_link_libraries(license_generator ${license_libs})
endif ()
159

Y
yu yunfeng 已提交
160 161
install(TARGETS vecwise_server DESTINATION bin)

Y
yu yunfeng 已提交
162
add_subdirectory(sdk)
Y
yu yunfeng 已提交
163 164 165 166 167 168
#target_link_libraries(
#        libprometheus-cpp-push.a
#        libprometheus-cpp-pull.a
#        libprometheus-cpp-core.a
#        pthread
#        z
Y
yu yunfeng 已提交
169 170
#        ${CURL_LIBRARIES})