@@ -7,8 +7,26 @@ file(GLOB_RECURSE onnxruntime_graph_src CONFIGURE_DEPENDS
77 "${ONNXRUNTIME_ROOT} /core/graph/*.cc"
88 )
99
10- # create empty list for any excludes
10+ # start with empty training srcs list
11+ set (orttraining_graph_src)
12+
13+ if (onnxruntime_ENABLE_TRAINING_OPS AND NOT onnxruntime_ENABLE_TRAINING)
14+ set (orttraining_graph_src
15+ "${ORTTRAINING_SOURCE_DIR} /core/graph/training_op_defs.cc"
16+ "${ORTTRAINING_SOURCE_DIR} /core/graph/training_op_defs.h"
17+ )
18+ endif ()
19+
20+ if (onnxruntime_ENABLE_TRAINING)
21+ file (GLOB_RECURSE orttraining_graph_src CONFIGURE_DEPENDS
22+ "${ORTTRAINING_SOURCE_DIR} /core/graph/*.h"
23+ "${ORTTRAINING_SOURCE_DIR} /core/graph/*.cc"
24+ )
25+ endif ()
26+
27+ # create empty lists for any excludes
1128set (onnxruntime_graph_src_exclude_patterns)
29+ set (orttraining_graph_src_exclude_patterns)
1230
1331if (onnxruntime_MINIMAL_BUILD)
1432 # remove schema registration support
@@ -22,11 +40,18 @@ if (onnxruntime_MINIMAL_BUILD)
2240 "${ONNXRUNTIME_ROOT} /core/graph/contrib_ops/onnx_function_util.cc"
2341 "${ONNXRUNTIME_ROOT} /core/graph/contrib_ops/shape_inference_functions.h"
2442 "${ONNXRUNTIME_ROOT} /core/graph/contrib_ops/shape_inference_functions.cc"
43+ "${ONNXRUNTIME_ROOT} /core/graph/dml_ops/dml_defs.h"
44+ "${ONNXRUNTIME_ROOT} /core/graph/dml_ops/dml_defs.cc"
2545 "${ONNXRUNTIME_ROOT} /core/graph/function_template.h"
2646 "${ONNXRUNTIME_ROOT} /core/graph/function_utils.h"
2747 "${ONNXRUNTIME_ROOT} /core/graph/function_utils.cc"
2848 )
2949
50+ list (APPEND orttraining_graph_src_exclude_patterns
51+ "${ORTTRAINING_SOURCE_DIR} /core/graph/training_op_defs.h"
52+ "${ORTTRAINING_SOURCE_DIR} /core/graph/training_op_defs.cc"
53+ )
54+
3055 # no Function support initially
3156 list (APPEND onnxruntime_graph_src_exclude_patterns
3257 "${ONNXRUNTIME_ROOT} /core/graph/function*"
@@ -64,30 +89,12 @@ endif()
6489file (GLOB onnxruntime_graph_src_exclude ${onnxruntime_graph_src_exclude_patterns} )
6590list (REMOVE_ITEM onnxruntime_graph_src ${onnxruntime_graph_src_exclude} )
6691
67- file (GLOB_RECURSE onnxruntime_ir_defs_src CONFIGURE_DEPENDS
68- "${ONNXRUNTIME_ROOT} /core/defs/*.cc"
69- )
70-
71- if (onnxruntime_ENABLE_TRAINING_OPS AND NOT onnxruntime_ENABLE_TRAINING)
72- set (orttraining_graph_src
73- "${ORTTRAINING_SOURCE_DIR} /core/graph/training_op_defs.cc"
74- "${ORTTRAINING_SOURCE_DIR} /core/graph/training_op_defs.h"
75- )
76- endif ()
77-
78- if (onnxruntime_ENABLE_TRAINING)
79- file (GLOB_RECURSE orttraining_graph_src CONFIGURE_DEPENDS
80- "${ORTTRAINING_SOURCE_DIR} /core/graph/*.h"
81- "${ORTTRAINING_SOURCE_DIR} /core/graph/*.cc"
82- )
83- endif ()
84-
85- set (onnxruntime_graph_lib_src ${onnxruntime_graph_src} ${onnxruntime_ir_defs_src} )
8692if (onnxruntime_ENABLE_TRAINING_OPS)
87- list (APPEND onnxruntime_graph_lib_src ${orttraining_graph_src} )
93+ file (GLOB orttraining_graph_src_exclude ${orttraining_graph_src_exclude_patterns} )
94+ list (REMOVE_ITEM orttraining_graph_src ${orttraining_graph_src_exclude} )
8895endif ()
8996
90- onnxruntime_add_static_library(onnxruntime_graph ${onnxruntime_graph_lib_src } )
97+ onnxruntime_add_static_library(onnxruntime_graph ${onnxruntime_graph_src} ${orttraining_graph_src } )
9198add_dependencies (onnxruntime_graph onnx_proto flatbuffers::flatbuffers)
9299onnxruntime_add_include_to_target(onnxruntime_graph onnxruntime_common ${WIL_TARGET} onnx onnx_proto ${PROTOBUF_LIB} flatbuffers::flatbuffers safeint_interface Boost::mp11)
93100
@@ -120,7 +127,7 @@ endif()
120127
121128set_target_properties (onnxruntime_graph PROPERTIES FOLDER "ONNXRuntime" )
122129set_target_properties (onnxruntime_graph PROPERTIES LINKER_LANGUAGE CXX)
123- source_group (TREE ${REPO_ROOT} FILES ${onnxruntime_graph_src} ${onnxruntime_ir_defs_src} )
130+ source_group (TREE ${REPO_ROOT} FILES ${onnxruntime_graph_src} )
124131if (onnxruntime_ENABLE_TRAINING_OPS)
125132 source_group (TREE ${ORTTRAINING_ROOT} FILES ${orttraining_graph_src} )
126133endif ()
0 commit comments