-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
51 lines (36 loc) · 1.54 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
cmake_minimum_required(VERSION 3.14)
set(CMAKE_DEBUG_POSTFIX d)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -pthread")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project(onnx-mlir-grpc-serving)
# cmake -DCMAKE_BUILD_TYPE=Release -DONNX_COMPILER_DIR:STRING=/aivol/mlperf/AIU_bk/onnx-mlir-build -DCMAKE_PREFIX_PATH=/aivol/grpc_install ..
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
message("-- CMAKE_HOST_SYSTEM_PROCESSOR: ${CMAKE_HOST_SYSTEM_PROCESSOR}")
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "s390x" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBIGENDIAN=1")
ELSE()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBIGENDIAN=0")
ENDIF()
add_subdirectory(utils ${CMAKE_CURRENT_BINARY_DIR}/utils)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# For onnx-mlir
find_library(CRuntime
NAMES cruntime
PATHS ${ONNX_COMPILER_DIR}/lib)
message(STATUS "CRuntime: ${CRuntime}")
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
add_executable(grpc_server "grpc_server/grpc_server.cc" "grpc_server/thread_pool.cc" "grpc_server/model_loader.cc")
target_link_libraries(grpc_server
${CRuntime}
hw_grpc_proto
${_REFLECTION}
${_GRPC_GRPCPP}
)
target_include_directories(grpc_server PRIVATE
${ONNX_COMPILER_DIR}/include)
add_subdirectory(tests ${CMAKE_CURRENT_BINARY_DIR}/tests EXCLUDE_FROM_ALL)
add_subdirectory(example_client/cpp ${CMAKE_CURRENT_BINARY_DIR}/cpp)
add_subdirectory(example_client/python ${CMAKE_CURRENT_BINARY_DIR}/python)