Windows: Use local configuration for LLVM when linking dynamically #14101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Similar to how
openssl_VERSION
is already used on Windows,LLVM
will now locate the first file calledllvm_VERSION
fromCRYSTAL_LIBRARY_PATH
, reading its contents to configure LLVM, rather than running%LLVM_CONFIG%
. This file should consist of 3 lines:llvm-config --version
, using the samellvm-config.exe
that builtLLVM-C.dll
llvm-config --targets-built
llvm-config --system-libs
(we assume--libs --ldflags
do nothing more than locatingLLVM-C.lib
in the original LLVM installation)On my LLVM 18-dev build, the file looks like this:
Then to make dynamic linking work, copy
lib/LLVM-C.lib
from LLVM to the Crystal installation'slib/llvm-dynamic.lib
, as well asbin/LLVM-C.dll
to the Crystal compiler's directory. This means we will be able to distribute LLVM as a dynamic-only library on Windows, without having to also distributellvm-config.exe
at all, since the above configuration is essentially synchronized to the DLL provided by Crystal.This PR does not touch our Windows CI, that will be the next step.