mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-12 17:57:38 +00:00
* fix build - python.h not found * disable --build_shared_lib for ortmodule tests * fix * fix the build flag * disable --build_shared_lib for training path (not only for ortmodule) * fix missing test model files * disable test CApiTest.test_custom_op_library when ENABLE_TRAINING_TORCH_INTEROP is ON * enable custom_op_library build * fix build * fix * merge master and fix build failure * build onnx_test_runner when onnxruntime_ENABLE_TRAINING_TORCH_INTEROP is ON * resolve comments * use --enable_training_torch_interop to replace "onnxruntime_ENABLE_TRAINING_TORCH_INTEROP=ON"
45 lines
2.1 KiB
CMake
45 lines
2.1 KiB
CMake
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
# Licensed under the MIT License.
|
|
|
|
file(GLOB onnxruntime_session_srcs CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_INCLUDE_DIR}/core/session/*.h"
|
|
"${ONNXRUNTIME_ROOT}/core/session/*.h"
|
|
"${ONNXRUNTIME_ROOT}/core/session/*.cc"
|
|
)
|
|
|
|
if (onnxruntime_MINIMAL_BUILD)
|
|
set(onnxruntime_session_src_exclude
|
|
"${ONNXRUNTIME_ROOT}/core/session/provider_bridge_ort.cc"
|
|
)
|
|
|
|
list(REMOVE_ITEM onnxruntime_session_srcs ${onnxruntime_session_src_exclude})
|
|
endif()
|
|
|
|
source_group(TREE ${REPO_ROOT} FILES ${onnxruntime_session_srcs})
|
|
|
|
onnxruntime_add_static_library(onnxruntime_session ${onnxruntime_session_srcs})
|
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/session DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core)
|
|
onnxruntime_add_include_to_target(onnxruntime_session onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)
|
|
if(onnxruntime_ENABLE_INSTRUMENT)
|
|
target_compile_definitions(onnxruntime_session PUBLIC ONNXRUNTIME_ENABLE_INSTRUMENT)
|
|
endif()
|
|
|
|
if(NOT MSVC)
|
|
set_source_files_properties(${ONNXRUNTIME_ROOT}/core/session/environment.cc PROPERTIES COMPILE_FLAGS "-Wno-parentheses")
|
|
endif()
|
|
target_include_directories(onnxruntime_session PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS})
|
|
target_link_libraries(onnxruntime_session PRIVATE nlohmann_json::nlohmann_json)
|
|
if(onnxruntime_ENABLE_EXTENSION_CUSTOM_OPS)
|
|
target_link_libraries(onnxruntime_session PRIVATE ortcustomops)
|
|
endif()
|
|
add_dependencies(onnxruntime_session ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
set_target_properties(onnxruntime_session PROPERTIES FOLDER "ONNXRuntime")
|
|
if (onnxruntime_USE_CUDA)
|
|
target_include_directories(onnxruntime_session PRIVATE ${onnxruntime_CUDNN_HOME}/include ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
|
|
endif()
|
|
if (onnxruntime_ENABLE_TRAINING OR onnxruntime_ENABLE_TRAINING_OPS)
|
|
target_include_directories(onnxruntime_session PRIVATE ${ORTTRAINING_ROOT})
|
|
endif()
|
|
if (onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
|
|
onnxruntime_add_include_to_target(onnxruntime_session Python::Module)
|
|
endif()
|