Fix presets for msvc compilers with x86 outputs (#2072)
This commit is contained in:
Родитель
b3c82766af
Коммит
6a82ebb273
12
src/kit.ts
12
src/kit.ts
|
@ -548,7 +548,7 @@ export function kitHostTargetArch(hostArch: string, targetArch?: string, amd64Al
|
|||
// instead of hard coding for win32 and x86.
|
||||
// Currently, there is no need of a similar overwrite operation on hostArch,
|
||||
// because CMake host target does not have the same name mismatch with VS.
|
||||
targetArch = vsArchFromGeneratorPlatform[targetArch] || targetArch;
|
||||
targetArch = targetArchFromGeneratorPlatform(targetArch);
|
||||
|
||||
return (hostArch === targetArch) ? hostArch : `${hostArch}_${targetArch}`;
|
||||
}
|
||||
|
@ -839,6 +839,16 @@ const vsArchFromGeneratorPlatform: {[key: string]: string} = {
|
|||
win32: 'x86'
|
||||
};
|
||||
|
||||
/**
|
||||
* Turns 'win32' into 'x86' for target architecture.
|
||||
*/
|
||||
export function targetArchFromGeneratorPlatform(generatorPlatform?: string) {
|
||||
if (!generatorPlatform) {
|
||||
return undefined;
|
||||
}
|
||||
return vsArchFromGeneratorPlatform[generatorPlatform] || generatorPlatform;
|
||||
}
|
||||
|
||||
/**
|
||||
* Preferred CMake VS generators by VS version
|
||||
*/
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as logging from '@cmt/logging';
|
|||
import { EnvironmentVariables, execute } from '@cmt/proc';
|
||||
import { expandString, ExpansionOptions } from '@cmt/expand';
|
||||
import paths from '@cmt/paths';
|
||||
import { effectiveKitEnvironment, getKitEnvironmentVariablesObject, Kit } from '@cmt/kit';
|
||||
import { effectiveKitEnvironment, getKitEnvironmentVariablesObject, Kit, targetArchFromGeneratorPlatform } from '@cmt/kit';
|
||||
import { compareVersions, vsInstallations } from '@cmt/installs/visual-studio';
|
||||
|
||||
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
|
||||
|
@ -666,9 +666,8 @@ async function expandConfigurePresetHelper(folder: string,
|
|||
const kit = kits[i];
|
||||
if (kit.visualStudio && !kit.compilers) {
|
||||
const version = vsVersions.get(kit.visualStudio);
|
||||
if (kit.preferredGenerator &&
|
||||
(kit.visualStudioArchitecture === arch || kit.preferredGenerator.platform === arch) &&
|
||||
kit.preferredGenerator.toolset === ('host=' + toolset.host)) {
|
||||
if (kit.preferredGenerator && targetArchFromGeneratorPlatform(kit.preferredGenerator.platform) === arch &&
|
||||
(kit.visualStudioArchitecture === toolset.host || kit.preferredGenerator.toolset === ('host=' + toolset.host))) {
|
||||
if (toolset.version && version?.startsWith(toolset.version)) {
|
||||
latestVsVersion = version;
|
||||
latestVsIndex = i;
|
||||
|
|
Загрузка…
Ссылка в новой задаче