mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-22 22:01:08 +00:00
* Initial set of changes to start disabling code in the minimal build. Breaking changes into multiple PRs so they're more easily reviewed. Focus on InferenceSession, Model and Graph here. SessionState will be next. Needs to be integrated with de/serialization code before being testable so changes are all off by default. Changes are limited to - #ifdef'ing out code - moving some things around so there are fewer #ifdef statements - moving definition of some one-line methods into the header so we don't need to #ifdef out in a .cc as well - exclude some things in the cmake setup * Update session state and a few other places. The core code builds if ORT_MINIMAL_BUILD is specified.
41 lines
1.9 KiB
CMake
41 lines
1.9 KiB
CMake
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
# Licensed under the MIT License.
|
|
|
|
if (onnxruntime_MINIMAL_BUILD)
|
|
# we include a couple of files so a library is produced and we minimize other changes to the build setup.
|
|
# as the transformer base class will be unused it will be excluded from the final binary size
|
|
file(GLOB onnxruntime_optimizer_srcs CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_INCLUDE_DIR}/core/optimizer/graph_transformer.h"
|
|
"${ONNXRUNTIME_ROOT}/core/optimizer/graph_transformer.cc"
|
|
)
|
|
else()
|
|
file(GLOB onnxruntime_optimizer_srcs CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_INCLUDE_DIR}/core/optimizer/*.h"
|
|
"${ONNXRUNTIME_ROOT}/core/optimizer/*.h"
|
|
"${ONNXRUNTIME_ROOT}/core/optimizer/*.cc"
|
|
)
|
|
endif()
|
|
|
|
if (onnxruntime_ENABLE_TRAINING)
|
|
file(GLOB orttraining_optimizer_srcs CONFIGURE_DEPENDS
|
|
"${ORTTRAINING_SOURCE_DIR}/core/optimizer/*.h"
|
|
"${ORTTRAINING_SOURCE_DIR}/core/optimizer/*.cc"
|
|
)
|
|
set(onnxruntime_optimizer_srcs ${onnxruntime_optimizer_srcs} ${orttraining_optimizer_srcs})
|
|
endif()
|
|
|
|
source_group(TREE ${REPO_ROOT} FILES ${onnxruntime_optimizer_srcs})
|
|
|
|
add_library(onnxruntime_optimizer ${onnxruntime_optimizer_srcs})
|
|
|
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/optimizer DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core)
|
|
onnxruntime_add_include_to_target(onnxruntime_optimizer onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf)
|
|
if (MSVC AND NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
target_compile_options(onnxruntime_optimizer PRIVATE "/wd4244")
|
|
endif()
|
|
target_include_directories(onnxruntime_optimizer PRIVATE ${ONNXRUNTIME_ROOT})
|
|
if (onnxruntime_ENABLE_TRAINING)
|
|
target_include_directories(onnxruntime_optimizer PRIVATE ${ORTTRAINING_ROOT})
|
|
endif()
|
|
add_dependencies(onnxruntime_optimizer ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
set_target_properties(onnxruntime_optimizer PROPERTIES FOLDER "ONNXRuntime")
|