CMakeLists.txt 5.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})
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)
Q
quicksilver 已提交
29

Z
zhiru 已提交
30
set(CORE_INCLUDE_DIRS ${CORE_INCLUDE_DIRS} PARENT_SCOPE)
Z
zhiru 已提交
31
foreach (dir ${CORE_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}
        )

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

install(TARGETS milvus_server DESTINATION bin)

185 186 187 188
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 已提交
189
        DESTINATION lib)
Z
update  
zhiru 已提交
190

S
starlord 已提交
191
add_subdirectory(sdk)