This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Fix wrong output path of external project target in MSVC.
AbandonedPublic

Authored by sunho on Sep 11 2022, 6:47 AM.

Details

Reviewers
lhames
sgraenitz
Summary

Fixes wrong output path of external project target in MSVC. It simplifies the conditional to use ".lib" suffix even if MINGW is not defied. (the not MINGW does not hit when MINGW is NOTFOUND) The behavior before this patch in MSVC was outputting ".a" for static libraries.

Diff Detail

Event Timeline

sunho created this revision.Sep 11 2022, 6:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 11 2022, 6:47 AM
sunho requested review of this revision.Sep 11 2022, 6:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 11 2022, 6:47 AM
mstorsjo added inline comments.
compiler-rt/cmake/base-config-ix.cmake
156

This change on its own is probably ok.

llvm/runtimes/CMakeLists.txt
66 ↗(On Diff #459360)

This change will change how runtime libraries are built for a lot of platforms! You can’t sneak a change like this into a patch that is just labeled to change compiler-rt! Cc @MaskRay @phosek

MaskRay added inline comments.
sunho added inline comments.Sep 12 2022, 11:26 PM
llvm/runtimes/CMakeLists.txt
66 ↗(On Diff #459360)

Oh I was not correctly understanding the complexity here. I can drop this change in the mean time -- ORC is totally fine to use the new per-targrt directory even in MSVC.

phosek added inline comments.Sep 12 2022, 11:39 PM
compiler-rt/cmake/base-config-ix.cmake
156

I'm a bit surprised that this is even needed, according to CMake documentation, this should already be the default: https://cmake.org/cmake/help/v3.14/variable/CMAKE_STATIC_LIBRARY_SUFFIX.html

sunho added inline comments.Sep 17 2022, 2:12 PM
compiler-rt/cmake/base-config-ix.cmake
156

@phosek We're using clang-cl to build runtimes target by llvm_ExternalProject_Add. Cmake seems to be setting ".a" suffix when using clang to build MSVC target. This part is a workaround introduced by https://reviews.llvm.org/D24046 to fight this issue.

sunho updated this revision to Diff 461038.Sep 17 2022, 7:48 PM
sunho edited the summary of this revision. (Show Details)

Keep only the part relevant for MSVC.

sunho abandoned this revision.EditedSep 17 2022, 8:23 PM

This is actually not related to the conditionals but related to something in my system or cmake which causes it to set MINGW to true. Abandoning this patch as it is going to break clang-cl building case anyways.