Skip to content

Improve support of clang #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

MisterDA
Copy link
Contributor

@MisterDA MisterDA commented Mar 27, 2025

I'm trying to use clang everywhere. The MSYS2 CLANG64 environment uses UCRT, but we're missing bits to link with it right now. It is however possible to use clang with MSYS2 MINGW64 environment, or with Cygwin+mingw, or with the MSYS2 MSYS and Cygwin+cygwin1.dll environments (although in this last two cases clang packages are currently unmaintained).
It is also possible to use clang-cl instead of MSVC.

This PR makes sure that flexlink doesn't default to GCC or MSVC when clang is desired instead.

The first step is to retain the compilers used when building for searching library directories. This allows using alternative compilers, otherwise, FlexDLL would default to querying GCC, which may report different path list than clang.
The second step teaches FlexDLL to parse clang's output. clang.exe -print-search-dirs doesn't print an install field and its libraries path list is already in mixed-style (Windows path with forward slashes separated by semicolons). This happens when using clang in both MSYS2 MINGW64 or CLANG64 environments.

@MisterDA MisterDA force-pushed the clang-print-search-dirs branch 11 times, most recently from 4888cc4 to b4a33c4 Compare April 2, 2025 18:00
MisterDA added 3 commits April 2, 2025 20:22
Record the compiler used during FlexDLL's build in a new module.

In the case of MINGW* and CYGWIN64 toolchains, this allows using
alternative compilers such as clang. Otherwise, FlexDLL would default
to querying GCC, which may report different path list than clang.

In the case of MSVC and MSVC64 toolchains, this allows using
alternative compilers such as clang-cl. Otherwise, FlexDLL would
default to using cl.exe, which may not be desired or even available.
`clang -print-search-dirs` doesn't print an `install` field and its
`libraries` path list is already in mixed-style (Windows path with
forward slashes separated by semicolons). This happens when using
clang in both MSYS2 MINGW64 or CLANG64 environments.
The `libraries` path list may also contain empty paths, strip them.
@MisterDA MisterDA force-pushed the clang-print-search-dirs branch from b4a33c4 to 52775f6 Compare April 2, 2025 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant