-
Notifications
You must be signed in to change notification settings - Fork 159
/
CMakeLists.txt
27 lines (19 loc) · 1.01 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
file(GLOB srcs *.cpp)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${Protobuf_INCLUDE_DIR})
set(Protobuf_IMPORT_DIRS ${BOLT_ROOT}/third_party/proto)
protobuf_generate_cpp(ONNX_PROTO_SRCS ONNX_PROTO_HDRS ${BOLT_ROOT}/third_party/proto/onnx.proto)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(../)
# shared library
add_library(${PROJECT_NAME}_onnx SHARED ${srcs} ${ONNX_PROTO_HDRS} ${ONNX_PROTO_SRCS})
target_link_libraries(${PROJECT_NAME}_onnx ${Protobuf_SHARED_LIBRARY})
link_model_spec(${PROJECT_NAME}_onnx)
# static library
add_library(${PROJECT_NAME}_onnx_static STATIC ${srcs} ${ONNX_PROTO_HDRS} ${ONNX_PROTO_SRCS})
set_target_properties(${PROJECT_NAME}_onnx_static PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_onnx")
set_target_properties(${PROJECT_NAME}_onnx PROPERTIES CLEAN_DIRECT_OUTPUT 1)
set_target_properties(${PROJECT_NAME}_onnx_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
install(TARGETS ${PROJECT_NAME}_onnx
RUNTIME DESTINATION lib
LIBRARY DESTINATION lib)