CMakeLists.txt 9.3 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
        )

77 78 79 80 81 82 83 84 85
aux_source_directory(${MILVUS_ENGINE_SRC}/server server_service_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/server/delivery/request delivery_request_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/server/delivery delivery_files)
set(server_files
        ${server_service_files}
        ${delivery_request_files}
        ${delivery_files}
        )

G
groot 已提交
86
aux_source_directory(${MILVUS_ENGINE_SRC}/server/grpc_impl grpc_impl_files)
Z
Zhiru Zhu 已提交
87 88
aux_source_directory(${MILVUS_ENGINE_SRC}/server/grpc_impl/interceptor grpc_interceptor_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/server/context server_context_files)
G
groot 已提交
89 90 91
set(grpc_server_files
        ${grpc_request_files}
        ${grpc_impl_files}
Z
Zhiru Zhu 已提交
92
        ${grpc_interceptor_files}
G
groot 已提交
93 94
        )

B
BossZou 已提交
95 96 97 98
aux_source_directory(${MILVUS_ENGINE_SRC}/server/web_impl/handler web_handler_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/server/web_impl/component web_conponent_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/server/web_impl/controller web_controller_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/server/web_impl/dto web_dto_files)
99
aux_source_directory(${MILVUS_ENGINE_SRC}/server/web_impl/utils web_utils_files)
B
BossZou 已提交
100 101 102 103 104 105
aux_source_directory(${MILVUS_ENGINE_SRC}/server/web_impl web_impl_files)
set(web_server_files
        ${web_handler_files}
        ${web_conponent_files}
        ${web_controller_files}
        ${web_dto_files}
106
        ${web_utils_files}
B
BossZou 已提交
107 108 109
        ${web_impl_files}
        )

C
Cai Yudong 已提交
110 111 112 113 114 115 116 117 118
aux_source_directory(${MILVUS_ENGINE_SRC}/storage storage_main_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/storage/file storage_file_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/storage/s3 storage_s3_files)
set(storage_files
        ${storage_main_files}
        ${storage_file_files}
        ${storage_s3_files}
        )

Z
update  
zhiru 已提交
119
aux_source_directory(${MILVUS_ENGINE_SRC}/utils utils_files)
Z
update  
zhiru 已提交
120
aux_source_directory(${MILVUS_ENGINE_SRC}/wrapper wrapper_files)
G
groot 已提交
121

Z
Zhiru Zhu 已提交
122 123
aux_source_directory(${MILVUS_ENGINE_SRC}/tracing tracing_files)

Z
update  
zhiru 已提交
124
set(engine_files
J
jinhai 已提交
125
        ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
G
groot 已提交
126
        ${cache_files}
S
starlord 已提交
127 128 129 130
        ${db_main_files}
        ${db_engine_files}
        ${db_insert_files}
        ${db_meta_files}
Y
yu yunfeng 已提交
131
        ${metrics_files}
C
Cai Yudong 已提交
132
        ${storage_files}
W
wxyu 已提交
133
        ${thirdparty_files}
134
        ${utils_files}
Z
update  
zhiru 已提交
135
        ${wrapper_files}
G
groot 已提交
136
        )
X
xj.lin 已提交
137

138 139 140 141 142
if (MILVUS_WITH_PROMETHEUS)
    set(engine_files ${engine_files}
            ${metrics_prometheus_files})
endif ()

Z
Zhiru Zhu 已提交
143
set(grpc_lib
S
starlord 已提交
144 145 146 147
        grpcpp_channelz
        grpc++
        grpc
        grpc_protobuf
Z
update  
zhiru 已提交
148 149
        grpc_protoc
        )
J
jinhai 已提交
150

Z
zhiru 已提交
151
set(prometheus_lib
Z
zhiru 已提交
152 153
        prometheus-cpp-push
        prometheus-cpp-pull
Z
update  
zhiru 已提交
154
        prometheus-cpp-core
155
        curl
Z
update  
zhiru 已提交
156
        )
Z
zhiru 已提交
157 158

set(boost_lib
159 160 161
        libboost_system.a
        libboost_filesystem.a
        libboost_serialization.a
Z
update  
zhiru 已提交
162
        )
Z
zhiru 已提交
163

C
Cai Yudong 已提交
164 165 166 167 168
set(s3_client_lib
        aws-cpp-sdk-s3
        aws-cpp-sdk-core
        )

