Skip to content

Commit

Permalink
[HIPIFY][ROCm#1021][build][MSVS][fix][partial] Fix for error C2365
Browse files Browse the repository at this point in the history
…occurred on VS 2022 with ToT clang 18.0.0git

[Synopsis]
+ Root cause is LLVM's change [Driver] Refactor to use llvm Option's new Visibility flags (SHA-1: 9478f661c26fbc22491218477917df5d8d73c51c)
+ But LLVM/clang itself is built correctly by VS 2022

[Solution]
+ Explicit setting of `UseStandardPreprocessor` (`/Zc:preprocessor`) eliminates the preprocessor's macro redefinition error

[ToDo]
+ Check hipify-clang builds by MSVS 2017 and 2019 against ToT LLVM (18.0.0git), LLVM 17.0.0-preview, and LLVM 16.0.x
  • Loading branch information
emankov committed Sep 15, 2023
1 parent 968e5e5 commit 8ffed11
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ if (NOT HIPIFY_CLANG_TESTS_ONLY)
if(MSVC)
target_link_libraries(hipify-clang PRIVATE version)
target_compile_options(hipify-clang PRIVATE ${STD} /Od /GR- /EHs- /EHc-)
if((LLVM_PACKAGE_VERSION VERSION_EQUAL "18.0.0" OR LLVM_PACKAGE_VERSION VERSION_GREATER "18.0.0") AND MSVC_VERSION VERSION_GREATER "1929")
target_compile_options(hipify-clang PRIVATE /Zc:preprocessor)
endif()
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} /SUBSYSTEM:WINDOWS")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${STD} -pthread -fno-rtti -fvisibility-inlines-hidden")
Expand Down

0 comments on commit 8ffed11

Please sign in to comment.