CMakeLists.txt 6.0 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})
J
jinhai 已提交
22

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

S
starlord 已提交
27
#this statement must put here, since the CORE_INCLUDE_DIRS is defined in code/CMakeList.txt
S
starlord 已提交
28
add_subdirectory(index)
Z
zhiru 已提交
29
set(CORE_INCLUDE_DIRS ${CORE_INCLUDE_DIRS} PARENT_SCOPE)
Z
zhiru 已提交
30
foreach (dir ${CORE_INCLUDE_DIRS})
Z
zhiru 已提交
31
    include_directories(${dir})
Z
zhiru 已提交
32
endforeach ()
Z
zhiru 已提交
33

Z
update  
zhiru 已提交
34 35
aux_source_directory(${MILVUS_ENGINE_SRC}/cache cache_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/config config_files)
S
starlord 已提交
36
aux_source_directory(${MILVUS_ENGINE_SRC}/metrics metrics_files)
Z
update  
zhiru 已提交
37 38 39 40
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 已提交
41 42

set(grpc_service_files
Z
update  
zhiru 已提交
43 44 45 46
        ${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 已提交
47 48
        )

Z
update  
zhiru 已提交
49 50 51 52
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 已提交
53
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/optimizer scheduler_optimizer_files)
Z
update  
zhiru 已提交
54 55
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/resource scheduler_resource_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/task scheduler_task_files)
Z
zhiru 已提交
56
set(scheduler_files
Z
update  
zhiru 已提交
57
        ${scheduler_main_files}
W
wxyu 已提交
58 59
        ${scheduler_action_files}
        ${scheduler_event_files}
W
wxyu 已提交
60
        ${scheduler_job_files}
W
wxyu 已提交
61
        ${scheduler_optimizer_files}
W
wxyu 已提交
62 63 64 65
        ${scheduler_resource_files}
        ${scheduler_task_files}
        )

Z
update  
zhiru 已提交
66 67 68
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 已提交
69
aux_source_directory(${MILVUS_ENGINE_SRC}/wrapper wrapper_files)
G
groot 已提交
70

Z
update  
zhiru 已提交
71
set(engine_files
J
jinhai 已提交
72
        ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
G
groot 已提交
73
        ${cache_files}
S
starlord 已提交
74 75 76 77
        ${db_main_files}
        ${db_engine_files}
        ${db_insert_files}
        ${db_meta_files}
Y
yu yunfeng 已提交
78
        ${metrics_files}
79
        ${utils_files}
Z
update  
zhiru 已提交
80
        ${wrapper_files}
G
groot 已提交
81
        )
X
xj.lin 已提交
82

S
starlord 已提交
83 84 85 86 87
set(client_grpc_lib
        grpcpp_channelz
        grpc++
        grpc
        grpc_protobuf
Z
update  
zhiru 已提交
88 89
        grpc_protoc
        )
J
jinhai 已提交
90

Z
zhiru 已提交
91
set(prometheus_lib
Z
zhiru 已提交
92 93
        prometheus-cpp-push
        prometheus-cpp-pull
Z
update  
zhiru 已提交
94 95
        prometheus-cpp-core
        )
Z
zhiru 已提交
96 97

set(boost_lib
G
groot 已提交
98 99
        boost_system_static
        boost_filesystem_static
Z
update  
zhiru 已提交
100 101
        boost_serialization_static
        )
Z
zhiru 已提交
102

S
starlord 已提交
103 104 105 106 107 108
set(cuda_lib
        ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
        cudart
        cublas
        )

Z
zhiru 已提交
109 110 111 112 113 114
set(third_party_libs
        sqlite
        ${client_grpc_lib}
        yaml-cpp
        ${prometheus_lib}
        ${boost_lib}
G
groot 已提交
115 116
        bzip2
        lz4
Z
zhiru 已提交
117 118 119
        snappy
        zlib
        zstd
S
starlord 已提交
120
        ${cuda_lib}
Z
zhiru 已提交
121
        mysqlpp
Z
zhiru 已提交
122
        )
S
starlord 已提交
123

Y
yudong.cai 已提交
124 125
if (MILVUS_ENABLE_PROFILING STREQUAL "ON")
    set(third_party_libs ${third_party_libs}
S
starlord 已提交
126 127 128
        gperftools
        libunwind
        )
Z
zhiru 已提交
129
endif ()
Y
yangwei.yao 已提交
130

S
starlord 已提交
131 132 133 134 135 136
link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64")
set(engine_libs
        pthread
        libgomp.a
        libgfortran.a
        )
137 138

if (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
W
wxyu 已提交
139
    set(engine_libs
Z
zhiru 已提交
140 141 142
            ${engine_libs}
            libquadmath.a
            )
W
wxyu 已提交
143 144
endif ()

Z
update  
zhiru 已提交
145
cuda_add_library(milvus_engine STATIC ${engine_files})
S
starlord 已提交
146 147 148 149 150
target_link_libraries(milvus_engine
        knowhere
        ${engine_libs}
        ${third_party_libs}
        )
G
groot 已提交
151

Y
yu yunfeng 已提交
152 153
add_library(metrics STATIC ${metrics_files})

Z
zhiru 已提交
154
set(metrics_lib
Z
zhiru 已提交
155
        yaml-cpp
Z
zhiru 已提交
156
        ${prometheus_lib}
Z
zhiru 已提交
157
        )
Y
yu yunfeng 已提交
158

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

G
groot 已提交
161
set(server_libs
G
groot 已提交
162
        milvus_engine
G
groot 已提交
163
        pthread
X
xj.lin 已提交
164
        dl
Y
yu yunfeng 已提交
165
        metrics
G
groot 已提交
166
        )
G
groot 已提交
167

S
starlord 已提交
168 169
add_executable(milvus_server
        ${config_files}
Z
zhiru 已提交
170 171
        ${metrics_files}
        ${scheduler_files}
S
starlord 已提交
172
        ${server_files}
Z
zhiru 已提交
173
        ${grpc_server_files}
S
starlord 已提交
174
        ${grpc_service_files}
Z
zhiru 已提交
175
        ${utils_files}
S
starlord 已提交
176
        )
Y
yu yunfeng 已提交
177

S
starlord 已提交
178 179 180
target_link_libraries(milvus_server
        ${server_libs}
        )
S
starlord 已提交
181 182 183

install(TARGETS milvus_server DESTINATION bin)

184
install(FILES
S
starlord 已提交
185 186
        ${CMAKE_SOURCE_DIR}/src/index/thirdparty/tbb/${CMAKE_SHARED_LIBRARY_PREFIX}tbb${CMAKE_SHARED_LIBRARY_SUFFIX}
        ${CMAKE_SOURCE_DIR}/src/index/thirdparty/tbb/${CMAKE_SHARED_LIBRARY_PREFIX}tbb${CMAKE_SHARED_LIBRARY_SUFFIX}.2
187 188 189
        ${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 已提交
190
        DESTINATION lib)
Z
update  
zhiru 已提交
191

S
starlord 已提交
192
add_subdirectory(sdk)