onnxruntime/cmake/onnxruntime_opschema_lib.cmake
Changming Sun 0510688411
Update compliance tasks in python packaging pipeline and fix some compile warnings (#8471)
1. Update SDLNativeRules from v2 to v3. The new one allows us setting excluded paths.
2. Update TSAUpload from v1 to v2. And add a config file ".gdn/.gdntsa" for it.
3. Fix some parentheses warnings
4. Update cmake to the latest.
5. Remove "--x86" build option from pipeline yaml files. Now we can auto-detect cpu architecture from python. So we don't need to ask user to specify it.
2021-07-30 17:16:37 -07:00

36 lines
1.6 KiB
CMake

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# Schema library (for contrib ops and training ops)
set (CONTRIB_OPS_DIR ${ONNXRUNTIME_ROOT}/core/graph/contrib_ops)
set (TRAINING_OPS_DIR ${ORTTRAINING_ROOT}/orttraining/core/graph)
file(GLOB_RECURSE contrib_ops_schema_src
"${CONTRIB_OPS_DIR}/*.cc"
"${TRAINING_OPS_DIR}/training_op_defs.cc"
)
# The nchwc op schemas are platform-specific and not currently required.
list(REMOVE_ITEM contrib_ops_schema_src ${CONTRIB_OPS_DIR}/nchwc_schema_defs.cc)
# Use of ORT_ENFORCE introduces a dependency on GetStackTrace.
# Currently, we just use an empty implementation to avoid bringing in other dependencies.
if(WIN32)
list(APPEND contrib_ops_schema_src "${ONNXRUNTIME_ROOT}/core/platform/windows/stacktrace.cc")
else()
list(APPEND contrib_ops_schema_src "${ONNXRUNTIME_ROOT}/core/platform/posix/stacktrace.cc")
endif()
onnxruntime_add_static_library(ort_opschema_lib ${contrib_ops_schema_src})
target_compile_options(ort_opschema_lib PRIVATE -D_OPSCHEMA_LIB_=1)
if(NOT MSVC)
target_compile_options(ort_opschema_lib PRIVATE "-Wno-parentheses")
endif()
set (OPSCHEMA_LIB_DEPENDENCIES onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)
# ${CMAKE_CURRENT_BINARY_DIR} is so that #include "onnxruntime_config.h" is found
target_include_directories(ort_opschema_lib PRIVATE ${ONNXRUNTIME_ROOT} ${ORTTRAINING_ROOT} ${CMAKE_CURRENT_BINARY_DIR})
onnxruntime_add_include_to_target(ort_opschema_lib onnxruntime_common onnx onnx_proto protobuf::libprotobuf flatbuffers)
add_dependencies(ort_opschema_lib ${OPSCHEMA_LIB_DEPENDENCIES})