Skip to content
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

SCons: Detect msvc compiler version #91069

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Repiteo
Copy link
Contributor

@Repiteo Repiteo commented Apr 23, 2024

Expands the functionality of get_compiler_version by supporting msvc as an environment. Currently sets the display version to major/minor/patch as it's a 3-int tuple already, and the full version is assigned to metadata1. Doing so allows us to cutoff unsupported Visual Studio versions (anything earlier than modern VS2017) like we do with GCC/Clang. What's more, we can apply a C standard for msvc on supported versions (16.8 and later).

During this process, I also created the CompilerVersion class, which replaces the previous dictionary implementation. This grants proper type-awareness & helped cleanup redundancies in both get_compiler_version and any script using that function.

@akien-mga
Copy link
Member

Nice work, I've also been meaning to refactor the compiler version checks a bit.

One thing worth looking into, is what info SCons already collected with their own hacky methods:

image

We may be able to replace some of our hacky calls to CXX to try to get version information by just using what SCons knows, provided that it's more or at least as reliable as what we currently have.

@Repiteo Repiteo force-pushed the scons/msvc-detect-compiler branch 2 times, most recently from d1fa3ae to f528f6e Compare April 23, 2024 18:01
@Repiteo
Copy link
Contributor Author

Repiteo commented Apr 23, 2024

I'll do some checks with those environment variables to see if they line up with what we end up pulling. If they do, that simplifies matters significantly.

• Can now specify C standard for msvc if the version is supported
• Compiler version now handled as class for convenience
@Repiteo Repiteo marked this pull request as draft April 23, 2024 18:34
@Repiteo
Copy link
Contributor Author

Repiteo commented Apr 23, 2024

Converted to draft because it seems like SCons' hacky methods check msvc specifically, rather than trying to pull the Visual Studio version. I haven't considered how these configuations would appear to someone who only uses buildtools instead of the full Visual Studio setup & I'm not certain how that could best be tested atm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants