diff --git a/cmake/onnxruntime_test_pch.cmake b/cmake/onnxruntime_test_pch.cmake index f989774ade35b..4a8735a9c346c 100644 --- a/cmake/onnxruntime_test_pch.cmake +++ b/cmake/onnxruntime_test_pch.cmake @@ -5,9 +5,11 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") target_precompile_headers(onnxruntime_test_all PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/test_pch.h" ) - target_precompile_headers(onnxruntime_provider_test PRIVATE - "${CMAKE_CURRENT_SOURCE_DIR}/test_pch.h" - ) + if (TARGET onnxruntime_provider_test) + target_precompile_headers(onnxruntime_provider_test PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/test_pch.h" + ) + endif() endif() # Exclude certain files that might conflict with PCH diff --git a/onnxruntime/core/providers/cpu/ml/tree_ensemble_attribute.h b/onnxruntime/core/providers/cpu/ml/tree_ensemble_attribute.h index ca568e485da11..09db2e4c46245 100644 --- a/onnxruntime/core/providers/cpu/ml/tree_ensemble_attribute.h +++ b/onnxruntime/core/providers/cpu/ml/tree_ensemble_attribute.h @@ -134,11 +134,6 @@ struct TreeEnsembleAttributesV5 { for (auto i : nodes_modes_i) { nodes_modes.push_back(static_cast(i)); } -#else - // GetVectorAttrsOrDefault is not part of the minimal build. - // As a result, TreeEnsemble v5 cannot be available in this build. - ORT_THROW("TreeEnsemble(ai.onnx.ml==5) is not supported with the minimal build."); -#endif aggregate_function = info.GetAttrOrDefault("aggregate_function", 1); leaf_targetids = info.GetAttrsOrDefault("leaf_targetids"); @@ -151,6 +146,11 @@ struct TreeEnsembleAttributesV5 { nodes_truenodeids = info.GetAttrsOrDefault("nodes_truenodeids"); post_transform = info.GetAttrOrDefault("post_transform", 0); tree_roots = info.GetAttrsOrDefault("tree_roots"); +#else + // GetVectorAttrsOrDefault is not part of the minimal build. + // As a result, TreeEnsemble v5 cannot be available in this build. + ORT_THROW("TreeEnsemble(ai.onnx.ml==5) is not supported with the minimal build."); +#endif } void convert_to_v3(TreeEnsembleAttributesV3& output) const { diff --git a/onnxruntime/test/platform/device_discovery_test.cc b/onnxruntime/test/platform/device_discovery_test.cc index 6b43ccbc8f670..bd0110748b098 100644 --- a/onnxruntime/test/platform/device_discovery_test.cc +++ b/onnxruntime/test/platform/device_discovery_test.cc @@ -5,8 +5,8 @@ #include "gtest/gtest.h" +#if !defined(ORT_MINIMAL_BUILD) && !defined(_GAMING_XBOX) namespace onnxruntime::test { - namespace { std::vector GetDevicesByType(OrtHardwareDeviceType device_type) { @@ -31,3 +31,4 @@ TEST(DeviceDiscoveryTest, HasCpuDevice) { } } // namespace onnxruntime::test +#endif // !defined(ORT_MINIMAL_BUILD) && !defined(_GAMING_XBOX) diff --git a/onnxruntime/test/platform/file_io_test.cc b/onnxruntime/test/platform/file_io_test.cc index a1a863d2442d1..924f9da41abef 100644 --- a/onnxruntime/test/platform/file_io_test.cc +++ b/onnxruntime/test/platform/file_io_test.cc @@ -19,6 +19,7 @@ #include "gtest/gtest.h" #include "core/common/span_utils.h" +#include "test/util/include/asserts.h" #include "test/util/include/file_util.h" namespace onnxruntime { diff --git a/onnxruntime/test/providers/provider_test_utils.h b/onnxruntime/test/providers/provider_test_utils.h index 1d8a50dc2fa04..5bd9ee2ceb826 100644 --- a/onnxruntime/test/providers/provider_test_utils.h +++ b/onnxruntime/test/providers/provider_test_utils.h @@ -5,6 +5,10 @@ #include "test/unittest_util/checkers.h" #include "test/unittest_util/conversion.h" + +#if !defined(ORT_MINIMAL_BUILD) #include "test/unittest_util/model_tester.h" #include "test/unittest_util/op_tester.h" +#endif // !defined(ORT_MINIMAL_BUILD) + #include "test/unittest_util/run_options_config_keys.h"