Move around the ordering of find_visual_studio_and_windows_sdk

This commit is contained in:
gingerBill
2026-06-29 16:36:21 +01:00
parent 1cdf314015
commit ac6a0f9a40

View File

@@ -761,17 +761,27 @@ gb_internal void find_visual_studio_paths_from_env_vars(Find_Result *result) {
gb_internal Find_Result find_visual_studio_and_windows_sdk() {
Find_Result r = {};
find_windows_kit_paths(&r);
find_visual_studio_by_fighting_through_microsoft_craziness(&r);
// Prefer the toolset exported into the environment (e.g. by vsdevcmd) so the
// linker uses the same MSVC toolset that compiled our C++ dependencies. The COM
// autodetection grabs the first installed Visual Studio, which may be an older
// toolset whose runtime libraries lack symbols that the newer-built libraries
// reference. Fall back to autodetection when the environment is bare.
find_visual_studio_paths_from_env_vars(&r);
bool vs_found =
r.vs_exe_path.len &&
r.vs_library_path.len ;
if (!vs_found) {
find_visual_studio_by_fighting_through_microsoft_craziness(&r);
}
bool sdk_found =
r.windows_sdk_bin_path.len &&
r.windows_sdk_um_library_path.len &&
r.windows_sdk_ucrt_library_path.len ;
bool vs_found =
r.vs_exe_path.len &&
r.vs_library_path.len ;
if (!sdk_found) {
find_windows_kit_paths_from_env_vars(&r);
}