Merge branch 'windowsai' of https://github.com/Microsoft/onnxruntime into windowsai

This commit is contained in:
Ryan Lai 2020-01-16 10:34:08 -08:00
commit ebf7047aeb
6 changed files with 24 additions and 14 deletions

View file

@ -442,15 +442,15 @@ endif(onnxruntime_USE_DML)
# The default libraries to link with in Windows are kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib
# Remove them and use the onecore umbrella library instead
set(CMAKE_C_STANDARD_LIBRARIES "onecoreuap_apiset.lib")
set(CMAKE_CXX_STANDARD_LIBRARIES "onecoreuap_apiset.lib")
foreach(default_lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdgl32.lib advapi32.lib)
set(removed_libs "${removed_libs} /NODEFAULTLIB:${default_lib}")
endforeach()
set(CMAKE_C_STANDARD_LIBRARIES "${removed_libs} onecoreuap.lib")
set(CMAKE_CXX_STANDARD_LIBRARIES "${removed_libs} onecoreuap.lib")
set_target_properties(winml_dll
PROPERTIES
LINK_FLAGS
"/DEF:${WINML_DIR}/windows.ai.machinelearning.def ${os_component_link_flags} /DELAYLOAD:d3d12.dll /DELAYLOAD:d3d11.dll /DELAYLOAD:dxgi.dll ${delayload_dml} ${removed_libs}")
"/DEF:${WINML_DIR}/windows.ai.machinelearning.def ${os_component_link_flags} /DELAYLOAD:d3d12.dll /DELAYLOAD:d3d11.dll /DELAYLOAD:dxgi.dll ${delayload_dml}")
set_target_properties(winml_dll

View file

@ -44,7 +44,7 @@ function(add_winml_test)
if (_UT_DEPENDS)
add_dependencies(${_UT_TARGET} ${_UT_DEPENDS})
endif()
target_link_libraries(${_UT_TARGET} PRIVATE ${_UT_LIBS} gtest windowsapp winml_lib_image ${onnxruntime_EXTERNAL_LIBRARIES} winml_lib_telemetry winml_lib_api onnxruntime)
target_link_libraries(${_UT_TARGET} PRIVATE ${_UT_LIBS} gtest winml_lib_image ${onnxruntime_EXTERNAL_LIBRARIES} winml_lib_telemetry winml_lib_api onnxruntime)
add_test(NAME ${_UT_TARGET}
COMMAND ${_UT_TARGET}
@ -81,7 +81,7 @@ endif()
add_winml_test(
TARGET winml_test_scenario
SOURCES ${winml_test_scenario_src}
LIBS winml_test_common ${winml_test_scenario_libs}
LIBS winml_test_common delayimp.lib ${winml_test_scenario_libs}
)
target_precompiled_header(winml_test_scenario testPch.h)
target_compile_definitions(winml_test_scenario PRIVATE BUILD_GOOGLE_TEST)

View file

@ -417,4 +417,4 @@ const LearningModelSesssionAPITestApi& getapi() {
CloseSession,
};
return api;
}
}

View file

@ -66,7 +66,7 @@
#ifndef USE_DML
#define GPUTEST \
WINML_SKIP_TEST("GPU tests disabled because this is a WinML only build (no DML)")
WINML_SUPRESS_UNREACHABLE_BELOW(WINML_SKIP_TEST("GPU tests disabled because this is a WinML only build (no DML)"))
#else
#define GPUTEST \
if (auto noGpuTests = RuntimeParameters::Parameters.find("noGPUtests"); \

View file

@ -23,10 +23,12 @@ using namespace WEX::TestExecution;
getapi().test_name(); \
}
#define WINML_SKIP_TEST(message) \
Log::Result(TestResults::Skipped, \
std::wstring_convert<std::codecvt_utf8<wchar_t>>().from_bytes(message).c_str()); \
return;
#define WINML_SKIP_TEST(message) \
do { \
Log::Result(TestResults::Skipped, \
std::wstring_convert<std::codecvt_utf8<wchar_t>>().from_bytes(message).c_str()); \
return; \
} while (0)
#define WINML_EXPECT_NO_THROW(statement) VERIFY_NO_THROW(statement)
#define WINML_EXPECT_TRUE(statement) VERIFY_IS_TRUE(statement)
@ -43,7 +45,7 @@ using namespace WEX::TestExecution;
#ifndef USE_DML
#define GPUTEST \
WINML_SKIP_TEST("GPU tests disabled because this is a WinML only build (no DML)")
WINML_SUPRESS_UNREACHABLE_BELOW(WINML_SKIP_TEST("GPU tests disabled because this is a WinML only build (no DML)"))
#else
#define GPUTEST \
bool noGPUTests; \
@ -58,4 +60,4 @@ using namespace WEX::TestExecution;
if (SUCCEEDED(RuntimeParameters::TryGetValue(L"EdgeCore", edgeCoreRun)) && edgeCoreRun) { \
WINML_SKIP_TEST("This test is disabled by the EdgeCore runtime parameter."); \
return; \
}
}

View file

@ -1,10 +1,18 @@
#pragma once
using VoidTest = void (*)();
using SetupTest = VoidTest;
constexpr bool alwaysTrue() {
return true;
}
#define WINML_SUPRESS_UNREACHABLE_BELOW(statement) \
if (alwaysTrue()) { statement; }
#ifdef BUILD_GOOGLE_TEST
#include "googleTestMacros.h"
#else
#ifdef BUILD_TAEF_TEST
#include "taefTestMacros.h"
#endif
#endif
#endif