mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Add /Zc:preprocessor for torch libraries in MSVC builds (#147825)
Fixes #ISSUE_NUMBER Pull Request resolved: https://github.com/pytorch/pytorch/pull/147825 Approved by: https://github.com/janeyx99
This commit is contained in:
parent
6503b4a96e
commit
8fe7ec6721
|
|
@ -362,6 +362,10 @@ function(torch_compile_options libname)
|
|||
# 2. For MSVC VERSION: https://cmake.org/cmake/help/latest/variable/MSVC_TOOLSET_VERSION.html
|
||||
target_compile_options(${libname} PUBLIC $<$<COMPILE_LANGUAGE:CXX>:/permissive->)
|
||||
endif()
|
||||
# This option enables a token-based preprocessor that conforms to C99 and C++11 and later standards.
|
||||
# This option is available since VS 2017.
|
||||
# For MS official doc: https://learn.microsoft.com/en-us/cpp/build/reference/zc-preprocessor
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:preprocessor" PARENT_SCOPE)
|
||||
|
||||
if(${MSVC_TOOLSET_VERSION} GREATER_EQUAL 143)
|
||||
# Add /d2implyavx512upperregs- to disable compiler over-aggressive optimization, which caused involeved AVX512 register on AVX2 machine.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user