This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Add option LLVM_FORCE_CREATE_SYMLINKS
ClosedPublic

Authored by thieta on Oct 10 2022, 6:38 AM.

Details

Summary

On Windows we don't create symlinks for the binaries (clang++, clang-cl)
since the support requires special setup (group policy settings and
you need to know exactly our distribution story). But if you know
about these things and have a controlled environment there is a lot
of storage to be saved, so let's add a manual opt-in for using symlinks
on Windows with LLVM_FORCE_CREATE_SYMLINKS=ON.

Diff Detail

Event Timeline

thieta created this revision.Oct 10 2022, 6:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 10 2022, 6:38 AM
thieta requested review of this revision.Oct 10 2022, 6:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 10 2022, 6:38 AM

I'd prefer to have an option like LLVM_USE_SYMLINKS and default to ON when CMAKE_HOST_UNIX, otherwise OFF.

thieta updated this revision to Diff 466713.Oct 11 2022, 12:22 AM

Changed the option to LLVM_USE_SYMLINKS

I'd prefer to have an option like LLVM_USE_SYMLINKS and default to ON when CMAKE_HOST_UNIX, otherwise OFF.

Yeah sounds good. And I also fixed the relative symlinks on Windows.

This looks reasonable to me (although I haven't dug through the code to see if there are more cases that would need to be set in sync). Is it kosher to add new end-user options like this in a nested cmake module file?

I'll leave it open for @phosek to comment on in any case.

This looks reasonable to me (although I haven't dug through the code to see if there are more cases that would need to be set in sync). Is it kosher to add new end-user options like this in a nested cmake module file?

I'll leave it open for @phosek to comment on in any case.

There are other places where symlinks are used and some similar logic is being applied - like here:
https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/builtins/CMakeLists.txt#L533

I am not sure it's worth to fix this at the same time since that has to do with symlinking the files when building rather then the finished distribution.

Regarding option() in this cmakefile - I had the same idea, but I saw several option() calls in this file already, so I figured it was a pattern already.

phosek accepted this revision.Oct 11 2022, 11:23 PM

This looks reasonable to me (although I haven't dug through the code to see if there are more cases that would need to be set in sync). Is it kosher to add new end-user options like this in a nested cmake module file?

I'll leave it open for @phosek to comment on in any case.

There are other places where symlinks are used and some similar logic is being applied - like here:
https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/builtins/CMakeLists.txt#L533

I am not sure it's worth to fix this at the same time since that has to do with symlinking the files when building rather then the finished distribution.

This would be a separate option since we don't use AddLLVM.cmake module in that context so I think it's better to do it as a separate change.

Regarding option() in this cmakefile - I had the same idea, but I saw several option() calls in this file already, so I figured it was a pattern already.

Those are only defined in functions, there are no top-level options in this module. I'd move this option to llvm/CMakeLists.txt.

This revision is now accepted and ready to land.Oct 11 2022, 11:23 PM
thieta updated this revision to Diff 467046.Oct 12 2022, 1:09 AM

Moved option to llvm/CMakeLists.txt

This revision was automatically updated to reflect the committed changes.