CMakeLists.txt 6.8 KB
Newer Older
J
jinhai 已提交
1
#-------------------------------------------------------------------------------
J
jinhai 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
J
jinhai 已提交
18 19
#-------------------------------------------------------------------------------

Z
zhiru 已提交
20 21
include_directories(${MILVUS_SOURCE_DIR})
include_directories(${MILVUS_ENGINE_SRC})
W
wxyu 已提交
22
include_directories(${MILVUS_THIRDPARTY_SRC})
J
jinhai 已提交
23

S
starlord 已提交
24 25
include_directories(${MILVUS_ENGINE_SRC}/grpc/gen-status)
include_directories(${MILVUS_ENGINE_SRC}/grpc/gen-milvus)
Z
zhiru 已提交
26

S
starlord 已提交
27
add_subdirectory(index)
Z
Zhiru Zhu 已提交
28
if (FAISS_WITH_MKL)
Z
Zhiru Zhu 已提交
29 30
    add_compile_definitions("WITH_MKL")
endif ()
Q
quicksilver 已提交
31

S
starlord 已提交
32 33
set(INDEX_INCLUDE_DIRS ${INDEX_INCLUDE_DIRS} PARENT_SCOPE)
foreach (dir ${INDEX_INCLUDE_DIRS})
Z
zhiru 已提交
34
    include_directories(${dir})
Z
zhiru 已提交
35
endforeach ()
Z
zhiru 已提交
36

Z
update  
zhiru 已提交
37 38
aux_source_directory(${MILVUS_ENGINE_SRC}/cache cache_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/config config_files)
S
starlord 已提交
39
aux_source_directory(${MILVUS_ENGINE_SRC}/metrics metrics_files)
40
aux_source_directory(${MILVUS_ENGINE_SRC}/metrics/prometheus metrics_prometheus_files)
Z
update  
zhiru 已提交
41 42 43 44
aux_source_directory(${MILVUS_ENGINE_SRC}/db db_main_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/db/engine db_engine_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/db/insert db_insert_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/db/meta db_meta_files)
Z
zhiru 已提交
45 46

set(grpc_service_files
Z
update  
zhiru 已提交
47 48 49 50
        ${MILVUS_ENGINE_SRC}/grpc/gen-milvus/milvus.grpc.pb.cc
        ${MILVUS_ENGINE_SRC}/grpc/gen-milvus/milvus.pb.cc
        ${MILVUS_ENGINE_SRC}/grpc/gen-status/status.grpc.pb.cc
        ${MILVUS_ENGINE_SRC}/grpc/gen-status/status.pb.cc
Z
zhiru 已提交
51 52
        )

Z
update  
zhiru 已提交
53 54 55 56
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler scheduler_main_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/action scheduler_action_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/event scheduler_event_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/job scheduler_job_files)
W
wxyu 已提交
57
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/optimizer scheduler_optimizer_files)
Z
update  
zhiru 已提交
58 59
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/resource scheduler_resource_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/task scheduler_task_files)
Z
zhiru 已提交
60
set(scheduler_files
Z
update  
zhiru 已提交
61
        ${scheduler_main_files}
W
wxyu 已提交
62 63
        ${scheduler_action_files}
        ${scheduler_event_files}
W
wxyu 已提交
64
        ${scheduler_job_files}
W
wxyu 已提交
65
        ${scheduler_optimizer_files}
W
wxyu 已提交
66 67 68 69
        ${scheduler_resource_files}
        ${scheduler_task_files}
        )

W
wxyu 已提交
70 71 72 73 74
aux_source_directory(${MILVUS_THIRDPARTY_SRC}/easyloggingpp thirdparty_easyloggingpp_files)
aux_source_directory(${MILVUS_THIRDPARTY_SRC}/nlohmann thirdparty_nlohmann_files)
set(thirdparty_files
        ${thirdparty_easyloggingpp_files}
        ${thirdparty_nlohmann_files}
W
wxyu 已提交
75 76
        )

Z
update  
zhiru 已提交
77 78 79
aux_source_directory(${MILVUS_ENGINE_SRC}/server server_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/server/grpc_impl grpc_server_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/utils utils_files)
Z
update  
zhiru 已提交
80
aux_source_directory(${MILVUS_ENGINE_SRC}/wrapper wrapper_files)
G
groot 已提交
81

Z
update  
zhiru 已提交
82
set(engine_files
J
jinhai 已提交
83
        ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
G
groot 已提交
84
        ${cache_files}
S
starlord 已提交
85 86 87 88
        ${db_main_files}
        ${db_engine_files}
        ${db_insert_files}
        ${db_meta_files}
Y
yu yunfeng 已提交
89
        ${metrics_files}
W
wxyu 已提交
90
        ${thirdparty_files}
91
        ${utils_files}
Z
update  
zhiru 已提交
92
        ${wrapper_files}
G
groot 已提交
93
        )
X
xj.lin 已提交
94

95 96 97 98 99
if (MILVUS_WITH_PROMETHEUS)
    set(engine_files ${engine_files}
            ${metrics_prometheus_files})
endif ()

S
starlord 已提交
100 101 102 103 104
set(client_grpc_lib
        grpcpp_channelz
        grpc++
        grpc
        grpc_protobuf
Z
update  
zhiru 已提交
105 106
        grpc_protoc
        )
