Skip to content

Commit

Permalink
Don't require Ninja or Make on PATH when checking generators (#3927)
Browse files Browse the repository at this point in the history
  • Loading branch information
jophippe authored Jul 23, 2024
1 parent a2de3ee commit bbc74d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 23 deletions.
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:
- Fix localized file path for schema files. [#3872](https://github.com/microsoft/vscode-cmake-tools/issues/3872)
- Disable annoy and invalid extenion message about fix windows sdk for MSVC 2022. [#3837](https://github.com/microsoft/vscode-cmake-tools/pull/3837)
- Fix re-using a terminal for launching even when the environment has changed. [#3478](https://github.com/microsoft/vscode-cmake-tools/issues/3478)
- Don't require Ninja or Make on command line when checking for supported generators. [#3924](https://github.com/microsoft/vscode-cmake-tools/issues/3924)

## 1.18.43

Expand Down
32 changes: 9 additions & 23 deletions src/drivers/cmakeDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -984,25 +984,15 @@ export abstract class CMakeDriver implements vscode.Disposable {

for (const gen of preferredGenerators) {
const gen_name = gen.name;
const generator_present = await (async (): Promise<boolean> => {
if (gen_name === 'Ninja' || gen_name === 'Ninja Multi-Config') {
return await this.testHaveCommand('ninja') || this.testHaveCommand('ninja-build');
}
if (gen_name === 'MinGW Makefiles') {
return platform === 'win32' && this.testHaveCommand('mingw32-make');
}
if (gen_name === 'NMake Makefiles') {
return platform === 'win32' && this.testHaveCommand('nmake', ['/?']);
}
if (gen_name === 'Unix Makefiles') {
return this.testHaveCommand('make');
}
if (gen_name === 'MSYS Makefiles') {
return platform === 'win32' && this.testHaveCommand('make');
if (gen_name === 'Ninja' || gen_name === 'Ninja Multi-Config' ||
gen_name === 'Unix Makefiles') {
return gen;
} else if (gen_name === 'MinGW Makefiles' || gen_name === 'NMake Makefiles' ||
gen_name === 'MSYS Makefiles') {
if (platform === 'win32') {
return gen;
}
return false;
})();
if (!generator_present) {
} else {
const vsMatch = /^(Visual Studio \d{2} \d{4})($|\sWin64$|\sARM$)/.exec(gen.name);
if (platform === 'win32' && vsMatch) {
return {
Expand All @@ -1014,12 +1004,8 @@ export abstract class CMakeDriver implements vscode.Disposable {
if (gen.name.toLowerCase().startsWith('xcode') && platform === 'darwin') {
return gen;
}

// If the generator isn't found, move on to the next one
continue;
} else {
return gen;
}
// If the generator isn't supported on the current system, move on to the next one.
}
return null;
}
Expand Down

0 comments on commit bbc74d8

Please sign in to comment.