From 0dcc6035b134d31faae6ba41e6d1ebe54b43003b Mon Sep 17 00:00:00 2001 From: Changming Sun Date: Mon, 6 Apr 2020 11:19:09 -0700 Subject: [PATCH] Disable strong inline (#3399) To bypass a MSVC bug. Without this change, people can't use VS2017 to build onnxruntime in Release or RelWithDebInfo mode. --- cmake/CMakeLists.txt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 6a48a01a73..fdfd64cb83 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -167,7 +167,8 @@ file (STRINGS "${REPO_ROOT}/VERSION_NUMBER" ORT_VERSION) # under the MPL2 and possibly more permissive licenses (like BSD). add_definitions(-DEIGEN_MPL2_ONLY) if(MSVC) - add_definitions(-DEIGEN_HAS_CONSTEXPR -DEIGEN_HAS_VARIADIC_TEMPLATES -DEIGEN_HAS_CXX11_MATH -DEIGEN_HAS_CXX11_ATOMIC) + add_definitions(-DEIGEN_HAS_CONSTEXPR -DEIGEN_HAS_VARIADIC_TEMPLATES -DEIGEN_HAS_CXX11_MATH -DEIGEN_HAS_CXX11_ATOMIC + -DEIGEN_STRONG_INLINE=inline) endif() if(onnxruntime_CROSS_COMPILING) @@ -211,12 +212,6 @@ if (MSVC) set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Link protobuf to static runtime libraries" FORCE) set(gtest_force_shared_crt ON CACHE BOOL "Use shared (DLL) run-time lib for gtest" FORCE) endif() - #A compile option to improve code generation time, mostly for the code that heavily uses eigen. - check_cxx_compiler_flag(/d2ReducedOptimizeHugeFunctions HAS_D2ROHF) - if(HAS_D2ROHF) - SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /d2ReducedOptimizeHugeFunctions") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /d2ReducedOptimizeHugeFunctions") - endif() #Always enable exception handling, even for Windows ARM string(APPEND CMAKE_CXX_FLAGS " /EHsc") string(APPEND CMAKE_C_FLAGS " /EHsc")