From c1ecc364d9799f3cbb99c769b9369f671d0b9e26 Mon Sep 17 00:00:00 2001 From: ajindal1 Date: Thu, 16 Sep 2021 18:45:36 +0000 Subject: [PATCH] removing warnings which are causing errors from torch and changing flags for Windows --- cmake/CMakeLists.txt | 4 ++++ cmake/onnxruntime_python.cmake | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 884284962f..8d43f32006 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1742,6 +1742,10 @@ foreach(target_name ${ONNXRUNTIME_TARGETS}) include(${target_name}.cmake) endforeach() +if(MSVC AND onnxruntime_ENABLE_EAGER_MODE) + target_compile_options(onnxruntime_eager PUBLIC "/wd4100" "/wd4324" "/wd4458" "/wd4127" "/wd4193" "/wd4624" "/wd4702") +endif() + if (CMAKE_SYSTEM_NAME STREQUAL "Android") list(APPEND onnxruntime_EXTERNAL_LIBRARIES log) endif() diff --git a/cmake/onnxruntime_python.cmake b/cmake/onnxruntime_python.cmake index ccdd86ca96..c354d424c2 100644 --- a/cmake/onnxruntime_python.cmake +++ b/cmake/onnxruntime_python.cmake @@ -108,10 +108,12 @@ if (onnxruntime_ENABLE_EAGER_MODE) target_link_libraries(onnxruntime_pybind11_state PRIVATE onnxruntime_eager ${TORCH_LIBRARIES} ${TORCH_PYTHON_LIBRARY}) # the ort_aten.g.cpp is generated from tools. currently it has some limitations. # todo: fix this - set_source_files_properties("${ORTTRAINING_ROOT}/orttraining/eager/ort_aten.g.cpp" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter) - set_source_files_properties("${ORTTRAINING_ROOT}/orttraining/eager/ort_aten.cpp" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter) - set_source_files_properties("${ORTTRAINING_ROOT}/orttraining/eager/ort_guard.cpp" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter) - set_source_files_properties("${ORTTRAINING_ROOT}/orttraining/eager/ort_tensor.cpp" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter) + if (NOT MSVC) + set_source_files_properties("${ORTTRAINING_ROOT}/orttraining/eager/ort_aten.g.cpp" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter) + set_source_files_properties("${ORTTRAINING_ROOT}/orttraining/eager/ort_aten.cpp" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter) + set_source_files_properties("${ORTTRAINING_ROOT}/orttraining/eager/ort_guard.cpp" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter) + set_source_files_properties("${ORTTRAINING_ROOT}/orttraining/eager/ort_tensor.cpp" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter) + endif() endif() target_link_libraries(onnxruntime_pybind11_state PRIVATE