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.
This commit is contained in:
Changming Sun 2020-04-06 11:19:09 -07:00 committed by GitHub
parent d361121d98
commit 0dcc6035b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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")