From 7b003967b1c89b49a2fbda86f00efa0b5ea7e92e Mon Sep 17 00:00:00 2001 From: Changming Sun Date: Thu, 29 Apr 2021 11:54:57 -0700 Subject: [PATCH] Add static code analyzer to Windows CPU/GPU CI builds and fix the warnings (#7489) --- cmake/CMakeLists.txt | 392 +++++++++++------- cmake/external/pybind11.cmake | 2 +- cmake/onnxruntime.cmake | 18 +- cmake/onnxruntime_codegen.cmake | 2 +- cmake/onnxruntime_common.cmake | 2 +- cmake/onnxruntime_flatbuffers.cmake | 2 +- cmake/onnxruntime_framework.cmake | 2 +- cmake/onnxruntime_graph.cmake | 2 +- cmake/onnxruntime_java.cmake | 50 +-- cmake/onnxruntime_language_interop_ops.cmake | 2 +- cmake/onnxruntime_mlas.cmake | 2 +- cmake/onnxruntime_nodejs.cmake | 2 + cmake/onnxruntime_nuphar_extern.cmake | 2 +- cmake/onnxruntime_optimizer.cmake | 2 +- cmake/onnxruntime_providers.cmake | 58 +-- cmake/onnxruntime_pyop.cmake | 2 +- cmake/onnxruntime_python.cmake | 7 +- cmake/onnxruntime_session.cmake | 2 +- cmake/onnxruntime_training.cmake | 4 +- cmake/onnxruntime_unittests.cmake | 21 +- cmake/onnxruntime_util.cmake | 2 +- cmake/winml.cmake | 16 +- cmake/winml_unittests.cmake | 4 +- .../Microsoft.ML.OnnxRuntime.Tests/OnnxMl.cs | 18 +- .../OnnxMl.cs | 18 +- ...ai_onnxruntime_OrtSession_SessionOptions.c | 2 +- .../core/providers/cuda/tensor/where_impl.cu | 4 + onnxruntime/test/platform/threadpool_test.cc | 3 + .../azure-pipelines/mac-ios-ci-pipeline.yml | 4 +- .../azure-pipelines/win-ci-pipeline.yml | 258 ++++-------- .../azure-pipelines/win-gpu-ci-pipeline.yml | 124 +++++- 31 files changed, 532 insertions(+), 497 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index ac9c62fb6d..cc5b5cee4b 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -781,17 +781,234 @@ if(onnxruntime_USE_CUDA) endif() endif() +FILE(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} ORT_BINARY_DIR) +FILE(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} ORT_SOURCE_DIR) + + + +set(ORT_WARNING_FLAGS) +if (WIN32) + add_definitions(-DPLATFORM_WINDOWS -DNOGDI -DNOMINMAX -D_USE_MATH_DEFINES) + if(onnxruntime_ENABLE_MEMLEAK_CHECKER) + add_definitions(-DONNXRUNTIME_ENABLE_MEMLEAK_CHECK) + endif() + # parallel build + # These compiler opitions cannot be forwarded to NVCC, so cannot use add_compiler_options + string(APPEND CMAKE_CXX_FLAGS " /MP") + #Compiler bug, we should get such warnings. It will be fixed in a new VC release + list(APPEND ORT_WARNING_FLAGS "/wd4127") + # class needs to have dll-interface to be used by clients + list(APPEND ORT_WARNING_FLAGS "/wd4251") + # issued by thrust nonstandard extension used: nameless struct/union + list(APPEND ORT_WARNING_FLAGS "/wd4201") + list(APPEND ORT_WARNING_FLAGS "/wd6326") # potential comparison of a constant with another constant + if(onnxruntime_USE_OPENMP) + list(APPEND ORT_WARNING_FLAGS "/wd6993") # Code analysis ignores OpenMP constructs + endif() + + # Treat warning as error if onnxruntime_DEV_MODE is ON + # For cross-compiled ARM64 binaries, there are too many warnings to fix, hence ignore warnings for now + if (onnxruntime_DEV_MODE AND NOT CMAKE_CROSSCOMPILING) + # treat warnings as errors + list(APPEND ORT_WARNING_FLAGS "/WX") + foreach(type EXE STATIC SHARED) + set(CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS} /WX") + endforeach() + endif() + + # set linker flags to minimize the binary size. + if (MSVC) + foreach(type EXE STATIC SHARED) + if (NOT type MATCHES STATIC) + # The WinML internal toolchain does not allow link's "additional options" to contain optimization + # flags (/OPT#); these are already specified using msbuild properties. + if (NOT DEFINED onnxruntime_DISABLE_LINKER_OPT_FLAGS) + set(CMAKE_${type}_LINKER_FLAGS_RELEASE "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /OPT:REF,ICF,LBR") + set(CMAKE_${type}_LINKER_FLAGS_RELEASE "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /INCREMENTAL:NO") + set(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF,ICF,LBR") + set(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /INCREMENTAL:NO") + set(CMAKE_${type}_LINKER_FLAGS_MINSIZEREL "${CMAKE_${type}_LINKER_FLAGS_MINSIZEREL} /OPT:REF,ICF,LBR") + set(CMAKE_${type}_LINKER_FLAGS_MINSIZEREL "${CMAKE_${type}_LINKER_FLAGS_MINSIZEREL} /INCREMENTAL:NO") + endif() + endif() + if (onnxruntime_ENABLE_LTO AND NOT onnxruntime_USE_CUDA) + set(CMAKE_${type}_LINKER_FLAGS_RELEASE "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /LTCG") + set(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /LTCG") + set(CMAKE_${type}_LINKER_FLAGS_MINSIZEREL "${CMAKE_${type}_LINKER_FLAGS_MINSIZEREL} /LTCG") + endif() + endforeach() + endif() + +else() + add_definitions(-DPLATFORM_POSIX) + check_cxx_compiler_flag(-Wunused-but-set-variable HAS_UNUSED_BUT_SET_VARIABLE) + check_cxx_compiler_flag(-Wunused-parameter HAS_UNUSED_PARAMETER) + check_cxx_compiler_flag(-Wunused-variable HAS_UNUSED_VARIABLE) + check_cxx_compiler_flag(-Wcast-function-type HAS_CAST_FUNCTION_TYPE) + check_cxx_compiler_flag(-Wparentheses HAS_PARENTHESES) + check_cxx_compiler_flag(-Wuseless-cast HAS_USELESS_CAST) + check_cxx_compiler_flag(-Wnonnull-compare HAS_NONNULL_COMPARE) + check_cxx_compiler_flag(-Wtautological-pointer-compare HAS_TAUTOLOGICAL_POINTER_COMPARE) + check_cxx_compiler_flag(-Wcatch-value HAS_CATCH_VALUE) + check_cxx_compiler_flag(-Wmissing-braces HAS_MISSING_BRACES) + check_cxx_compiler_flag(-Wignored-attributes HAS_IGNORED_ATTRIBUTES) + check_cxx_compiler_flag(-Wdeprecated-copy HAS_DEPRECATED_COPY) + check_cxx_compiler_flag(-Wdeprecated-declarations HAS_DEPRECATED_DECLARATIONS) + check_cxx_compiler_flag(-Wclass-memaccess HAS_CLASS_MEMACCESS) + check_cxx_compiler_flag(-Wmaybe-uninitialized HAS_MAYBE_UNINITIALIZED) + check_cxx_compiler_flag(-Wstrict-aliasing HAS_STRICT_ALIASING) + + if(HAS_TAUTOLOGICAL_POINTER_COMPARE) + #we may have extra null pointer checkings in debug build, it's not an issue + list(APPEND ORT_WARNING_FLAGS -Wno-tautological-pointer-compare) + endif() + if(HAS_NONNULL_COMPARE) + #we may have extra null pointer checkings in debug build, it's not an issue + list(APPEND ORT_WARNING_FLAGS -Wno-nonnull-compare) + endif() + if(HAS_PARENTHESES) + list(APPEND ORT_WARNING_FLAGS -Wno-parentheses) + endif() +endif() + +#names in this var must match the directory names under onnxruntime/core/providers +#The list of legacy providers that have not been converted to dynamic loading +#But DNNL is an exception, it still needs be here. +set(ONNXRUNTIME_PROVIDER_NAMES cpu) + +set(ORT_PROVIDER_FLAGS) +set(ORT_PROVIDER_CMAKE_FLAGS) + +if (onnxruntime_USE_CUDA) + list(APPEND ORT_PROVIDER_FLAGS -DUSE_CUDA=1) + list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_CUDA=1) + list(APPEND ONNXRUNTIME_PROVIDER_NAMES cuda) +endif() +if (onnxruntime_USE_VITISAI) + list(APPEND ORT_PROVIDER_FLAGS -DUSE_VITISAI=1) + list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_VITISAI=1) + list(APPEND ONNXRUNTIME_PROVIDER_NAMES vitisai) +endif() +if (onnxruntime_USE_DNNL) + list(APPEND ORT_PROVIDER_FLAGS -DUSE_DNNL=1) + list(APPEND ONNXRUNTIME_PROVIDER_NAMES dnnl) + list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_DNNL=1) +endif() +if (onnxruntime_USE_OPENVINO) + list(APPEND ORT_PROVIDER_FLAGS -DUSE_OPENVINO=1) + list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_OPENVINO=1) +endif() +if (onnxruntime_USE_TENSORRT) + list(APPEND ORT_PROVIDER_FLAGS -DUSE_TENSORRT=1) + #TODO: remove the following line and change the test code in onnxruntime_shared_lib_test to use the new EP API. + list(APPEND ONNXRUNTIME_PROVIDER_NAMES tensorrt) + list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_TENSORRT=1) +endif() +if (onnxruntime_USE_RKNPU) + list(APPEND ORT_PROVIDER_FLAGS -DUSE_RKNPU=1) + list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_RKNPU=1) + list(APPEND ONNXRUNTIME_PROVIDER_NAMES rknpu) +endif() +if (onnxruntime_USE_NNAPI_BUILTIN) + list(APPEND ORT_PROVIDER_FLAGS -DUSE_NNAPI=1) + list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_NNAPI_BUILTIN=1) + list(APPEND ONNXRUNTIME_PROVIDER_NAMES nnapi) +endif() +if (onnxruntime_USE_NUPHAR) + list(APPEND ORT_PROVIDER_FLAGS -DUSE_NUPHAR=1) + list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_NUPHAR=1) + list(APPEND ONNXRUNTIME_PROVIDER_NAMES nuphar) +endif() +if(onnxruntime_USE_WINML) + list(APPEND ORT_PROVIDER_FLAGS -DUSE_WINML=1) + list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_WINML=1) + list(APPEND ONNXRUNTIME_PROVIDER_NAMES winml) +endif() +if (onnxruntime_USE_ACL) + list(APPEND ORT_PROVIDER_FLAGS -DUSE_ACL=1) + list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_ACL=1) + list(APPEND ONNXRUNTIME_PROVIDER_NAMES acl) +endif() +if (onnxruntime_USE_DML) + list(APPEND ORT_PROVIDER_FLAGS -DUSE_DML=1) + list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_DML=1) + list(APPEND ONNXRUNTIME_PROVIDER_NAMES dml) +endif() +if(onnxruntime_USE_MIGRAPHX) + list(APPEND ORT_PROVIDER_FLAGS -DUSE_MIGRAPHX=1) + list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_MIGRAPHX=1) + list(APPEND ONNXRUNTIME_PROVIDER_NAMES migraphx) +endif() + +if (onnxruntime_USE_ARMNN) + list(APPEND ORT_PROVIDER_FLAGS -DUSE_ARMNN=1) + list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_ARMNN=1) + list(APPEND ONNXRUNTIME_PROVIDER_NAMES armnn) +endif() +if (onnxruntime_USE_ROCM) + list(APPEND ORT_PROVIDER_FLAGS -DUSE_ROCM=1) + list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_ROCM=1) + list(APPEND ONNXRUNTIME_PROVIDER_NAMES rocm) +endif() +if (onnxruntime_USE_COREML) + list(APPEND ORT_PROVIDER_FLAGS -DUSE_COREML=1) + list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_COREML=1) + list(APPEND ONNXRUNTIME_PROVIDER_NAMES coreml) +endif() +function(onnxruntime_set_compile_flags target_name) + if (MSVC) + target_compile_options(${target_name} PRIVATE "$<$:SHELL:--compiler-options /utf-8>" "$<$>:/utf-8>") + target_compile_options(${target_name} PRIVATE "$<$:SHELL:--compiler-options /sdl>" "$<$>:/sdl>") + set_target_properties(${target_name} + PROPERTIES VS_GLOBAL_CAExcludePath "${ORT_BINARY_DIR};${ORT_SOURCE_DIR}") + if (onnxruntime_ENABLE_STATIC_ANALYSIS) + target_compile_options(${target_name} PRIVATE "$<$>:/analyze:stacksize 131072>") + endif() + else() + # Enable warning + target_compile_options(${target_name} PRIVATE "$<$:SHELL:--compiler-options -Wall>" "$<$>:-Wall>") + target_compile_options(${target_name} PRIVATE "$<$>:-Wextra>") + + if(onnxruntime_DEV_MODE) + target_compile_options(${target_name} PRIVATE "$<$:SHELL:--compiler-options -Werror>" "$<$>:-Werror>") + endif() + + target_compile_definitions(${target_name} PUBLIC -DNSYNC_ATOMIC_CPP11) + target_include_directories(${target_name} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/external/nsync/public") + endif() + foreach(ORT_FLAG ${ORT_PROVIDER_FLAGS}) + target_compile_definitions(${target_name} PRIVATE ${ORT_FLAG}) + endforeach() + if(HAS_DEPRECATED_COPY) + #too many such errors in eigen + target_compile_options(${target_name} PRIVATE "$<$:SHELL:--compiler-options -Wno-deprecated-copy>" "$<$:-Wno-deprecated-copy>") + endif() + if(onnxruntime_USE_CUDA) + if(HAS_STRICT_ALIASING AND ${CMAKE_CUDA_COMPILER_VERSION} VERSION_GREATER_EQUAL "11.0.0") + target_compile_options(${target_name} PRIVATE "$<$:-Wno-strict-aliasing>") + endif() + endif() + foreach(ORT_FLAG ${ORT_WARNING_FLAGS}) + target_compile_options(${target_name} PRIVATE "$<$:SHELL:--compiler-options ${ORT_FLAG}>" "$<$>:${ORT_FLAG}>") + endforeach() +endfunction() + function(onnxruntime_add_shared_library target_name) add_library(${target_name} SHARED ${ARGN}) + target_link_directories(${target_name} PRIVATE ${onnxruntime_LINK_DIRS}) + onnxruntime_set_compile_flags(${target_name}) + target_include_directories(${target_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT}) + if(onnxruntime_ENABLE_LTO) + set_target_properties(${target_name} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE) + set_target_properties(${target_name} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE) + set_target_properties(${target_name} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL TRUE) + endif() +endfunction() + +function(onnxruntime_add_static_library target_name) + add_library(${target_name} ${ARGN}) target_link_directories(${target_name} PRIVATE ${onnxruntime_LINK_DIRS}) - if (MSVC) - target_compile_options(${target_name} PRIVATE "$<$:SHELL:--compiler-options /utf-8>" "$<$>:/utf-8>") - target_compile_options(${target_name} PRIVATE "$<$:SHELL:--compiler-options /sdl>" "$<$>:/sdl>") - set_target_properties(${target_name} PROPERTIES VS_CA_EXCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") - else() - target_compile_definitions(${target_name} PUBLIC -DNSYNC_ATOMIC_CPP11) - target_include_directories(${target_name} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/external/nsync/public") - endif() + onnxruntime_set_compile_flags(${target_name}) target_include_directories(${target_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT}) if(onnxruntime_ENABLE_LTO) set_target_properties(${target_name} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE) @@ -802,16 +1019,15 @@ endfunction() #For plugins that are not linked into other targets but may be loaded dynamically at runtime using dlopen-like functionality. function(onnxruntime_add_shared_library_module target_name) - add_library(${target_name} MODULE ${ARGN}) - target_link_directories(${target_name} PRIVATE ${onnxruntime_LINK_DIRS}) - if (MSVC) - target_compile_options(${target_name} PRIVATE "$<$:SHELL:--compiler-options /utf-8>" "$<$>:/utf-8>") - target_compile_options(${target_name} PRIVATE "$<$:SHELL:--compiler-options /sdl>" "$<$>:/sdl>") - set_target_properties(${target_name} PROPERTIES VS_CA_EXCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") + if ((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") OR (${CMAKE_SYSTEM_NAME} MATCHES "iOSCross") OR (${CMAKE_SYSTEM_NAME} MATCHES "iOS")) + add_library(${target_name} SHARED ${ARGN}) else() - target_compile_definitions(${target_name} PUBLIC -DNSYNC_ATOMIC_CPP11) - target_include_directories(${target_name} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/external/nsync/public") + #On Windows, this target shouldn't generate an import lib, but I don't know how to disable it. + add_library(${target_name} MODULE ${ARGN}) endif() + + target_link_directories(${target_name} PRIVATE ${onnxruntime_LINK_DIRS}) + onnxruntime_set_compile_flags(${target_name}) target_include_directories(${target_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT}) if(onnxruntime_ENABLE_LTO) set_target_properties(${target_name} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE) @@ -822,16 +1038,12 @@ endfunction() #almost the same as the above function, except the first line of the body function(onnxruntime_add_executable target_name) + if(${CMAKE_SYSTEM_NAME} MATCHES "iOSCross") + message(FATAL_ERROR "iOS doesn't support commmand line tool") + endif() add_executable(${target_name} ${ARGN}) target_link_directories(${target_name} PRIVATE ${onnxruntime_LINK_DIRS}) - if (MSVC) - target_compile_options(${target_name} PRIVATE "$<$:SHELL:--compiler-options /utf-8>" "$<$>:/utf-8>") - target_compile_options(${target_name} PRIVATE "$<$:SHELL:--compiler-options /sdl>" "$<$>:/sdl>") - set_target_properties(${target_name} PROPERTIES VS_CA_EXCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") - else() - target_compile_definitions(${target_name} PUBLIC -DNSYNC_ATOMIC_CPP11) - target_include_directories(${target_name} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/external/nsync/public") - endif() + onnxruntime_set_compile_flags(${target_name}) target_include_directories(${target_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT}) if(onnxruntime_ENABLE_LTO) set_target_properties(${target_name} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE) @@ -924,7 +1136,6 @@ if (onnxruntime_USE_ARMNN) endif() if (onnxruntime_USE_DNNL) - add_definitions(-DUSE_DNNL=1) include(dnnl) endif() @@ -1033,108 +1244,7 @@ if(onnxruntime_USE_CUDA) else() set_msvc_c_cpp_compiler_warning_level(4) endif() -if (WIN32) - set(ORT_WARNING_FLAGS) - add_definitions(-DPLATFORM_WINDOWS -DNOGDI -DNOMINMAX -D_USE_MATH_DEFINES) - if(onnxruntime_ENABLE_MEMLEAK_CHECKER) - add_definitions(-DONNXRUNTIME_ENABLE_MEMLEAK_CHECK) - endif() - # parallel build - # These compiler opitions cannot be forwarded to NVCC, so cannot use add_compiler_options - string(APPEND CMAKE_CXX_FLAGS " /MP") - #Compiler bug, we should get such warnings. It will be fixed in a new VC release - list(APPEND ORT_WARNING_FLAGS "/wd4127") - # class needs to have dll-interface to be used by clients - list(APPEND ORT_WARNING_FLAGS "/wd4251") - # issued by thrust nonstandard extension used: nameless struct/union - list(APPEND ORT_WARNING_FLAGS "/wd4201") - if (onnxruntime_ENABLE_STATIC_ANALYSIS) - list(APPEND ORT_WARNING_FLAGS "/analyze:stacksize 131072") - list(APPEND ORT_WARNING_FLAGS "/wd6326") # potential comparison of a constant with another constant - if(onnxruntime_USE_OPENMP) - list(APPEND ORT_WARNING_FLAGS "/wd6993") # Code analysis ignores OpenMP constructs - endif() - endif() - # Treat warning as error if onnxruntime_DEV_MODE is ON - # For cross-compiled ARM64 binaries, there are too many warnings to fix, hence ignore warnings for now - if (onnxruntime_DEV_MODE AND NOT CMAKE_CROSSCOMPILING) - # treat warnings as errors - list(APPEND ORT_WARNING_FLAGS "/WX") - foreach(type EXE STATIC SHARED) - set(CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS} /WX") - endforeach() - endif() - # set linker flags to minimize the binary size. - if (MSVC) - foreach(type EXE STATIC SHARED) - if (NOT type MATCHES STATIC) - # The WinML internal toolchain does not allow link's "additional options" to contain optimization - # flags (/OPT#); these are already specified using msbuild properties. - if (NOT DEFINED onnxruntime_DISABLE_LINKER_OPT_FLAGS) - set(CMAKE_${type}_LINKER_FLAGS_RELEASE "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /OPT:REF,ICF,LBR") - set(CMAKE_${type}_LINKER_FLAGS_RELEASE "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /INCREMENTAL:NO") - set(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF,ICF,LBR") - set(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /INCREMENTAL:NO") - set(CMAKE_${type}_LINKER_FLAGS_MINSIZEREL "${CMAKE_${type}_LINKER_FLAGS_MINSIZEREL} /OPT:REF,ICF,LBR") - set(CMAKE_${type}_LINKER_FLAGS_MINSIZEREL "${CMAKE_${type}_LINKER_FLAGS_MINSIZEREL} /INCREMENTAL:NO") - endif() - endif() - if (onnxruntime_ENABLE_LTO AND NOT onnxruntime_USE_CUDA) - set(CMAKE_${type}_LINKER_FLAGS_RELEASE "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /LTCG") - set(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /LTCG") - set(CMAKE_${type}_LINKER_FLAGS_MINSIZEREL "${CMAKE_${type}_LINKER_FLAGS_MINSIZEREL} /LTCG") - endif() - endforeach() - endif() - foreach(ORT_FLAG ${ORT_WARNING_FLAGS}) - string(APPEND CMAKE_CXX_FLAGS " ${ORT_FLAG}") - string(APPEND CMAKE_C_FLAGS " ${ORT_FLAG}") - endforeach() -else() - add_definitions(-DPLATFORM_POSIX) - # Enable warning - string(APPEND CMAKE_CXX_FLAGS " -Wall -Wextra") - string(APPEND CMAKE_C_FLAGS " -Wall -Wextra") - - if(onnxruntime_DEV_MODE) - string(APPEND CMAKE_CXX_FLAGS " -Werror") - string(APPEND CMAKE_C_FLAGS " -Werror") - endif() - check_cxx_compiler_flag(-Wunused-but-set-variable HAS_UNUSED_BUT_SET_VARIABLE) - check_cxx_compiler_flag(-Wunused-parameter HAS_UNUSED_PARAMETER) - check_cxx_compiler_flag(-Wunused-variable HAS_UNUSED_VARIABLE) - check_cxx_compiler_flag(-Wcast-function-type HAS_CAST_FUNCTION_TYPE) - check_cxx_compiler_flag(-Wparentheses HAS_PARENTHESES) - check_cxx_compiler_flag(-Wuseless-cast HAS_USELESS_CAST) - check_cxx_compiler_flag(-Wnonnull-compare HAS_NONNULL_COMPARE) - check_cxx_compiler_flag(-Wtautological-pointer-compare HAS_TAUTOLOGICAL_POINTER_COMPARE) - check_cxx_compiler_flag(-Wcatch-value HAS_CATCH_VALUE) - check_cxx_compiler_flag(-Wmissing-braces HAS_MISSING_BRACES) - check_cxx_compiler_flag(-Wignored-attributes HAS_IGNORED_ATTRIBUTES) - check_cxx_compiler_flag(-Wdeprecated-copy HAS_DEPRECATED_COPY) - check_cxx_compiler_flag(-Wdeprecated-declarations HAS_DEPRECATED_DECLARATIONS) - check_cxx_compiler_flag(-Wclass-memaccess HAS_CLASS_MEMACCESS) - check_cxx_compiler_flag(-Wmaybe-uninitialized HAS_MAYBE_UNINITIALIZED) - - if(HAS_TAUTOLOGICAL_POINTER_COMPARE) - #we may have extra null pointer checkings in debug build, it's not an issue - string(APPEND CMAKE_CXX_FLAGS_DEBUG " -Wno-tautological-pointer-compare") - string(APPEND CMAKE_C_FLAGS_DEBUG " -Wno-tautological-pointer-compare") - endif() - if(HAS_NONNULL_COMPARE) - #we may have extra null pointer checkings in debug build, it's not an issue - string(APPEND CMAKE_CXX_FLAGS_DEBUG " -Wno-nonnull-compare") - string(APPEND CMAKE_C_FLAGS_DEBUG " -Wno-nonnull-compare") - endif() - if(HAS_DEPRECATED_COPY) - #too many such errors in eigen - string(APPEND CMAKE_CXX_FLAGS " -Wno-deprecated-copy") - endif() - if(HAS_PARENTHESES) - string(APPEND CMAKE_CXX_FLAGS " -Wno-parentheses") - endif() -endif() set(onnxruntime_DELAYLOAD_FLAGS "") include_directories( @@ -1214,7 +1324,6 @@ if (onnxruntime_USE_VITISAI) if(WIN32) message(FATAL_ERROR "Vitis-AI execution provider is not supported on Windows.") else() - add_definitions(-DUSE_VITISAI=1) include(pyxir) list(APPEND onnxruntime_EXTERNAL_LIBRARIES pyxir) list(APPEND onnxruntime_EXTERNAL_DEPENDENCIES pyxir) @@ -1224,7 +1333,6 @@ endif() configure_file(onnxruntime_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/onnxruntime_config.h) if (onnxruntime_USE_CUDA) - add_definitions(-DUSE_CUDA=1) #The following 6 lines are copied from https://gitlab.kitware.com/cmake/cmake/issues/17559 set( CMAKE_CUDA_FLAGS "" CACHE STRING "" ) if ( CMAKE_CUDA_FLAGS ) @@ -1238,6 +1346,7 @@ if (onnxruntime_USE_CUDA) endif() enable_language(CUDA) message( STATUS "CMAKE_CUDA_COMPILER_VERSION: ${CMAKE_CUDA_COMPILER_VERSION}") + if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11) set(CMAKE_CUDA_STANDARD 14) else() @@ -1298,7 +1407,6 @@ if (onnxruntime_USE_MIGRAPHX) message(FATAL_ERROR "MIGraphX does not support build in Windows!") endif() set(AMD_MIGRAPHX_HOME ${onnxruntime_MIGRAPHX_HOME}) - add_definitions(-DUSE_MIGRAPHX=1) endif() if (onnxruntime_USE_ROCM) @@ -1342,7 +1450,6 @@ if (onnxruntime_USE_DML) message(FATAL_ERROR "The DirectML execution provider is only supported when building for Windows.") endif() - add_definitions(-DUSE_DML=1) include(dml) endif() @@ -1468,31 +1575,8 @@ if (onnxruntime_ENABLE_TRAINING) list(APPEND onnxruntime_EXTERNAL_LIBRARIES tensorboard) endif() -#names in this var must match the directory names under onnxruntime/core/providers -set(ONNXRUNTIME_PROVIDER_NAMES cpu) foreach(target_name onnxruntime_common onnxruntime_graph onnxruntime_framework onnxruntime_util onnxruntime_providers onnxruntime_optimizer onnxruntime_session onnxruntime_mlas onnxruntime_flatbuffers) - include(${target_name}.cmake) - if (MSVC) - target_compile_options(${target_name} PRIVATE "$<$:SHELL:--compiler-options /utf-8>" "$<$>:/utf-8>") - target_compile_options(${target_name} PRIVATE "$<$:SHELL:--compiler-options /sdl>" "$<$>:/sdl>") - set_target_properties(${target_name} PROPERTIES VS_CA_EXCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") - else() - target_compile_definitions(${target_name} PUBLIC -DNSYNC_ATOMIC_CPP11) - target_include_directories(${target_name} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/external/nsync/public") - endif() - target_include_directories(${target_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT}) -endforeach() - -foreach(provider_name ${ONNXRUNTIME_PROVIDER_NAMES}) - if(NOT provider_name STREQUAL "cpu" AND NOT provider_name STREQUAL "winml") - if (MSVC) - target_compile_options(onnxruntime_providers_${provider_name} PRIVATE "$<$:SHELL:--compiler-options /utf-8>" "$<$>:/utf-8>") - target_compile_options(onnxruntime_providers_${provider_name} PRIVATE "$<$:SHELL:--compiler-options /sdl>" "$<$>:/sdl>") - else() - target_compile_definitions(onnxruntime_providers_${provider_name} PUBLIC -DNSYNC_ATOMIC_CPP11) - target_include_directories(onnxruntime_providers_${provider_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} "${CMAKE_CURRENT_SOURCE_DIR}/external/nsync/public") - endif() - endif() + include(${target_name}.cmake) endforeach() if (CMAKE_SYSTEM_NAME STREQUAL "Android") diff --git a/cmake/external/pybind11.cmake b/cmake/external/pybind11.cmake index ee2fb29ab0..86aee98efa 100644 --- a/cmake/external/pybind11.cmake +++ b/cmake/external/pybind11.cmake @@ -8,7 +8,7 @@ if(NOT TARGET pybind11::module) set(pybind11_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/pybind11/src/pybind11/include) set(pybind11_URL https://github.com/pybind/pybind11.git) - set(pybind11_TAG v2.6.1) + set(pybind11_TAG v2.6.2) ExternalProject_Add(pybind11 PREFIX pybind11 diff --git a/cmake/onnxruntime.cmake b/cmake/onnxruntime.cmake index 85ff320264..0d2d58783d 100644 --- a/cmake/onnxruntime.cmake +++ b/cmake/onnxruntime.cmake @@ -132,19 +132,19 @@ endif() target_link_libraries(onnxruntime PRIVATE onnxruntime_session ${onnxruntime_libs} - ${PROVIDERS_CUDA} - ${PROVIDERS_NNAPI} - ${PROVIDERS_RKNPU} - ${PROVIDERS_MIGRAPHX} - ${PROVIDERS_NUPHAR} - ${PROVIDERS_VITISAI} - ${PROVIDERS_DML} ${PROVIDERS_ACL} ${PROVIDERS_ARMNN} + ${PROVIDERS_COREML} + ${PROVIDERS_CUDA} + ${PROVIDERS_DML} + ${PROVIDERS_MIGRAPHX} + ${PROVIDERS_NNAPI} + ${PROVIDERS_NUPHAR} + ${PROVIDERS_RKNPU} + ${PROVIDERS_ROCM} + ${PROVIDERS_VITISAI} ${PROVIDERS_INTERNAL_TESTING} ${onnxruntime_winml} - ${PROVIDERS_ROCM} - ${PROVIDERS_COREML} onnxruntime_optimizer onnxruntime_providers onnxruntime_util diff --git a/cmake/onnxruntime_codegen.cmake b/cmake/onnxruntime_codegen.cmake index 112fad0ce9..b0bdc79ce5 100644 --- a/cmake/onnxruntime_codegen.cmake +++ b/cmake/onnxruntime_codegen.cmake @@ -16,7 +16,7 @@ file(GLOB_RECURSE onnxruntime_codegen_tvm_srcs CONFIGURE_DEPENDS source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_codegen_common_srcs} ${onnxruntime_codegen_tvm_srcs}) #onnxruntime_codegen_tvm depends on onnxruntime framework -add_library(onnxruntime_codegen_tvm ${onnxruntime_codegen_common_srcs} ${onnxruntime_codegen_tvm_srcs}) +onnxruntime_add_static_library(onnxruntime_codegen_tvm ${onnxruntime_codegen_common_srcs} ${onnxruntime_codegen_tvm_srcs}) set_target_properties(onnxruntime_codegen_tvm PROPERTIES FOLDER "ONNXRuntime") target_include_directories(onnxruntime_codegen_tvm PRIVATE ${ONNXRUNTIME_ROOT} ${TVM_INCLUDES} ${MKLML_INCLUDE_DIR} ${eigen_INCLUDE_DIRS}) onnxruntime_add_include_to_target(onnxruntime_codegen_tvm onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf flatbuffers) diff --git a/cmake/onnxruntime_common.cmake b/cmake/onnxruntime_common.cmake index 6e50a611ce..61af21ab36 100644 --- a/cmake/onnxruntime_common.cmake +++ b/cmake/onnxruntime_common.cmake @@ -88,7 +88,7 @@ file(GLOB onnxruntime_common_src CONFIGURE_DEPENDS source_group(TREE ${REPO_ROOT} FILES ${onnxruntime_common_src}) -add_library(onnxruntime_common ${onnxruntime_common_src}) +onnxruntime_add_static_library(onnxruntime_common ${onnxruntime_common_src}) if (onnxruntime_USE_CUDA) target_include_directories(onnxruntime_common PUBLIC ${onnxruntime_CUDA_HOME}/include ${onnxruntime_CUDA_HOME}/extras/CUPTI/include) diff --git a/cmake/onnxruntime_flatbuffers.cmake b/cmake/onnxruntime_flatbuffers.cmake index 9d6f3a063b..49302e92f5 100644 --- a/cmake/onnxruntime_flatbuffers.cmake +++ b/cmake/onnxruntime_flatbuffers.cmake @@ -8,7 +8,7 @@ file(GLOB onnxruntime_flatbuffers_srcs CONFIGURE_DEPENDS source_group(TREE ${REPO_ROOT} FILES ${onnxruntime_flatbuffers_srcs}) -add_library(onnxruntime_flatbuffers ${onnxruntime_flatbuffers_srcs}) +onnxruntime_add_static_library(onnxruntime_flatbuffers ${onnxruntime_flatbuffers_srcs}) onnxruntime_add_include_to_target(onnxruntime_flatbuffers onnx flatbuffers) if(onnxruntime_ENABLE_INSTRUMENT) target_compile_definitions(onnxruntime_flatbuffers PUBLIC ONNXRUNTIME_ENABLE_INSTRUMENT) diff --git a/cmake/onnxruntime_framework.cmake b/cmake/onnxruntime_framework.cmake index fbfacafc1d..dbe083c9d5 100644 --- a/cmake/onnxruntime_framework.cmake +++ b/cmake/onnxruntime_framework.cmake @@ -27,7 +27,7 @@ endif() source_group(TREE ${REPO_ROOT} FILES ${onnxruntime_framework_srcs}) -add_library(onnxruntime_framework ${onnxruntime_framework_srcs}) +onnxruntime_add_static_library(onnxruntime_framework ${onnxruntime_framework_srcs}) if(onnxruntime_ENABLE_INSTRUMENT) target_compile_definitions(onnxruntime_framework PRIVATE ONNXRUNTIME_ENABLE_INSTRUMENT) endif() diff --git a/cmake/onnxruntime_graph.cmake b/cmake/onnxruntime_graph.cmake index 37ab9ac9ff..25ee83d15f 100644 --- a/cmake/onnxruntime_graph.cmake +++ b/cmake/onnxruntime_graph.cmake @@ -72,7 +72,7 @@ if (onnxruntime_ENABLE_TRAINING) list(APPEND onnxruntime_graph_lib_src ${orttraining_graph_src}) endif() -add_library(onnxruntime_graph ${onnxruntime_graph_lib_src}) +onnxruntime_add_static_library(onnxruntime_graph ${onnxruntime_graph_lib_src}) add_dependencies(onnxruntime_graph onnx_proto flatbuffers) onnxruntime_add_include_to_target(onnxruntime_graph onnxruntime_common onnx onnx_proto protobuf::libprotobuf flatbuffers) diff --git a/cmake/onnxruntime_java.cmake b/cmake/onnxruntime_java.cmake index 8d60966c5b..ea3368c578 100644 --- a/cmake/onnxruntime_java.cmake +++ b/cmake/onnxruntime_java.cmake @@ -9,7 +9,6 @@ find_package(Java REQUIRED) include(UseJava) if (NOT CMAKE_SYSTEM_NAME STREQUAL "Android") find_package(JNI REQUIRED) - include_directories(${JNI_INCLUDE_DIRS}) endif() set(JAVA_ROOT ${REPO_ROOT}/java) @@ -47,9 +46,7 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Android") # it is better to not keep a daemon running set(GRADLE_ARGS ${GRADLE_ARGS} --no-daemon) endif() -if(onnxruntime_USE_CUDA) - set(GRADLE_ARGS ${GRADLE_ARGS} -DUSE_CUDA=1) -endif() + add_custom_command(OUTPUT ${JAVA_OUTPUT_JAR} COMMAND ${GRADLE_EXECUTABLE} ${GRADLE_ARGS} WORKING_DIRECTORY ${JAVA_ROOT} DEPENDS ${onnxruntime4j_gradle_files} ${onnxruntime4j_src}) add_custom_target(onnxruntime4j DEPENDS ${JAVA_OUTPUT_JAR}) set_source_files_properties(${JAVA_OUTPUT_JAR} PROPERTIES GENERATED TRUE) @@ -62,49 +59,15 @@ file(GLOB onnxruntime4j_native_src "${REPO_ROOT}/include/onnxruntime/core/session/*.h" ) # Build the JNI library -add_library(onnxruntime4j_jni SHARED ${onnxruntime4j_native_src}) +onnxruntime_add_shared_library_module(onnxruntime4j_jni ${onnxruntime4j_native_src}) set_property(TARGET onnxruntime4j_jni PROPERTY CXX_STANDARD 11) -# Tell the JNI code about the requested providers -if (onnxruntime_USE_CUDA) - target_compile_definitions(onnxruntime4j_jni PRIVATE USE_CUDA=1) -endif() -if (onnxruntime_USE_DNNL) - target_compile_definitions(onnxruntime4j_jni PRIVATE USE_DNNL=1) -endif() -if (onnxruntime_USE_OPENVINO) - target_compile_definitions(onnxruntime4j_jni PRIVATE USE_OPENVINO=1) -endif() -if (onnxruntime_USE_TENSORRT) - target_compile_definitions(onnxruntime4j_jni PRIVATE USE_TENSORRT=1) -endif() -if (onnxruntime_USE_NNAPI_BUILTIN) - target_compile_definitions(onnxruntime4j_jni PRIVATE USE_NNAPI=1) -endif() -if (onnxruntime_USE_NUPHAR) - target_compile_definitions(onnxruntime4j_jni PRIVATE USE_NUPHAR=1) -endif() -if (onnxruntime_USE_ACL) - target_compile_definitions(onnxruntime4j_jni PRIVATE USE_ACL=1) -endif() -if (onnxruntime_USE_DML) - target_compile_definitions(onnxruntime4j_jni PRIVATE USE_DIRECTML=1) -endif() -if (onnxruntime_USE_ARMNN) - target_compile_definitions(onnxruntime4j_jni PRIVATE USE_ARMNN=1) -endif() -if (onnxruntime_USE_ROCM) - target_compile_definitions(onnxruntime4j_jni PRIVATE USE_ROCM=1) -endif() -if (onnxruntime_USE_COREML) - target_compile_definitions(onnxruntime4j_jni PRIVATE USE_COREML=1) -endif() # depend on java sources. if they change, the JNI should recompile add_dependencies(onnxruntime4j_jni onnxruntime4j) onnxruntime_add_include_to_target(onnxruntime4j_jni onnxruntime_session) # the JNI headers are generated in the onnxruntime4j target -target_include_directories(onnxruntime4j_jni PRIVATE ${REPO_ROOT}/include ${JAVA_ROOT}/build/headers) +target_include_directories(onnxruntime4j_jni PRIVATE ${REPO_ROOT}/include ${JAVA_ROOT}/build/headers ${JNI_INCLUDE_DIRS}) target_link_libraries(onnxruntime4j_jni PUBLIC onnxruntime) set(JAVA_PACKAGE_OUTPUT_DIR ${JAVA_OUTPUT_DIR}/build) @@ -199,9 +162,10 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Android") # it is better to not keep a daemon running set(GRADLE_ARGS ${GRADLE_ARGS} --no-daemon) endif() -if(onnxruntime_USE_CUDA) - set(GRADLE_ARGS ${GRADLE_ARGS} -DUSE_CUDA=1) -endif() +string(JOIN " " GRADLE_EP_FLAGS ${ORT_PROVIDER_FLAGS}) +set(GRADLE_ARGS ${GRADLE_ARGS} ${GRADLE_EP_FLAGS}) + +message(STATUS "GRADLE_ARGS: ${GRADLE_ARGS}") add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${GRADLE_EXECUTABLE} ${GRADLE_ARGS} WORKING_DIRECTORY ${JAVA_ROOT}) if (CMAKE_SYSTEM_NAME STREQUAL "Android") add_custom_command(TARGET onnxruntime4j_jni POST_BUILD COMMAND ${GRADLE_EXECUTABLE} -b build-android.gradle -c settings-android.gradle build -DjniLibsDir=${ANDROID_PACKAGE_JNILIBS_DIR} -DbuildDir=${ANDROID_PACKAGE_OUTPUT_DIR} WORKING_DIRECTORY ${JAVA_ROOT}) diff --git a/cmake/onnxruntime_language_interop_ops.cmake b/cmake/onnxruntime_language_interop_ops.cmake index 62f568848a..241ddb3305 100644 --- a/cmake/onnxruntime_language_interop_ops.cmake +++ b/cmake/onnxruntime_language_interop_ops.cmake @@ -2,7 +2,7 @@ # Licensed under the MIT License. include(onnxruntime_pyop.cmake) file (GLOB onnxruntime_language_interop_ops_src "${ONNXRUNTIME_ROOT}/core/language_interop_ops/language_interop_ops.cc") -add_library(onnxruntime_language_interop ${onnxruntime_language_interop_ops_src}) +onnxruntime_add_static_library(onnxruntime_language_interop ${onnxruntime_language_interop_ops_src}) add_dependencies(onnxruntime_language_interop onnxruntime_pyop) onnxruntime_add_include_to_target(onnxruntime_language_interop onnxruntime_common onnxruntime_graph onnxruntime_framework onnxruntime_pyop onnx onnx_proto protobuf::libprotobuf flatbuffers) target_include_directories(onnxruntime_language_interop PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS}) \ No newline at end of file diff --git a/cmake/onnxruntime_mlas.cmake b/cmake/onnxruntime_mlas.cmake index fa468d1ace..5478ca6e58 100644 --- a/cmake/onnxruntime_mlas.cmake +++ b/cmake/onnxruntime_mlas.cmake @@ -351,7 +351,7 @@ else() endif() endif() -add_library(onnxruntime_mlas STATIC ${mlas_common_srcs} ${mlas_platform_srcs}) +onnxruntime_add_static_library(onnxruntime_mlas ${mlas_common_srcs} ${mlas_platform_srcs}) target_include_directories(onnxruntime_mlas PRIVATE ${ONNXRUNTIME_ROOT}/core/mlas/inc ${ONNXRUNTIME_ROOT}/core/mlas/lib) set_target_properties(onnxruntime_mlas PROPERTIES FOLDER "ONNXRuntime") if (WIN32) diff --git a/cmake/onnxruntime_nodejs.cmake b/cmake/onnxruntime_nodejs.cmake index 3de857817b..195075e96d 100644 --- a/cmake/onnxruntime_nodejs.cmake +++ b/cmake/onnxruntime_nodejs.cmake @@ -28,6 +28,7 @@ if(had_error) message(FATAL_ERROR "Failed to find NPM: " ${had_error}) endif() +if(NOT onnxruntime_ENABLE_STATIC_ANALYSIS) # add custom target add_custom_target(js_npm_ci ALL COMMAND ${NPM_CLI} ci @@ -47,3 +48,4 @@ add_custom_target(nodejs_binding_wrapper ALL add_dependencies(nodejs_binding_wrapper js_npm_ci) add_dependencies(nodejs_binding_wrapper js_common_npm_ci) add_dependencies(nodejs_binding_wrapper onnxruntime) +endif() \ No newline at end of file diff --git a/cmake/onnxruntime_nuphar_extern.cmake b/cmake/onnxruntime_nuphar_extern.cmake index 3dee498209..fb5a9b4561 100644 --- a/cmake/onnxruntime_nuphar_extern.cmake +++ b/cmake/onnxruntime_nuphar_extern.cmake @@ -22,7 +22,7 @@ set(nuphar_extern_srcs ${extern_avx2_srcs} ) -add_library(onnxruntime_nuphar_extern ${nuphar_extern_srcs}) +onnxruntime_add_static_library(onnxruntime_nuphar_extern ${nuphar_extern_srcs}) if (onnxruntime_USE_MKLML) add_definitions(-DNUPHAR_USE_MKL) diff --git a/cmake/onnxruntime_optimizer.cmake b/cmake/onnxruntime_optimizer.cmake index 1486e5e19e..c63739bd0d 100644 --- a/cmake/onnxruntime_optimizer.cmake +++ b/cmake/onnxruntime_optimizer.cmake @@ -28,7 +28,7 @@ endif() source_group(TREE ${REPO_ROOT} FILES ${onnxruntime_optimizer_srcs}) -add_library(onnxruntime_optimizer ${onnxruntime_optimizer_srcs}) +onnxruntime_add_static_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 flatbuffers) diff --git a/cmake/onnxruntime_providers.cmake b/cmake/onnxruntime_providers.cmake index 7798f23103..2b11530d9f 100644 --- a/cmake/onnxruntime_providers.cmake +++ b/cmake/onnxruntime_providers.cmake @@ -57,60 +57,40 @@ file(GLOB onnxruntime_providers_common_srcs CONFIGURE_DEPENDS ) if(onnxruntime_USE_NUPHAR) - set(PROVIDERS_NUPHAR onnxruntime_providers_nuphar) - list(APPEND ONNXRUNTIME_PROVIDER_NAMES nuphar) + set(PROVIDERS_NUPHAR onnxruntime_providers_nuphar) endif() if(onnxruntime_USE_VITISAI) - set(PROVIDERS_VITISAI onnxruntime_providers_vitisai) - list(APPEND ONNXRUNTIME_PROVIDER_NAMES vitisai) + set(PROVIDERS_VITISAI onnxruntime_providers_vitisai) endif() if(onnxruntime_USE_CUDA) set(PROVIDERS_CUDA onnxruntime_providers_cuda) - list(APPEND ONNXRUNTIME_PROVIDER_NAMES cuda) -endif() -if(onnxruntime_USE_TENSORRT) - set(PROVIDERS_TENSORRT onnxruntime_providers_tensorrt) - list(APPEND ONNXRUNTIME_PROVIDER_NAMES tensorrt) endif() if(onnxruntime_USE_COREML) set(PROVIDERS_COREML onnxruntime_providers_coreml) - list(APPEND ONNXRUNTIME_PROVIDER_NAMES coreml) endif() if(onnxruntime_USE_NNAPI_BUILTIN) set(PROVIDERS_NNAPI onnxruntime_providers_nnapi) - list(APPEND ONNXRUNTIME_PROVIDER_NAMES nnapi) endif() if(onnxruntime_USE_RKNPU) set(PROVIDERS_RKNPU onnxruntime_providers_rknpu) - list(APPEND ONNXRUNTIME_PROVIDER_NAMES rknpu) endif() if(onnxruntime_USE_DML) - set(PROVIDERS_DML onnxruntime_providers_dml) - list(APPEND ONNXRUNTIME_PROVIDER_NAMES dml) + set(PROVIDERS_DML onnxruntime_providers_dml) endif() if(onnxruntime_USE_MIGRAPHX) set(PROVIDERS_MIGRAPHX onnxruntime_providers_migraphx) - list(APPEND ONNXRUNTIME_PROVIDER_NAMES migraphx) -endif() -if(onnxruntime_USE_OPENVINO) - set(PROVIDERS_OPENVINO onnxruntime_providers_openvino) - list(APPEND ONNXRUNTIME_PROVIDER_NAMES openvino) endif() if(onnxruntime_USE_WINML) set(PROVIDERS_WINML onnxruntime_providers_winml) - list(APPEND ONNXRUNTIME_PROVIDER_NAMES winml) endif() if(onnxruntime_USE_ACL) - set(PROVIDERS_ACL onnxruntime_providers_acl) - list(APPEND ONNXRUNTIME_PROVIDER_NAMES acl) + set(PROVIDERS_ACL onnxruntime_providers_acl) endif() if(onnxruntime_USE_ARMNN) - set(PROVIDERS_ARMNN onnxruntime_providers_armnn) - list(APPEND ONNXRUNTIME_PROVIDER_NAMES armnn) + set(PROVIDERS_ARMNN onnxruntime_providers_armnn) endif() if(onnxruntime_USE_ROCM) - set(PROVIDERS_ROCM onnxruntime_providers_rocm) - list(APPEND ONNXRUNTIME_PROVIDER_NAMES rocm) + set(PROVIDERS_ROCM onnxruntime_providers_rocm) endif() source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_common_srcs} ${onnxruntime_providers_srcs}) @@ -172,7 +152,7 @@ if (onnxruntime_ENABLE_TRAINING) list(APPEND onnxruntime_providers_src ${onnxruntime_cpu_training_ops_srcs}) endif() -add_library(onnxruntime_providers ${onnxruntime_providers_src}) +onnxruntime_add_static_library(onnxruntime_providers ${onnxruntime_providers_src}) if (MSVC) target_compile_options(onnxruntime_providers PRIVATE "/bigobj") if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8) @@ -278,7 +258,7 @@ if (onnxruntime_USE_CUDA) list(APPEND onnxruntime_providers_cuda_src ${onnxruntime_cuda_training_ops_cc_srcs} ${onnxruntime_cuda_training_ops_cu_srcs}) endif() - add_library(onnxruntime_providers_cuda ${onnxruntime_providers_cuda_src}) + onnxruntime_add_static_library(onnxruntime_providers_cuda ${onnxruntime_providers_cuda_src}) #target_compile_options(onnxruntime_providers_cuda PRIVATE "$<$:SHELL:-Xcompiler \"/analyze:stacksize 131072\">") if (HAS_GUARD_CF) @@ -385,8 +365,6 @@ if (NOT onnxruntime_MINIMAL_BUILD AND NOT onnxruntime_EXTENDED_MINIMAL_BUILD endif() if (onnxruntime_USE_DNNL) - list(APPEND ONNXRUNTIME_PROVIDER_NAMES dnnl) - file(GLOB_RECURSE onnxruntime_providers_dnnl_cc_srcs CONFIGURE_DEPENDS "${ONNXRUNTIME_ROOT}/core/providers/dnnl/*.h" "${ONNXRUNTIME_ROOT}/core/providers/dnnl/*.cc" @@ -538,7 +516,7 @@ if (onnxruntime_USE_NUPHAR) endif() source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_nuphar_cc_srcs}) - add_library(onnxruntime_providers_nuphar ${onnxruntime_providers_nuphar_cc_srcs}) + onnxruntime_add_static_library(onnxruntime_providers_nuphar ${onnxruntime_providers_nuphar_cc_srcs}) onnxruntime_add_include_to_target(onnxruntime_providers_nuphar onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf flatbuffers) set_target_properties(onnxruntime_providers_nuphar PROPERTIES FOLDER "ONNXRuntime") target_include_directories(onnxruntime_providers_nuphar PRIVATE ${ONNXRUNTIME_ROOT} ${TVM_INCLUDES} ${eigen_INCLUDE_DIRS}) @@ -555,7 +533,7 @@ if (onnxruntime_USE_VITISAI) ) source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_vitisai_cc_srcs}) - add_library(onnxruntime_providers_vitisai ${onnxruntime_providers_vitisai_cc_srcs}) + onnxruntime_add_static_library(onnxruntime_providers_vitisai ${onnxruntime_providers_vitisai_cc_srcs}) onnxruntime_add_include_to_target(onnxruntime_providers_vitisai onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf flatbuffers) add_dependencies(onnxruntime_providers_vitisai ${onnxruntime_EXTERNAL_DEPENDENCIES}) set_target_properties(onnxruntime_providers_vitisai PROPERTIES FOLDER "ONNXRuntime") @@ -632,7 +610,7 @@ if (onnxruntime_USE_COREML) file(GLOB coreml_proto_srcs "${COREML_PROTO_ROOT}/*.proto" ) - add_library(onnxruntime_coreml_proto ${coreml_proto_srcs}) + onnxruntime_add_static_library(onnxruntime_coreml_proto ${coreml_proto_srcs}) target_include_directories(onnxruntime_coreml_proto PUBLIC $ "${CMAKE_CURRENT_BINARY_DIR}") target_compile_definitions(onnxruntime_coreml_proto PUBLIC $) set_target_properties(onnxruntime_coreml_proto PROPERTIES COMPILE_FLAGS "-fvisibility=hidden") @@ -685,7 +663,7 @@ if (onnxruntime_USE_COREML) ) source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_coreml_cc_srcs}) - add_library(onnxruntime_providers_coreml ${onnxruntime_providers_coreml_cc_srcs} ${onnxruntime_providers_coreml_objcc_srcs}) + onnxruntime_add_static_library(onnxruntime_providers_coreml ${onnxruntime_providers_coreml_cc_srcs} ${onnxruntime_providers_coreml_objcc_srcs}) onnxruntime_add_include_to_target(onnxruntime_providers_coreml onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf-lite flatbuffers) onnxruntime_add_include_to_target(onnxruntime_providers_coreml onnxruntime_coreml_proto) target_link_libraries(onnxruntime_providers_coreml PRIVATE onnxruntime_coreml_proto "-framework Foundation" "-framework CoreML") @@ -757,7 +735,7 @@ if (onnxruntime_USE_NNAPI_BUILTIN) ) source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_nnapi_cc_srcs}) - add_library(onnxruntime_providers_nnapi ${onnxruntime_providers_nnapi_cc_srcs}) + onnxruntime_add_static_library(onnxruntime_providers_nnapi ${onnxruntime_providers_nnapi_cc_srcs}) onnxruntime_add_include_to_target(onnxruntime_providers_nnapi onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf-lite flatbuffers) target_link_libraries(onnxruntime_providers_nnapi) add_dependencies(onnxruntime_providers_nnapi onnx ${onnxruntime_EXTERNAL_DEPENDENCIES}) @@ -793,7 +771,7 @@ if (onnxruntime_USE_RKNPU) "${ONNXRUNTIME_ROOT}/core/providers/rknpu/*.cc" ) source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_rknpu_cc_srcs}) - add_library(onnxruntime_providers_rknpu ${onnxruntime_providers_rknpu_cc_srcs}) + onnxruntime_add_static_library(onnxruntime_providers_rknpu ${onnxruntime_providers_rknpu_cc_srcs}) onnxruntime_add_include_to_target(onnxruntime_providers_rknpu onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf-lite flatbuffers) target_link_libraries(onnxruntime_providers_rknpu PRIVATE -lrknpu_ddk) add_dependencies(onnxruntime_providers_rknpu onnx ${onnxruntime_EXTERNAL_DEPENDENCIES}) @@ -812,7 +790,7 @@ if (onnxruntime_USE_DML) "${ONNXRUNTIME_ROOT}/core/providers/dml/*.cc" ) source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_dml_cc_srcs}) - add_library(onnxruntime_providers_dml ${onnxruntime_providers_dml_cc_srcs}) + onnxruntime_add_static_library(onnxruntime_providers_dml ${onnxruntime_providers_dml_cc_srcs}) onnxruntime_add_include_to_target(onnxruntime_providers_dml onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf flatbuffers) add_dependencies(onnxruntime_providers_dml ${onnxruntime_EXTERNAL_DEPENDENCIES}) target_include_directories(onnxruntime_providers_dml PRIVATE ${ONNXRUNTIME_ROOT} ${ONNXRUNTIME_ROOT}/../cmake/external/wil/include) @@ -885,7 +863,7 @@ if (onnxruntime_USE_MIGRAPHX) ) source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_migraphx_cc_srcs}) - add_library(onnxruntime_providers_migraphx ${onnxruntime_providers_migraphx_cc_srcs}) + onnxruntime_add_static_library(onnxruntime_providers_migraphx ${onnxruntime_providers_migraphx_cc_srcs}) target_link_libraries(onnxruntime_providers_migraphx PRIVATE ${migraphx_libs}) set_target_properties(onnxruntime_providers_migraphx PROPERTIES FOLDER "ONNXRuntime") target_compile_options(onnxruntime_providers_migraphx PRIVATE -Wno-error=sign-compare) @@ -904,7 +882,7 @@ if (onnxruntime_USE_ACL) ) source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_acl_cc_srcs}) - add_library(onnxruntime_providers_acl ${onnxruntime_providers_acl_cc_srcs}) + onnxruntime_add_static_library(onnxruntime_providers_acl ${onnxruntime_providers_acl_cc_srcs}) onnxruntime_add_include_to_target(onnxruntime_providers_acl onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf flatbuffers) target_link_libraries(onnxruntime_providers_acl -L$ENV{LD_LIBRARY_PATH}) add_dependencies(onnxruntime_providers_acl ${onnxruntime_EXTERNAL_DEPENDENCIES}) @@ -922,7 +900,7 @@ if (onnxruntime_USE_ARMNN) ) source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_armnn_cc_srcs}) - add_library(onnxruntime_providers_armnn ${onnxruntime_providers_armnn_cc_srcs}) + onnxruntime_add_static_library(onnxruntime_providers_armnn ${onnxruntime_providers_armnn_cc_srcs}) onnxruntime_add_include_to_target(onnxruntime_providers_armnn onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf flatbuffers) add_dependencies(onnxruntime_providers_armnn ${onnxruntime_EXTERNAL_DEPENDENCIES}) set_target_properties(onnxruntime_providers_armnn PROPERTIES FOLDER "ONNXRuntime") diff --git a/cmake/onnxruntime_pyop.cmake b/cmake/onnxruntime_pyop.cmake index 5401883c4d..8c4fba3999 100644 --- a/cmake/onnxruntime_pyop.cmake +++ b/cmake/onnxruntime_pyop.cmake @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. file(GLOB onnxruntime_pyop_srcs "${ONNXRUNTIME_ROOT}/core/language_interop_ops/pyop/pyop.cc") -add_library(onnxruntime_pyop ${onnxruntime_pyop_srcs}) +onnxruntime_add_static_library(onnxruntime_pyop ${onnxruntime_pyop_srcs}) add_dependencies(onnxruntime_pyop onnxruntime_graph) onnxruntime_add_include_to_target(onnxruntime_pyop onnxruntime_common onnxruntime_graph onnxruntime_framework onnx onnx_proto protobuf::libprotobuf flatbuffers) target_include_directories(onnxruntime_pyop PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS}) diff --git a/cmake/onnxruntime_python.cmake b/cmake/onnxruntime_python.cmake index cbba796e0b..8180a26fd6 100644 --- a/cmake/onnxruntime_python.cmake +++ b/cmake/onnxruntime_python.cmake @@ -61,9 +61,6 @@ if(onnxruntime_PYBIND_EXPORT_OPSCHEMA) target_compile_definitions(onnxruntime_pybind11_state PRIVATE onnxruntime_PYBIND_EXPORT_OPSCHEMA) endif() -if (onnxruntime_USE_DNNL) - target_compile_definitions(onnxruntime_pybind11_state PRIVATE USE_DNNL=1) -endif() if (MSVC AND NOT CMAKE_SIZEOF_VOID_P EQUAL 8) #TODO: fix the warnings target_compile_options(onnxruntime_pybind11_state PRIVATE "/wd4244") @@ -282,7 +279,7 @@ file(GLOB onnxruntime_python_datasets_data CONFIGURE_DEPENDS ) set(build_output_target onnxruntime_common) - +if(NOT onnxruntime_ENABLE_STATIC_ANALYSIS) add_custom_command( TARGET onnxruntime_pybind11_state POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory $/onnxruntime/backend @@ -482,7 +479,7 @@ if (onnxruntime_USE_NNAPI_BUILTIN) $/onnxruntime/capi/ ) endif() - +endif() if (onnxruntime_ENABLE_LANGUAGE_INTEROP_OPS) include(onnxruntime_language_interop_ops.cmake) endif() diff --git a/cmake/onnxruntime_session.cmake b/cmake/onnxruntime_session.cmake index df7eebf5a2..564dc53dfe 100644 --- a/cmake/onnxruntime_session.cmake +++ b/cmake/onnxruntime_session.cmake @@ -9,7 +9,7 @@ file(GLOB onnxruntime_session_srcs CONFIGURE_DEPENDS source_group(TREE ${REPO_ROOT} FILES ${onnxruntime_session_srcs}) -add_library(onnxruntime_session ${onnxruntime_session_srcs}) +onnxruntime_add_static_library(onnxruntime_session ${onnxruntime_session_srcs}) install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/session DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core) onnxruntime_add_include_to_target(onnxruntime_session onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf flatbuffers) if(onnxruntime_ENABLE_INSTRUMENT) diff --git a/cmake/onnxruntime_training.cmake b/cmake/onnxruntime_training.cmake index 4672b065f4..496bb4f9db 100644 --- a/cmake/onnxruntime_training.cmake +++ b/cmake/onnxruntime_training.cmake @@ -17,7 +17,7 @@ file(GLOB_RECURSE onnxruntime_training_srcs "${ORTTRAINING_SOURCE_DIR}/core/agent/*.cc" ) -add_library(onnxruntime_training ${onnxruntime_training_srcs}) +onnxruntime_add_static_library(onnxruntime_training ${onnxruntime_training_srcs}) add_dependencies(onnxruntime_training onnx tensorboard ${onnxruntime_EXTERNAL_DEPENDENCIES}) onnxruntime_add_include_to_target(onnxruntime_training onnxruntime_common onnx onnx_proto tensorboard protobuf::libprotobuf flatbuffers) @@ -58,7 +58,7 @@ else () "${onnxruntime_perf_test_src_dir}/posix/utils.cc") endif() -add_library(onnxruntime_training_runner ${onnxruntime_training_runner_srcs} ${onnxruntime_perf_test_src}) +onnxruntime_add_static_library(onnxruntime_training_runner ${onnxruntime_training_runner_srcs} ${onnxruntime_perf_test_src}) add_dependencies(onnxruntime_training_runner ${onnxruntime_EXTERNAL_DEPENDENCIES} onnx onnxruntime_providers) onnxruntime_add_include_to_target(onnxruntime_training_runner onnxruntime_training onnxruntime_framework onnxruntime_common onnx onnx_proto protobuf::libprotobuf onnxruntime_training flatbuffers) diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake index 07cb6863f3..a05665af83 100644 --- a/cmake/onnxruntime_unittests.cmake +++ b/cmake/onnxruntime_unittests.cmake @@ -537,7 +537,7 @@ file(GLOB onnxruntime_test_framework_src CONFIGURE_DEPENDS ) #without auto initialize onnxruntime -add_library(onnxruntime_test_utils ${onnxruntime_test_utils_src}) +onnxruntime_add_static_library(onnxruntime_test_utils ${onnxruntime_test_utils_src}) if(MSVC) target_compile_options(onnxruntime_test_utils PRIVATE "$<$:SHELL:--compiler-options /utf-8>" "$<$>:/utf-8>") @@ -551,9 +551,7 @@ if (onnxruntime_USE_NCCL) endif() onnxruntime_add_include_to_target(onnxruntime_test_utils onnxruntime_common onnxruntime_framework onnxruntime_session GTest::gtest GTest::gmock onnx onnx_proto flatbuffers) -if (onnxruntime_USE_DNNL) - target_compile_definitions(onnxruntime_test_utils PUBLIC USE_DNNL=1) -endif() + if (onnxruntime_USE_DML) target_add_dml(onnxruntime_test_utils) endif() @@ -569,7 +567,7 @@ file(GLOB onnx_test_runner_common_srcs CONFIGURE_DEPENDS list(REMOVE_ITEM onnx_test_runner_common_srcs ${onnx_test_runner_src_dir}/main.cc) -add_library(onnx_test_runner_common ${onnx_test_runner_common_srcs}) +onnxruntime_add_static_library(onnx_test_runner_common ${onnx_test_runner_common_srcs}) if(MSVC) target_compile_options(onnx_test_runner_common PRIVATE "$<$:SHELL:--compiler-options /utf-8>" "$<$>:/utf-8>") @@ -598,7 +596,7 @@ if(NOT TARGET onnxruntime AND NOT onnxruntime_BUILD_WEBASSEMBLY) endif() if (onnxruntime_USE_CUDA) - add_library(onnxruntime_test_cuda_ops_lib ${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/cuda_ops.cu) + onnxruntime_add_static_library(onnxruntime_test_cuda_ops_lib ${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/cuda_ops.cu) list(APPEND onnxruntime_test_common_libs onnxruntime_test_cuda_ops_lib) endif() @@ -727,7 +725,7 @@ if(WIN32) endif() endif() -add_library(onnx_test_data_proto ${TEST_SRC_DIR}/proto/tml.proto) +onnxruntime_add_static_library(onnx_test_data_proto ${TEST_SRC_DIR}/proto/tml.proto) add_dependencies(onnx_test_data_proto onnx_proto ${onnxruntime_EXTERNAL_DEPENDENCIES}) #onnx_proto target should mark this definition as public, instead of private target_compile_definitions(onnx_test_data_proto PRIVATE "-DONNX_API=") @@ -752,7 +750,7 @@ onnxruntime_protobuf_generate(APPEND_PATH IMPORT_DIRS external/onnx TARGET onnx_ if(WIN32) set(wide_get_opt_src_dir ${TEST_SRC_DIR}/win_getopt/wide) - add_library(win_getopt_wide ${wide_get_opt_src_dir}/getopt.cc ${wide_get_opt_src_dir}/include/getopt.h) + onnxruntime_add_static_library(win_getopt_wide ${wide_get_opt_src_dir}/getopt.cc ${wide_get_opt_src_dir}/include/getopt.h) target_include_directories(win_getopt_wide INTERFACE ${wide_get_opt_src_dir}/include) set_target_properties(win_getopt_wide PROPERTIES FOLDER "ONNXRuntimeTest") set(onnx_test_runner_common_srcs ${onnx_test_runner_common_srcs}) @@ -926,7 +924,7 @@ endif() # shared lib if (onnxruntime_BUILD_SHARED_LIB) - add_library(onnxruntime_mocked_allocator ${TEST_SRC_DIR}/util/test_allocator.cc) + onnxruntime_add_static_library(onnxruntime_mocked_allocator ${TEST_SRC_DIR}/util/test_allocator.cc) target_include_directories(onnxruntime_mocked_allocator PUBLIC ${TEST_SRC_DIR}/util/include) set_target_properties(onnxruntime_mocked_allocator PROPERTIES FOLDER "ONNXRuntimeTest") @@ -1050,7 +1048,7 @@ if (onnxruntime_BUILD_WEBASSEMBLY) endif() endif() -add_library(custom_op_library SHARED ${TEST_SRC_DIR}/testdata/custom_op_library/custom_op_library.cc) +onnxruntime_add_shared_library_module(custom_op_library ${TEST_SRC_DIR}/testdata/custom_op_library/custom_op_library.cc) target_include_directories(custom_op_library PRIVATE ${REPO_ROOT}/include) if(UNIX) if (APPLE) @@ -1083,6 +1081,7 @@ if (onnxruntime_BUILD_JAVA) -DGRADLE_EXECUTABLE=${GRADLE_EXECUTABLE} -DBIN_DIR=${CMAKE_CURRENT_BINARY_DIR} -DREPO_ROOT=${REPO_ROOT} + ${ORT_PROVIDER_CMAKE_FLAGS} -P ${CMAKE_CURRENT_SOURCE_DIR}/onnxruntime_java_unittests.cmake) else() add_custom_command(TARGET custom_op_library POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ @@ -1111,7 +1110,7 @@ if (NOT onnxruntime_MINIMAL_BUILD AND NOT onnxruntime_EXTENDED_MINIMAL_BUILD "${ONNXRUNTIME_ROOT}/core/providers/shared_library/*.cc" ) - add_library(test_execution_provider SHARED ${test_execution_provider_srcs}) + onnxruntime_add_shared_library_module(test_execution_provider ${test_execution_provider_srcs}) add_dependencies(test_execution_provider onnxruntime_providers_shared) target_link_libraries(test_execution_provider PRIVATE onnxruntime_providers_shared) target_include_directories(test_execution_provider PRIVATE $) diff --git a/cmake/onnxruntime_util.cmake b/cmake/onnxruntime_util.cmake index 6b22ac9693..ddc8428c65 100644 --- a/cmake/onnxruntime_util.cmake +++ b/cmake/onnxruntime_util.cmake @@ -10,7 +10,7 @@ file(GLOB_RECURSE onnxruntime_util_srcs CONFIGURE_DEPENDS source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_util_srcs}) -add_library(onnxruntime_util ${onnxruntime_util_srcs}) +onnxruntime_add_static_library(onnxruntime_util ${onnxruntime_util_srcs}) target_include_directories(onnxruntime_util PRIVATE ${ONNXRUNTIME_ROOT} PUBLIC ${eigen_INCLUDE_DIRS}) if (onnxruntime_USE_CUDA) target_include_directories(onnxruntime_util PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) diff --git a/cmake/winml.cmake b/cmake/winml.cmake index 436ef5ca45..c2ee74e799 100644 --- a/cmake/winml.cmake +++ b/cmake/winml.cmake @@ -151,7 +151,7 @@ add_dependencies(winml_api_native_internal RESTORE_NUGET_PACKAGES) ########################### # Add static library that will be archived/linked for both static/dynamic library -add_library(winml_lib_telemetry STATIC +onnxruntime_add_static_library(winml_lib_telemetry ${winml_lib_telemetry_dir}/inc/TelemetryEvent.h ${ONNXRUNTIME_INCLUDE_DIR}/core/platform/windows/TraceLoggingConfig.h ${winml_lib_common_dir}/inc/WinMLTelemetryHelper.h @@ -222,7 +222,7 @@ if (onnxruntime_USE_DML) endif() # Add static library that will be archived/linked for both static/dynamic library -add_library(winml_lib_ort STATIC ${winml_lib_api_ort_files}) +onnxruntime_add_static_library(winml_lib_ort ${winml_lib_api_ort_files}) # Compiler options target_compile_features(winml_lib_ort PRIVATE cxx_std_17) @@ -297,7 +297,7 @@ if (onnxruntime_USE_DML) ) endif() -add_library(winml_adapter ${winml_adapter_files}) +onnxruntime_add_static_library(winml_adapter ${winml_adapter_files}) if (onnxruntime_WINML_NAMESPACE_OVERRIDE STREQUAL "Windows") target_compile_definitions(winml_adapter PRIVATE "BUILD_INBOX=1") @@ -339,7 +339,7 @@ list(APPEND onnxruntime_EXTERNAL_DEPENDENCIES winml_adapter) ########################### # Add static library that will be archived/linked for both static/dynamic library -add_library(winml_lib_image STATIC +onnxruntime_add_static_library(winml_lib_image ${winml_lib_api_image_dir}/inc/ConverterResourceStore.h ${winml_lib_api_image_dir}/inc/D3DDeviceCache.h ${winml_lib_api_image_dir}/inc/DeviceHelpers.h @@ -426,7 +426,7 @@ endif(onnxruntime_USE_DML) ########################### # Add static library that will be archived/linked for both static/dynamic library -add_library(winml_lib_api STATIC +onnxruntime_add_static_library(winml_lib_api ${winml_lib_api_dir}/impl/FeatureCompatibility.h ${winml_lib_api_dir}/impl/IData.h ${winml_lib_api_dir}/impl/IMapFeatureValue.h @@ -540,7 +540,7 @@ endif(onnxruntime_USE_DML) ########################### # Add static library that will be archived/linked for both static/dynamic library -add_library(winml_lib_api_experimental STATIC +onnxruntime_add_static_library(winml_lib_api_experimental ${winml_lib_api_experimental_dir}/LearningModelBuilder.cpp ${winml_lib_api_experimental_dir}/LearningModelBuilder.h ${winml_lib_api_experimental_dir}/LearningModelInputs.cpp @@ -630,7 +630,7 @@ endif(onnxruntime_USE_DML) # Add winml_lib_common ########################### -add_library(winml_lib_common STATIC +onnxruntime_add_static_library(winml_lib_common ${winml_lib_common_dir}/inc/common.h ${winml_lib_common_dir}/inc/CommonDeviceHelpers.h ${winml_lib_common_dir}/inc/cppwinrt_onnx.h @@ -692,7 +692,7 @@ set_source_files_properties( TRUE) # Add library -add_library(winml_dll SHARED +onnxruntime_add_shared_library(winml_dll ${CMAKE_CURRENT_BINARY_DIR}/winml_api/comp_generated/module.g.excl.cpp ${winml_dll_dir}/winml.def ${winml_dll_dir}/winml.rc diff --git a/cmake/winml_unittests.cmake b/cmake/winml_unittests.cmake index a92503c64f..e5461c647c 100644 --- a/cmake/winml_unittests.cmake +++ b/cmake/winml_unittests.cmake @@ -173,7 +173,7 @@ endfunction() file(GLOB winml_test_common_src CONFIGURE_DEPENDS "${WINML_TEST_SRC_DIR}/common/*.h" "${WINML_TEST_SRC_DIR}/common/*.cpp") -add_library(winml_test_common STATIC ${winml_test_common_src}) +onnxruntime_add_static_library(winml_test_common ${winml_test_common_src}) target_compile_options(winml_test_common PRIVATE /wd5205) # workaround cppwinrt SDK bug https://github.com/microsoft/cppwinrt/issues/584 if (onnxruntime_WINML_NAMESPACE_OVERRIDE STREQUAL "Windows") target_compile_definitions(winml_test_common PRIVATE "BUILD_INBOX=1") @@ -184,7 +184,7 @@ add_dependencies(winml_test_common winml_dll ) onnxruntime_add_include_to_target(winml_test_common onnx_proto) -add_library(winml_google_test_lib STATIC ${WINML_TEST_SRC_DIR}/common/googletest/main.cpp) +onnxruntime_add_static_library(winml_google_test_lib ${WINML_TEST_SRC_DIR}/common/googletest/main.cpp) set_winml_target_properties(winml_google_test_lib) set_winml_target_properties(winml_test_common) diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/OnnxMl.cs b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/OnnxMl.cs index 701ee8fe13..dac978a8d7 100644 --- a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/OnnxMl.cs +++ b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/OnnxMl.cs @@ -151,7 +151,7 @@ namespace Onnx { /// /// The version field is always serialized and we will use it to store the /// version that the graph is generated from. This helps us set up version - /// control. + /// control. /// For the IR, we are using simple numbers starting with 0x00000001, /// which was the version we published on Oct 10, 2017. /// @@ -1028,7 +1028,7 @@ namespace Onnx { /// Computation graphs are made up of a DAG of nodes, which represent what is /// commonly called a "layer" or "pipeline stage" in machine learning frameworks. /// - /// For example, it can be a node of type "Conv" that takes in an image, a filter + /// For example, it can be a node of type "Conv" that takes in an image, a filter /// tensor and a bias tensor, and produces the convolved output. /// public sealed partial class NodeProto : pb::IMessage { @@ -1437,7 +1437,7 @@ namespace Onnx { /// /// Notice that an input of a node in the "algorithm" graph may reference the /// output of a node in the inference graph (but not the other way round). Also, inference - /// node cannot reference inputs of "algorithm". With these restrictions, inference graph + /// node cannot reference inputs of "algorithm". With these restrictions, inference graph /// can always be run independently without training information. /// /// By default, this field is an empty graph and its evaluation does not @@ -1459,7 +1459,7 @@ namespace Onnx { private readonly pbc::RepeatedField initializationBinding_ = new pbc::RepeatedField(); /// /// This field specifies the bindings from the outputs of "initialization" to - /// some initializers in "ModelProto.graph.initializer" and + /// some initializers in "ModelProto.graph.initializer" and /// the "algorithm.initializer" in the same TrainingInfoProto. /// See "update_binding" below for details. /// @@ -2398,7 +2398,7 @@ namespace Onnx { /// /// Graphs /// - /// A graph defines the computational logic of a model and is comprised of a parameterized + /// A graph defines the computational logic of a model and is comprised of a parameterized /// list of nodes that form a directed acyclic graph based on their inputs and outputs. /// This is the equivalent of the "network" or "graph" in many deep learning /// frameworks. @@ -4201,8 +4201,8 @@ namespace Onnx { public const int DenotationFieldNumber = 6; private string denotation_ = ""; /// - /// An optional denotation can be used to denote the whole - /// type with a standard semantic description as to what is + /// An optional denotation can be used to denote the whole + /// type with a standard semantic description as to what is /// stored inside. Refer to https://github.com/onnx/onnx/blob/master/docs/TypeDenotation.md#type-denotation-definition /// for pre-defined type denotations. /// @@ -4970,9 +4970,9 @@ namespace Onnx { public const int ElemTypeFieldNumber = 1; private int elemType_; /// - /// This field MUST NOT have the value of UNDEFINED + /// This field MUST NOT have the value of UNDEFINED /// This field MUST have a valid TensorProto.DataType value - /// This field MUST be present for this version of the IR. + /// This field MUST be present for this version of the IR. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int ElemType { diff --git a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/OnnxMl.cs b/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/OnnxMl.cs index 701ee8fe13..dac978a8d7 100644 --- a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/OnnxMl.cs +++ b/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/OnnxMl.cs @@ -151,7 +151,7 @@ namespace Onnx { /// /// The version field is always serialized and we will use it to store the /// version that the graph is generated from. This helps us set up version - /// control. + /// control. /// For the IR, we are using simple numbers starting with 0x00000001, /// which was the version we published on Oct 10, 2017. /// @@ -1028,7 +1028,7 @@ namespace Onnx { /// Computation graphs are made up of a DAG of nodes, which represent what is /// commonly called a "layer" or "pipeline stage" in machine learning frameworks. /// - /// For example, it can be a node of type "Conv" that takes in an image, a filter + /// For example, it can be a node of type "Conv" that takes in an image, a filter /// tensor and a bias tensor, and produces the convolved output. /// public sealed partial class NodeProto : pb::IMessage { @@ -1437,7 +1437,7 @@ namespace Onnx { /// /// Notice that an input of a node in the "algorithm" graph may reference the /// output of a node in the inference graph (but not the other way round). Also, inference - /// node cannot reference inputs of "algorithm". With these restrictions, inference graph + /// node cannot reference inputs of "algorithm". With these restrictions, inference graph /// can always be run independently without training information. /// /// By default, this field is an empty graph and its evaluation does not @@ -1459,7 +1459,7 @@ namespace Onnx { private readonly pbc::RepeatedField initializationBinding_ = new pbc::RepeatedField(); /// /// This field specifies the bindings from the outputs of "initialization" to - /// some initializers in "ModelProto.graph.initializer" and + /// some initializers in "ModelProto.graph.initializer" and /// the "algorithm.initializer" in the same TrainingInfoProto. /// See "update_binding" below for details. /// @@ -2398,7 +2398,7 @@ namespace Onnx { /// /// Graphs /// - /// A graph defines the computational logic of a model and is comprised of a parameterized + /// A graph defines the computational logic of a model and is comprised of a parameterized /// list of nodes that form a directed acyclic graph based on their inputs and outputs. /// This is the equivalent of the "network" or "graph" in many deep learning /// frameworks. @@ -4201,8 +4201,8 @@ namespace Onnx { public const int DenotationFieldNumber = 6; private string denotation_ = ""; /// - /// An optional denotation can be used to denote the whole - /// type with a standard semantic description as to what is + /// An optional denotation can be used to denote the whole + /// type with a standard semantic description as to what is /// stored inside. Refer to https://github.com/onnx/onnx/blob/master/docs/TypeDenotation.md#type-denotation-definition /// for pre-defined type denotations. /// @@ -4970,9 +4970,9 @@ namespace Onnx { public const int ElemTypeFieldNumber = 1; private int elemType_; /// - /// This field MUST NOT have the value of UNDEFINED + /// This field MUST NOT have the value of UNDEFINED /// This field MUST have a valid TensorProto.DataType value - /// This field MUST be present for this version of the IR. + /// This field MUST be present for this version of the IR. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int ElemType { diff --git a/java/src/main/native/ai_onnxruntime_OrtSession_SessionOptions.c b/java/src/main/native/ai_onnxruntime_OrtSession_SessionOptions.c index d84170eef9..b2218e265f 100644 --- a/java/src/main/native/ai_onnxruntime_OrtSession_SessionOptions.c +++ b/java/src/main/native/ai_onnxruntime_OrtSession_SessionOptions.c @@ -26,7 +26,7 @@ #include "onnxruntime/core/providers/armnn/armnn_provider_factory.h" #include "onnxruntime/core/providers/coreml/coreml_provider_factory.h" #include "onnxruntime/core/providers/rocm/rocm_provider_factory.h" -#ifdef USE_DIRECTML +#ifdef USE_DML #include "onnxruntime/core/providers/dml/dml_provider_factory.h" #endif diff --git a/onnxruntime/core/providers/cuda/tensor/where_impl.cu b/onnxruntime/core/providers/cuda/tensor/where_impl.cu index 91d143ddc2..440a805d9a 100644 --- a/onnxruntime/core/providers/cuda/tensor/where_impl.cu +++ b/onnxruntime/core/providers/cuda/tensor/where_impl.cu @@ -1,6 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +#ifdef __GNUC__ +#include "onnxruntime_config.h" +#pragma GCC diagnostic ignored "-Wswitch" +#endif #include #include "core/providers/cuda/shared_inc/cuda_utils.h" #include "core/providers/cuda/cu_inc/common.cuh" diff --git a/onnxruntime/test/platform/threadpool_test.cc b/onnxruntime/test/platform/threadpool_test.cc index ba6e8d96dd..95e124a6a7 100644 --- a/onnxruntime/test/platform/threadpool_test.cc +++ b/onnxruntime/test/platform/threadpool_test.cc @@ -382,6 +382,8 @@ TEST(ThreadPoolTest, TestMultiLoopSections_4Thread_100Loop) { } #ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable : 6387) TEST(ThreadPoolTest, TestStackSize) { ThreadOptions to; // For ARM, x86 and x64 machines, the default stack size is 1 MB @@ -408,6 +410,7 @@ TEST(ThreadPoolTest, TestStackSize) { if (has_thread_limit_info) ASSERT_EQ(high_limit - low_limit, to.stack_size); } +#pragma warning(pop) #endif } // namespace onnxruntime diff --git a/tools/ci_build/github/azure-pipelines/mac-ios-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/mac-ios-ci-pipeline.yml index 56df4b51ec..750aa525ac 100644 --- a/tools/ci_build/github/azure-pipelines/mac-ios-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/mac-ios-ci-pipeline.yml @@ -6,7 +6,7 @@ jobs: steps: - script: | python3 $(Build.SourcesDirectory)/tools/ci_build/build.py \ - --build_dir build/iOS_cpu \ + --skip_submodule_sync --build_dir build/iOS_cpu \ --ios \ --ios_sysroot iphonesimulator \ --osx_arch x86_64 \ @@ -17,7 +17,7 @@ jobs: displayName: (CPU EP) Build onnxruntime for iOS x86_64 and run tests using simulator - script: | python3 $(Build.SourcesDirectory)/tools/ci_build/build.py \ - --build_dir build/iOS_coreml \ + --skip_submodule_sync --build_dir build/iOS_coreml \ --use_coreml \ --ios \ --ios_sysroot iphonesimulator \ diff --git a/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml index 18b5e82925..99be609ebd 100644 --- a/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml @@ -1,37 +1,67 @@ +parameters: +- name: RunOnnxRuntimeTests + displayName: Run Tests? + type: boolean + default: true + jobs: - job: 'build' pool: 'Win-CPU-2019' strategy: - maxParallel: 2 matrix: - debug: + x64_debug: BuildConfig: 'Debug' UseOmp: '--use_openmp' - release: + EnvSetupScript: setup_env.bat + buildArch: x64 + additionalBuildFlags: --use_dnnl --build_java --build_nodejs --gen_doc + msbuildPlatform: x64 + isX86: false + x64_release: BuildConfig: 'RelWithDebInfo' UseOmp: '' + EnvSetupScript: setup_env.bat + buildArch: x64 + additionalBuildFlags: --use_dnnl --build_java --build_nodejs --gen_doc + msbuildPlatform: x64 + isX86: false + x86_release: + BuildConfig: 'RelWithDebInfo' + UseOmp: '' + EnvSetupScript: setup_env_x86.bat + buildArch: x86 + additionalBuildFlags: --x86 + msbuildPlatform: Win32 + isX86: true variables: OrtPackageId: 'Microsoft.ML.OnnxRuntime' - MsbuildArguments: '-detailedsummary -maxcpucount -consoleloggerparameters:PerformanceSummary' + MsbuildArguments: '-maxcpucount' OnnxRuntimeBuildDirectory: '$(Build.BinariesDirectory)' - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - EnvSetupScript: setup_env.bat - buildArch: x64 + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true setVcvars: true ALLOW_RELEASED_ONNX_OPSET_ONLY: '0' timeoutInMinutes: 120 workspace: clean: all - steps: + steps: - task: UsePythonVersion@0 - inputs: - versionSpec: '3.7' - addToPath: true + inputs: + versionSpec: '3.7' + addToPath: true architecture: $(buildArch) - task: NodeTool@0 inputs: versionSpec: '12.x' + force32bit: $(isX86) + + - task: JavaToolInstaller@0 + #Our build machine doesn't have java x86 + condition: and(succeeded(), eq(variables['buildArch'], 'x64')) + inputs: + versionSpec: '11' + jdkArchitectureOption: $(buildArch) + jdkSourceOption: 'PreInstalled' - task: BatchScript@1 displayName: 'setup env' @@ -61,7 +91,7 @@ jobs: $Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=$(buildArch)-windows-static" python setup.py bdist_wheel python -m pip uninstall -y onnx -qq - Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname} + Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname} workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx' displayName: 'Install ONNX' @@ -83,14 +113,14 @@ jobs: displayName: 'Generate cmake config' inputs: scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' - arguments: '--gen_doc --config $(BuildConfig) --build_dir $(Build.BinariesDirectory) $(UseOmp) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --build_wheel --use_dnnl --use_winml --build_shared_lib --enable_onnx_tests --enable_wcos --build_java --build_nodejs' + arguments: '--config $(BuildConfig) --build_dir $(Build.BinariesDirectory) $(UseOmp) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --build_wheel --use_winml --build_shared_lib --enable_onnx_tests --enable_wcos $(additionalBuildFlags)' workingDirectory: '$(Build.BinariesDirectory)' - task: VSBuild@1 displayName: 'Build' inputs: solution: '$(Build.BinariesDirectory)\$(BuildConfig)\onnxruntime.sln' - platform: 'x64' + platform: $(msbuildPlatform) configuration: $(BuildConfig) msbuildArgs: $(MsbuildArguments) msbuildArchitecture: $(buildArch) @@ -127,7 +157,7 @@ jobs: - task: DotNetCoreCLI@2 displayName: 'Test C#' - condition: and(succeeded(), eq(variables['BuildConfig'], 'RelWithDebInfo')) + condition: and(and(succeeded(), eq(variables['BuildConfig'], 'RelWithDebInfo')),eq('${{ parameters.RunOnnxRuntimeTests}}', true)) inputs: command: test projects: '$(Build.SourcesDirectory)\csharp\test\Microsoft.ML.OnnxRuntime.Tests\Microsoft.ML.OnnxRuntime.Tests.csproj' @@ -135,150 +165,55 @@ jobs: arguments: '--configuration $(BuildConfig) -p:Platform="Any CPU" -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=$(OrtPackageId) --blame' workingDirectory: '$(Build.SourcesDirectory)\csharp' - - script: | - mklink /D /J $(Build.BinariesDirectory)\$(BuildConfig)\models $(Build.BinariesDirectory)\models - DIR dist\ /S /B > wheel_filename_file - set /p WHEEL_FILENAME= wheel_filename_file - set /p WHEEL_FILENAME= wheel_filename_file - set /p WHEEL_FILENAME=