J
jinhai 已提交
107

Z
zhiru 已提交
108
set(prometheus_lib
Z
zhiru 已提交
109 110
        prometheus-cpp-push
        prometheus-cpp-pull
Z
update  
zhiru 已提交
111 112
        prometheus-cpp-core
        )
Z
zhiru 已提交
113 114

set(boost_lib
115 116 117
        libboost_system.a
        libboost_filesystem.a
        libboost_serialization.a
Z
update  
zhiru 已提交
118
        )
Z
zhiru 已提交
119 120 121 122 123

set(third_party_libs
        sqlite
        ${client_grpc_lib}
        yaml-cpp
Z
zhiru 已提交
124
        mysqlpp
Z
Zhiru Zhu 已提交
125 126
        zlib
        ${boost_lib}
Z
zhiru 已提交
127
        )
S
starlord 已提交
128

Y
youny626 已提交
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
if (MILVUS_GPU_VERSION)
    include_directories(${CUDA_INCLUDE_DIRS})
    link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64")
    set(cuda_lib
            ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
            cudart
            cublas
            )
    set(third_party_libs ${third_party_libs}
            ${cuda_lib}
            )
    aux_source_directory(${MILVUS_ENGINE_SRC}/wrapper/gpu wrapper_gpu_files)
    set(engine_files ${engine_files}
            ${wrapper_gpu_files}
            )
endif ()

146
if (MILVUS_ENABLE_PROFILING)
Y
yudong.cai 已提交
147
    set(third_party_libs ${third_party_libs}
Y
youny626 已提交
148 149 150
            gperftools
            libunwind
            )
Z
zhiru 已提交
151
endif ()
Y
yangwei.yao 已提交
152

153 154 155 156 157 158
if (MILVUS_WITH_PROMETHEUS)
    set(third_party_libs ${third_party_libs}
            ${prometheus_lib}
            )
endif ()

S
starlord 已提交
159 160 161 162
set(engine_libs
        pthread
        libgomp.a
        libgfortran.a
Y
youny626 已提交
163
        dl
S
starlord 已提交
164
        )
165 166

if (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
W
wxyu 已提交
167
    set(engine_libs
Z
zhiru 已提交
168 169 170
            ${engine_libs}
            libquadmath.a
            )
W
wxyu 已提交
171 172
endif ()

Y
youny626 已提交
173
add_library(milvus_engine STATIC ${engine_files})
S
starlord 已提交
174 175 176
target_link_libraries(milvus_engine
        knowhere
        ${third_party_libs}
Y
youny626 已提交
177
        ${engine_libs}
S
starlord 已提交
178
        )
G
groot 已提交
179

180 181 182 183 184
if (MILVUS_WITH_PROMETHEUS)
    add_library(metrics STATIC ${metrics_files} ${metrics_prometheus_files})
else ()
    add_library(metrics STATIC ${metrics_files})
endif ()
Y
yu yunfeng 已提交
185

Z
zhiru 已提交
186
set(metrics_lib
Z
zhiru 已提交
187
        yaml-cpp
Z
zhiru 已提交
188
        )
Y
yu yunfeng 已提交
189

190 191 192 193 194 195
if (MILVUS_WITH_PROMETHEUS)
    set(metrics_lib ${metrics_lib}
            ${prometheus_lib}
            )
endif ()

Z
zhiru 已提交
196
target_link_libraries(metrics ${metrics_lib})
Y
yu yunfeng 已提交
197

G
groot 已提交
198
set(server_libs
G
groot 已提交
199
        milvus_engine
Y
yu yunfeng 已提交
200
        metrics
G
groot 已提交
201
        )
G
groot 已提交
202

S
starlord 已提交
203 204
add_executable(milvus_server
        ${config_files}
Z
zhiru 已提交
205 206
        ${metrics_files}
        ${scheduler_files}
S
starlord 已提交
207
        ${server_files}
Z
zhiru 已提交
208
        ${grpc_server_files}
S
starlord 已提交
209
        ${grpc_service_files}
Z
zhiru 已提交
210
        ${utils_files}
S
starlord 已提交
211
        )
Y
yu yunfeng 已提交
212

S
starlord 已提交
213 214 215
target_link_libraries(milvus_server
        ${server_libs}
        )
S
starlord 已提交
216 217 218

install(TARGETS milvus_server DESTINATION bin)

219 220 221 222
install(FILES
        ${CMAKE_BINARY_DIR}/mysqlpp_ep-prefix/src/mysqlpp_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}mysqlpp${CMAKE_SHARED_LIBRARY_SUFFIX}
        ${CMAKE_BINARY_DIR}/mysqlpp_ep-prefix/src/mysqlpp_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}mysqlpp${CMAKE_SHARED_LIBRARY_SUFFIX}.3
        ${CMAKE_BINARY_DIR}/mysqlpp_ep-prefix/src/mysqlpp_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}mysqlpp${CMAKE_SHARED_LIBRARY_SUFFIX}.3.2.4
Z
zhiru 已提交
223
        DESTINATION lib)
Z
update  
zhiru 已提交
224

S
starlord 已提交
225
add_subdirectory(sdk)