Supporting LLVM library usage on Windows with CMake without local build

this page sez,

clients of LLVM can now reliably use CMake to develop their own LLVM-based projects against an installed version of LLVM regardless of how it was built.

(emphasis mine)

…and it’s true! Except on Windows. Because the Windows installers don’t install the necessary cmake files. If you want to link against LLVM on Windows with LLVM’s CMake support, you need to build LLVM from source. That is a huge waste of developer and CI resources.

Howzabout shipping those files in the binary installer? Failing that, maybe someone can write instructions for overlaying the necessary part of the source distribution onto a binary installation?

Thanks!

I’m sorry for not replying on topic, but can you avoid making your post unnecessarily harder to read for non-native English speakers?

2 Likes

Sorry! Discourse won’t let me edit the post now. Next time I’ll do better.

It’s not just the CMake files; the libraries aren’t in the distribution at all. See llvm installer on windows missing LLVMConfig.cmake · Issue #53052 · llvm/llvm-project · GitHub .

Just wanted to quickly chime in and mention that this would be nice for Rust-Enzyme (Enzyme being an llvm based autodiff / incubator project). Rust ships LLVM in various different ways and on different platforms and having this would be one piece to simplify building Enzyme as part of Rust on Windows.
E.g. Windows support · Issue #54 · EnzymeAD/rust · GitHub

I’ve made a start here.

I added the other platforms when I realized that developing against LLVM without asserts enabled is quite hazardous to the correctness of the thing under development, so all of these builds have asserts enabled.

At some point it would be good to have debug builds, and release builds with debug info. If anyone would like to collaborate on improving/expanding this system, that would be great.

For anyone reading this: my system has stabilized (I’ve stopped rebuilding LLVM 17 as I believe I’m getting good results) and produces Debug and MinSizeRel builds with asserts enabled. Binaries are available under Releases.