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

Correct usage of toolset and architecture when no configurepreset.generator is defined in the preset. #4208

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Bug Fixes:
- Ensure that tests are updated after a build. [#4148](https://github.com/microsoft/vscode-cmake-tools/pull/4148)
- Fix various GCC compiler errors and GCC linker errors not showing up in Problems View [#2864](https://github.com/microsoft/vscode-cmake-tools/issues/2864)
- Fix reloading presets when included files are changed or renamed and updated. [#3963](https://github.com/microsoft/vscode-cmake-tools/issues/3963)
- Fix the usage of toolset and archiecture in presets without generator set. [#4181](https://github.com/microsoft/vscode-cmake-tools/issues/4181)

## 1.19.52

Expand Down
8 changes: 8 additions & 0 deletions src/drivers/cmakeDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,14 @@ export abstract class CMakeDriver implements vscode.Disposable {
return this._useCMakePresets;
}

get configurePresetArchitecture(): string | preset.ValueStrategy | undefined {
return this._configurePreset?.architecture;
}

get configurePresetToolset(): string | preset.ValueStrategy | undefined {
return this._configurePreset?.toolset;
}

private _configurePreset: preset.ConfigurePreset | null = null;

private _buildPreset: preset.BuildPreset | null = null;
Expand Down
16 changes: 16 additions & 0 deletions src/drivers/cmakeFileApiDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import { CMakeOutputConsumer, StateMessage } from '@cmt/diagnostics/cmake';
import { ConfigureTrigger } from '@cmt/cmakeProject';
import { onConfigureSettingsChange } from '@cmt/ui/util';
import { targetArchFromGeneratorPlatform } from '@cmt/installs/visualStudio';

Check failure on line 35 in src/drivers/cmakeFileApiDriver.ts

View workflow job for this annotation

GitHub Actions / build

'targetArchFromGeneratorPlatform' is declared but its value is never read.

Check failure on line 35 in src/drivers/cmakeFileApiDriver.ts

View workflow job for this annotation

GitHub Actions / build

'targetArchFromGeneratorPlatform' is declared but its value is never read.

Check failure on line 35 in src/drivers/cmakeFileApiDriver.ts

View workflow job for this annotation

GitHub Actions / build

'targetArchFromGeneratorPlatform' is declared but its value is never read.

nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
Expand Down Expand Up @@ -250,6 +251,21 @@
args.push('-A');
args.push(generator.platform);
}
} else {
if (this.useCMakePresets) {
const presetArchitecture = this.configurePresetArchitecture;
const presetToolset = this.configurePresetToolset;
const platform = presetArchitecture ? getValue(presetArchitecture) : undefined;
const toolset = presetToolset ? getValue(presetToolset) : undefined;
if (toolset) {
args.push('-T');
args.push(toolset);
}
if (platform) {
args.push("-A");
args.push(platform);
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/installs/visualStudio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export function targetArchFromGeneratorPlatform(generatorPlatform?: string) {
if (!generatorPlatform) {
return undefined;
}
return vsArchFromGeneratorPlatform[generatorPlatform] || generatorPlatform;
return vsArchFromGeneratorPlatform[generatorPlatform.toLowerCase()] || generatorPlatform;
}

/**
Expand Down
Loading