-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
61 lines (52 loc) · 1.55 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
cmake_minimum_required(VERSION 3.10)
project(onnxruntime_server LANGUAGES C CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if (APPLE AND NOT DEFINED CMAKE_CXX_STANDARD)
message("CMAKE_CXX_STANDARD was undefined, defaulting to C++14.")
set(CMAKE_CXX_STANDARD 14)
endif ()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_subdirectory(./third_party/fmt EXCLUDE_FROM_ALL)
add_subdirectory(proto) # builds inference_grpc_proto library
find_package(Threads REQUIRED)
find_package(Protobuf CONFIG REQUIRED)
find_package(gRPC CONFIG REQUIRED)
find_package(ONNXRuntime REQUIRED)
message(STATUS "Using protobuf ${Protobuf_VERSION}")
message(STATUS "Using gRPC ${gRPC_VERSION}")
include_directories(
"${ONNXRuntime_INCLUDE_DIR}"
)
add_library(onnxruntime_serving
serving.cc
serving.h
)
target_link_libraries(onnxruntime_serving
inference_grpc_proto
fmt::fmt-header-only
protobuf::libprotobuf
gRPC::grpc
gRPC::grpc++
gRPC::grpc++_reflection
${ONNXRuntime_LIBRARIES}
)
set(SOURCES
onnxruntime_server.cc
)
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})
add_executable(onnxruntime_server ${SOURCES})
target_link_libraries(onnxruntime_server
inference_grpc_proto
onnxruntime_serving
absl::base
absl::flags
absl::flags_parse
absl::strings
fmt::fmt-header-only
protobuf::libprotobuf
gRPC::grpc
gRPC::grpc++
gRPC::grpc++_reflection
${ONNXRuntime_LIBRARIES}
)