Z
zhiru 已提交
169 170
set(third_party_libs
        sqlite
Z
Zhiru Zhu 已提交
171
        ${grpc_lib}
Z
zhiru 已提交
172
        yaml-cpp
Z
zhiru 已提交
173
        mysqlpp
Z
Zhiru Zhu 已提交
174
        zlib
175
        fiu
Z
Zhiru Zhu 已提交
176
        ${boost_lib}
C
Cai Yudong 已提交
177 178 179
        ${s3_client_lib}
        curl
        crypto
Z
zhiru 已提交
180
        )
S
starlord 已提交
181

Y
youny626 已提交
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
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 ()

199
if (MILVUS_ENABLE_PROFILING)
Y
yudong.cai 已提交
200
    set(third_party_libs ${third_party_libs}
Y
youny626 已提交
201 202 203
            gperftools
            libunwind
            )
Z
zhiru 已提交
204
endif ()
Y
yangwei.yao 已提交
205

206 207 208 209 210 211
if (MILVUS_WITH_PROMETHEUS)
    set(third_party_libs ${third_party_libs}
            ${prometheus_lib}
            )
endif ()

S
starlord 已提交
212 213 214 215
set(engine_libs
        pthread
        libgomp.a
        libgfortran.a
Y
youny626 已提交
216
        dl
S
starlord 已提交
217
        )
218 219

if (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
W
wxyu 已提交
220
    set(engine_libs
Z
zhiru 已提交
221 222 223
            ${engine_libs}
            libquadmath.a
            )
W
wxyu 已提交
224 225
endif ()

Y
youny626 已提交
226
add_library(milvus_engine STATIC ${engine_files})
S
starlord 已提交
227 228 229
target_link_libraries(milvus_engine
        knowhere
        ${third_party_libs}
Y
youny626 已提交
230
        ${engine_libs}
S
starlord 已提交
231
        )
G
groot 已提交
232

233 234 235 236 237
if (MILVUS_WITH_PROMETHEUS)
    add_library(metrics STATIC ${metrics_files} ${metrics_prometheus_files})
else ()
    add_library(metrics STATIC ${metrics_files})
endif ()
Y
yu yunfeng 已提交
238

Z
zhiru 已提交
239
set(metrics_lib
Z
zhiru 已提交
240
        yaml-cpp
Z
zhiru 已提交
241
        )
Y
yu yunfeng 已提交
242

243 244 245 246 247 248
if (MILVUS_WITH_PROMETHEUS)
    set(metrics_lib ${metrics_lib}
            ${prometheus_lib}
            )
endif ()

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

Z
Zhiru Zhu 已提交
251 252 253 254 255 256 257 258 259 260
add_library(tracing STATIC ${tracing_files} ${thirdparty_files})
set(tracing_lib
        opentracing
        opentracing_mocktracer
        ${grpc_lib}
        pthread
        z
        )
target_link_libraries(tracing ${tracing_lib})

G
groot 已提交
261
set(server_libs
G
groot 已提交
262
        milvus_engine
Y
yu yunfeng 已提交
263
        metrics
Z
Zhiru Zhu 已提交
264
        tracing
B
BossZou 已提交
265
        oatpp
G
groot 已提交
266
        )
G
groot 已提交
267

S
starlord 已提交
268 269
add_executable(milvus_server
        ${config_files}
Z
zhiru 已提交
270 271
        ${metrics_files}
        ${scheduler_files}
S
starlord 已提交
272
        ${server_files}
Z
zhiru 已提交
273
        ${grpc_server_files}
S
starlord 已提交
274
        ${grpc_service_files}
B
BossZou 已提交
275
        ${web_server_files}
Z
Zhiru Zhu 已提交
276
        ${server_context_files}
Z
zhiru 已提交
277
        ${utils_files}
Z
Zhiru Zhu 已提交
278
        ${tracing_files}
S
starlord 已提交
279
        )
Y
yu yunfeng 已提交
280

S
starlord 已提交
281 282 283
target_link_libraries(milvus_server
        ${server_libs}
        )
S
starlord 已提交
284 285 286

install(TARGETS milvus_server DESTINATION bin)

287 288 289 290
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
291 292 293
        ${CMAKE_BINARY_DIR}/fiu_ep-prefix/src/fiu_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}fiu${CMAKE_SHARED_LIBRARY_SUFFIX}
        ${CMAKE_BINARY_DIR}/fiu_ep-prefix/src/fiu_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}fiu${CMAKE_SHARED_LIBRARY_SUFFIX}.0
        ${CMAKE_BINARY_DIR}/fiu_ep-prefix/src/fiu_ep/lib/${CMAKE_SHARED_LIBRARY_PREFIX}fiu${CMAKE_SHARED_LIBRARY_SUFFIX}.1.00
Z
zhiru 已提交
294
        DESTINATION lib)