Skip to content

Commit

Permalink
Add default compiler search paths for msys2 default installation path…
Browse files Browse the repository at this point in the history
…s, fix mingw bugs (microsoft#3056)

* Add default compiler search paths for msys2 default installation paths, fix mingw bugs, fixes microsoft#2880, fixes microsoft#1064, might fix microsoft#460

* Fix linting errors

* Fix PR comments (keep config for backward compatibility, typo, changelog)

* Fix linting bug
  • Loading branch information
philippewarren authored Mar 18, 2023
1 parent 5d2d854 commit 39c7266
Show file tree
Hide file tree
Showing 12 changed files with 220 additions and 110 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Breaking changes:
- The `Run CTest` button in the status bar now only reveals the test explorer, and test results are removed from its text. [PR #3032](https://github.com/microsoft/vscode-cmake-tools/pull/3032)
- All test starting method, such as command `CMake: Run Tests` and test task, now runs through the test explorer. Tests can't run in parallel for now. [PR #3032](https://github.com/microsoft/vscode-cmake-tools/pull/3032)
- Catch test framework support is removed. [PR #3043](https://github.com/microsoft/vscode-cmake-tools/pull/3043)
- Rename `cmake.mingwSearchDirs` to `cmake.additionalCompilerSearchDirs`, make it more general and fix quirks with it. [PR #3056](https://github.com/microsoft/vscode-cmake-tools/pull/3056) [@philippewarren](https://github.com/philippewarren)

Improvements:
- Automatically configure CMake project directories when the kit or the configuration preset is changed. [PR #2973](https://github.com/microsoft/vscode-cmake-tools/pull/2973) [@maxmitti](https://github.com/maxmitti)
Expand All @@ -17,6 +18,7 @@ Improvements:
- When starting debugging, also build the selected build target. [PR #2987](https://github.com/microsoft/vscode-cmake-tools/pull/2987) [@Maddimax](https://github.com/Maddimax)
- Add support for CMake Presets V5. [#2979](https://github.com/microsoft/vscode-cmake-tools/issues/2979)
- Print the build time in the output window. [#3008](https://github.com/microsoft/vscode-cmake-tools/issues/3008)
- Allow using all of MSYS2 MinGW installations, which are also now found by default while scanning for kits if MSYS2 is installed at the default location (`C:\msys64\{wingw64|mingw32|clang64|clang32|clangarm64|ucrt64}\bin`). [PR #3056](https://github.com/microsoft/vscode-cmake-tools/pull/3056) [@philippewarren](https://github.com/philippewarren)

Bug Fixes:
- Check if "CMakeLists.txt" exists after renaming. [#2986](https://github.com/microsoft/vscode-cmake-tools/issues/2986)
Expand All @@ -25,6 +27,7 @@ Bug Fixes:
- CMake tools not fully loaded when opening multi-project folders. [#3000](https://github.com/microsoft/vscode-cmake-tools/issues/3000)
- Expand variables in task's targets while searching matching taks. [#2970](https://github.com/microsoft/vscode-cmake-tools/issues/2970) [@piomis](https://github.com/piomis)
- Fix typo in `cmake.skipConfigureWhenCachePresent`. [#3040](https://github.com/microsoft/vscode-cmake-tools/issues/3040) [@Mlekow](https://github.com/Mlekow)
- Fix MinGW detection when not in PATH using `cmake.mingwSearchDirs` (now named `cmake.additionalCompilerSearchDirs`). [PR #3056](https://github.com/microsoft/vscode-cmake-tools/pull/3056) [@philippewarren](https://github.com/philippewarren)

## 1.13.45
Bug Fixes:
Expand Down
2 changes: 1 addition & 1 deletion docs/cmake-presets.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Use forward slashes (`/`) for paths in `CMakePresets.json` and `CMakeUserPresets

### Add new Configure Presets

To add a new Configure Preset to `CMakePresets.json`, run the **CMake: Add Configure Preset** command. This command lists several Configure Preset templates, along with a **[Scan for Compilers]** option in the command palette. **[Scan for Compilers]** returns all of the GCC and Clang compilers on your `PATH`, all compilers found in `cmake.mingwSearchDir` and `cmake.emscriptenSearchDirs`, and the latest instances of `cl.exe` installed with Visual Studio.
To add a new Configure Preset to `CMakePresets.json`, run the **CMake: Add Configure Preset** command. This command lists several Configure Preset templates, along with a **[Scan for Compilers]** option in the command palette. **[Scan for Compilers]** returns all of the GCC and Clang compilers on your `PATH`, all compilers found in `cmake.additionalCompilerSearchDirs` and `cmake.emscriptenSearchDirs`, and the latest instances of `cl.exe` installed with Visual Studio.

![Screenshot of the list of configure presets.](images/add-configure-preset-vscode.png)

Expand Down
2 changes: 1 addition & 1 deletion docs/cmake-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Options that support substitution, in the table below, allow variable references
| `cmake.generator` | Set to a string to override CMake Tools preferred generator logic. If set, CMake will unconditionally use it as the `-G` CMake generator command line argument. ||no|
| `cmake.installPrefix` | If specified, sets a value for `CMAKE_INSTALL_PREFIX` when running CMake configure. If not set, no value will be passed.</br>If `CMAKE_INSTALL_PREFIX` is set via `cmake.configureArgs` or `cmake.configureSettings`, `cmake.installPrefix` will be ignored.| `null` (no value specified) | yes |
| `cmake.loggingLevel` | A string setting that specifies how much output CMake Tools produces in its output channel. Set to one of `"trace"`, `"debug"`, `"info"`, `"note"`, `"warning"`, `"error"`, or `"fatal"`. `"trace"` is the most verbose.</br></br>Regardless of the logging level, CMake Tools writes all levels of logging to the CMake Tools log file. This file is useful if you need to [troubleshoot CMake Tools](troubleshoot.md) | `"info"` | no |
| `cmake.mingwSearchDirs`| List of paths to search for a MinGW installation. This means that GCC does not need to be on your `$PATH` for it to be found via kit scanning. For example: `["C:\\MinGW\\bin"]` (Search in C:\MinGW\bin for a MinGW installation) | [] | no |
| `cmake.additionalCompilerSearchDirs`| List of paths to search for additional compilers, like a MinGW installation. This means that GCC does not need to be on your `$PATH` for it to be found via kit scanning. For example: `["C:\\MinGW\\bin"]` (Search in C:\MinGW\bin for a MinGW installation) | [] | no |
| `cmake.parallelJobs` | Specify the number of jobs run in parallel during the build. Using the value `1` will disable build parallelism. | | no |
| `cmake.preferredGenerators` | A list of strings of generator names to try, in order, when configuring a CMake project for the first time. | | no |
| `cmake.saveBeforeBuild` | If `true` (the default), saves open text documents when build or configure is invoked before running CMake. | `true` | no |
Expand Down
75 changes: 47 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1105,34 +1105,42 @@
"default": {},
"additionalProperties": {
"oneOf": [
{
"type": "string"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [ "", "BOOL", "STRING", "FILEPATH", "PATH"]
},
"value": {
}
},
"additionalProperties": false,
"required": ["type", "value"]
{
"type": "string"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"",
"BOOL",
"STRING",
"FILEPATH",
"PATH"
]
},
"value": {}
},
"additionalProperties": false,
"required": [
"type",
"value"
]
}
]
},
"description": "%cmake-tools.configuration.cmake.configureSettings.description%",
Expand Down Expand Up @@ -1523,6 +1531,17 @@
},
"default": [],
"description": "%cmake-tools.configuration.cmake.mingwSearchDirs.description%",
"scope": "window",
"markdownDeprecationMessage": "**Deprecated**: Please use `#cmake.additionalCompilerSearchDirs#` instead."
},
"cmake.additionalCompilerSearchDirs": {
"type": "array",
"items": {
"type": "string",
"description": "%cmake-tools.configuration.cmake.searchDirs.items.description%"
},
"default": [],
"description": "%cmake-tools.configuration.cmake.additionalCompilerSearchDirs.description%",
"scope": "window"
},
"cmake.emscriptenSearchDirs": {
Expand Down Expand Up @@ -2190,4 +2209,4 @@
"extensionPack": [
"twxs.cmake"
]
}
}
45 changes: 38 additions & 7 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,28 @@
"cmake-tools.configuration.cmake.ctestPath.description": "Path to CTest executable. If null, will be inferred from cmake.cmakePath (recommended to leave null).",
"cmake-tools.configuration.cmake.ctest.parallelJobs.description": "The number of parallel test jobs. Use zero to use the value of cmake.parallelJobs.",
"cmake-tools.configuration.cmake.parseBuildDiagnostics.description": "Parse compiler output for warnings and errors.",
"cmake-tools.configuration.cmake.enabledOutputParsers.description": { "message": "Output parsers to use. Supported parsers `cmake`, `gcc`, `gnuld` for GNULD-style linker output, `msvc` for Microsoft Visual C++, `ghs` for the Green Hills compiler with --no_wrap_diagnostics --brief_diagnostics, and `diab` for the Wind River Diab compiler.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
"cmake-tools.configuration.cmake.enabledOutputParsers.description": {
"message": "Output parsers to use. Supported parsers `cmake`, `gcc`, `gnuld` for GNULD-style linker output, `msvc` for Microsoft Visual C++, `ghs` for the Green Hills compiler with --no_wrap_diagnostics --brief_diagnostics, and `diab` for the Wind River Diab compiler.",
"comment": [
"Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered."
]
},
"cmake-tools.configuration.cmake.debugConfig.description": "The debug configuration to use when debugging a target.",
"cmake-tools.configuration.cmake.debugConfig.symbolSearchPath.description": "Visual Studio debugger symbol search paths.",
"cmake-tools.configuration.cmake.debugConfig.additionalSOLibSearchPath.description": "Paths for GDB or LLDB to search for .so files.",
"cmake-tools.configuration.cmake.debugConfig.externalConsole.description": "Launch an external console for the program.",
"cmake-tools.configuration.cmake.debugConfig.console.description": { "message": "Where to launch the debug target. Defaults to `internalConsole` if not defined.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
"cmake-tools.configuration.cmake.debugConfig.console.internalConsole.description": { "message": "Output to the VS Code Debug Console. This doesn't support reading console input (ex:`std::cin` or `scanf`).", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
"cmake-tools.configuration.cmake.debugConfig.console.description": {
"message": "Where to launch the debug target. Defaults to `internalConsole` if not defined.",
"comment": [
"Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered."
]
},
"cmake-tools.configuration.cmake.debugConfig.console.internalConsole.description": {
"message": "Output to the VS Code Debug Console. This doesn't support reading console input (ex:`std::cin` or `scanf`).",
"comment": [
"Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered."
]
},
"cmake-tools.configuration.cmake.debugConfig.console.integratedTerminal.description": "VS Code's integrated terminal.",
"cmake-tools.configuration.cmake.debugConfig.console.externalTerminal.description": "Console applications will be launched in an external terminal window. The window will be reused in relaunch scenarios and will not automatically disappear when the application exits.",
"cmake-tools.configuration.cmake.debugConfig.console.newExternalWindow.description": "Console applications will be launched in their own external console window which will end when the application stops. Non-console applications will run without a terminal, and stdout/stderr will be ignored.",
Expand Down Expand Up @@ -116,6 +131,7 @@
"cmake-tools.configuration.cmake.buildEnvironment.description": "Environment variables to pass to CMake during build.",
"cmake-tools.configuration.cmake.testEnvironment.description": "Environment variables to pass to CTest.",
"cmake-tools.configuration.cmake.mingwSearchDirs.description": "Directories where MinGW may be installed.",
"cmake-tools.configuration.cmake.additionalCompilerSearchDirs.description": "Additional directories to search for compilers.",
"cmake-tools.configuration.cmake.searchDirs.items.description": "Path to a directory.",
"cmake-tools.configuration.cmake.emscriptenSearchDirs.description": "Directories where Emscripten may be installed.",
"cmake-tools.configuration.cmake.mergedCompileCommands.description": "Recursively collect and merge all compile_commands.json found in the cmake.buildDirectory.",
Expand Down Expand Up @@ -150,7 +166,12 @@
"cmake-tools.configuration.cmake.useCMakePresets.description": "Use CMakePresets.json to configure drive CMake configure, build, and test. When using CMakePresets.json, kits, variants, and some settings in settings.json will be ignored.",
"cmake-tools.configuration.cmake.allowCommentsInPresetsFile.description": "Allow the use of JSON extensions such as comments in CMakePresets.json. Please note that your CMakePresets.json file may be considered invalid by other IDEs or on the command line if you use non-standard JSON.",
"cmake-tools.configuration.cmake.allowUnsupportedPresetsVersions.description": "Enables the use of presets files that are using features from the versions that CMake Tools extension doesn't currently support. Unknown properties and macros will be ignored.",
"cmake-tools.configuration.cmake.ignoreCMakeListsMissing.description": { "message": "If `true`, the extension will not ask the user to select a CMakeLists.txt file for configuration when one is found in the workspace but not in the root folder.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
"cmake-tools.configuration.cmake.ignoreCMakeListsMissing.description": {
"message": "If `true`, the extension will not ask the user to select a CMakeLists.txt file for configuration when one is found in the workspace but not in the root folder.",
"comment": [
"Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered."
]
},
"cmake-tools.configuration.cmake.launchBehavior.description": "Controls what happens with the launch terminal when you launch a target.",
"cmake-tools.configuration.cmake.automaticReconfigure.description": "Automatically configure CMake project directories when the kit or the configuration preset is changed.",
"cmake-tools.taskDefinitions.properties.label.description": "The name of the task",
Expand All @@ -159,10 +180,20 @@
"cmake-tools.taskDefinitions.properties.preset.description": "CMake preset name. This is a configuration, build or test preset, based on the CMake command",
"cmake-tools.taskDefinitions.properties.options.description": "Additional command options",
"cmake-tools.taskDefinitions.properties.options.cwd.description": "The current working directory of the executed program or script. If omitted Code's current workspace root is used.",
"cmake-tools.taskDefinitions.properties.options.environment.markdownDescription": { "message": "Environment variables in the format of \"name\": \"value\".", "comment": [ "\"name\": \"value\" should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation should not be altered." ] },
"cmake-tools.taskDefinitions.properties.options.environment.markdownDescription": {
"message": "Environment variables in the format of \"name\": \"value\".",
"comment": [
"\"name\": \"value\" should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation should not be altered."
]
},
"cmake-tools.taskDefinitions.properties.details.description": "Additional details of the task",
"cmake-tools.configuration.cmake.launchBehavior.reuseTerminal.markdownDescriptions": "The launch terminal instance is reused and the target will launch as soon as the terminal is idle.",
"cmake-tools.configuration.cmake.launchBehavior.breakAndReuseTerminal.markdownDescriptions": { "message": "The launch terminal instance is reused and a `break` command is sent to terminate any active foreground process before launching the target.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
"cmake-tools.configuration.cmake.launchBehavior.breakAndReuseTerminal.markdownDescriptions": {
"message": "The launch terminal instance is reused and a `break` command is sent to terminate any active foreground process before launching the target.",
"comment": [
"Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered."
]
},
"cmake-tools.configuration.cmake.launchBehavior.newTerminal.markdownDescriptions": "A new terminal instance is created and the target is launched in it. Existing terminals are not automatically cleaned up.",
"cmake-tools.configuration.cmake.loadCompileCommands.description" : "Controls whether the extension reads compile_commands.json to enable single file compilation."
"cmake-tools.configuration.cmake.loadCompileCommands.description": "Controls whether the extension reads compile_commands.json to enable single file compilation."
}
Loading

0 comments on commit 39c7266

Please sign in to comment.