Repository navigation
MSVC features - #952
MSVC features#952llunak wants to merge 13 commits into
Conversation
I picked only the compiler commits from: ccache#162 The following commits I've adapted to the latest ccache C++ code: 375fe24: Add compiler_is_msvc() and MSVC specific option table. 7e01763: Add handling of /Fo option (replaces -o, but shall have no space) 0c5cd25: Manage /E, /c equivalence. -g is gcc only. -O or /O is msvc only. 4f61b59: MSVC send part of the error/warning messages to STDOUT, so concat wit…
MSVC outputs some messages to stdout instead of stderr, so cache stdout in addition to stderr, and remove the merge-to-stderr hack.
Since MSVC understands both /option and -option, change all of them to -option, which means now old code handling e.g. -U gets reused, and this also simplifies handling of both variants (/Fo was handled, but -Fo wasn't). The list had two options -P and -u that mean something else for MSVC than it does for GCC, so handle those explicitly.
These are used by compiler but they also #define some things, so they need to be passed to both steps.
439e97f to
45ab2a1
Compare
This more or less maps to PCH support for GCC/Clang, just handle the /Yu and /Fp options. Note that MSVC is apparently unable to generate the same PCH from the same sources, just like GCC, so a rebuild that also rebuilds the PCH will get cache misses. So either somebody can add support for -Yc (if caching those huge PCHs is a good idea), or CCACHE_PCH_EXTSUM can be used (with a checksum based on preprocessed PCH input, i.e. -E instead of -c -Yc).
Based on -showIncludes, which prints included files on stdout with a certain text prefix. Otherwise pretty similar to depend mode handling for GCC. This makes MSVC building way faster.
Without this, clang-cl is detected as clang and then ccache barfs because clang-cl produces stdout output. Since clang-cl is technically sort of cl and and sort of clang, add is_compiler_group_cl() and is_compiler_group_clang() to check similar compilers easily instead of enumerating them repeatedly.
Everything after it should be passed to the linker, which conflicts with ccache appending its extra arguments when calling the compiler. This probably could be handled somehow, but ccache shouldn't cache compilations that also link, so either the option doesn't belong there anyway, or the compilation cannot be cached.
While MSVC technically has that option as deprecated, it's a source of trouble with the way ccache curently handles the option, and since it broke ccache's debug output, it was hard to find.
|
Should this be closed? Rebased? |
Should be rebased. The features are very welcome! |
|
Rebased and pushed as #987. |
|
Please split this PR into one PR per feature where feasible. That way it's easier to review, discuss and apply them individually. Super quick review:
|
|
Regarding the depend mode, here is what the ninja manual has to say to their corresponding feature:
The user doesn't have to add ccache will tap in and get the dependency information, since it's already there, but not in the form of a |
|
@cristianadam wrote:
Thanks for the clarification. @orgads wrote:
I'll close it! |
These changes makes various MSVC-related features work. This PR is based on #954.