CMakeLists.txt 6.1 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 INDEX_INCLUDE_DIRS is defined in code/CMakeList.txt
S
starlord 已提交
28
add_subdirectory(index)
Q
quicksilver 已提交
29

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

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

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

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

W
wxyu 已提交
67 68 69 70 71 72 73
aux_source_directory(${MILVUS_ENGINE_SRC}/external/easyloggingpp external_easyloggingpp_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/external/nlohmann external_nlohmann_files)
set(external_files
        ${external_easyloggingpp_files}
        ${external_nlohmann_files}
        )

Z
update  
zhiru 已提交
74 75 76
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 已提交
77
aux_source_directory(${MILVUS_ENGINE_SRC}/wrapper wrapper_files)
G
groot 已提交
78

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

S
starlord 已提交
92 93 94 95 96
set(client_grpc_lib
        grpcpp_channelz
        grpc++
        grpc
        grpc_protobuf
Z
update  
zhiru 已提交
97 98
        grpc_protoc
        )
J
jinhai 已提交
99

Z
zhiru 已提交
100
set(prometheus_lib
Z
zhiru 已提交
101 102
        prometheus-cpp-push
        prometheus-cpp-pull
Z
update  
zhiru 已提交
103 104
        prometheus-cpp-core
        )
Z
zhiru 已提交
105 106

set(boost_lib
107 108 109
        libboost_system.a
        libboost_filesystem.a
        libboost_serialization.a
Z
update  
zhiru 已提交
110
        )
Z
zhiru 已提交
111

S
starlord 已提交
112 113 114 115 116 117
set(cuda_lib
        ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs/libnvidia-ml.so
        cudart
        cublas
        )

Z
zhiru 已提交
118 119 120 121 122
set(third_party_libs
        sqlite
        ${client_grpc_lib}
        yaml-cpp
        ${prometheus_lib}
S
starlord 已提交
123
        ${cuda_lib}
Z
zhiru 已提交
124
        mysqlpp
Z
Zhiru Zhu 已提交
125 126
        zlib
        ${boost_lib}
Z
zhiru 已提交
127
        )
S
starlord 已提交
128

Y
yudong.cai 已提交
129 130
if (MILVUS_ENABLE_PROFILING STREQUAL "ON")
    set(third_party_libs ${third_party_libs}
S
starlord 已提交
131 132 133
        gperftools
        libunwind
        )
Z
zhiru 已提交
134
endif ()
Y
yangwei.yao 已提交
135

S
starlord 已提交
136 137 138 139 140 141
link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64")
set(engine_libs
        pthread
        libgomp.a
        libgfortran.a
        )
142 143

if (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
W
wxyu 已提交
144
    set(engine_libs
Z
zhiru 已提交
145 146 147
            ${engine_libs}
            libquadmath.a
            )
W
wxyu 已提交
148 149
endif ()

Z
update  
zhiru 已提交
150
cuda_add_library(milvus_engine STATIC ${engine_files})
S
starlord 已提交
151 152 153 154 155
target_link_libraries(milvus_engine
        knowhere
        ${engine_libs}
        ${third_party_libs}
        )
G
groot 已提交
156

Y
yu yunfeng 已提交
157 158
add_library(metrics STATIC ${metrics_files})

Z
zhiru 已提交
159
set(metrics_lib
Z
zhiru 已提交
160
        yaml-cpp
Z
zhiru 已提交
161
        ${prometheus_lib}
Z
zhiru 已提交
162
        )
Y
yu yunfeng 已提交
163

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

G
groot 已提交
166
set(server_libs
G
groot 已提交
167
        milvus_engine
G
groot 已提交
168
        pthread
X
xj.lin 已提交
169
        dl
Y
yu yunfeng 已提交
170
        metrics
G
groot 已提交
171
        )
G
groot 已提交
172

S
starlord 已提交
173 174
add_executable(milvus_server
        ${config_files}
Z
zhiru 已提交
175 176
        ${metrics_files}
        ${scheduler_files}
S
starlord 已提交
177
        ${server_files}
Z
zhiru 已提交
178
        ${grpc_server_files}
S
starlord 已提交
179
        ${grpc_service_files}
Z
zhiru 已提交
180
        ${utils_files}
S
starlord 已提交
181
        )
Y
yu yunfeng 已提交
182

S
starlord 已提交
183 184 185
target_link_libraries(milvus_server
        ${server_libs}
        )
S
starlord 已提交
186 187 188

install(TARGETS milvus_server DESTINATION bin)

189 190 191 192
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 已提交
193
        DESTINATION lib)
Z
update  
zhiru 已提交
194

S
starlord 已提交
195
add_subdirectory(sdk)