Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Feature/ninja multi presets support #15

Conversation

Jason5480
Copy link
Contributor

In the first CMake presets integration I used Ninja as the default generator for the presets cpp-best-practices/gui_starter_template#175 (comment).
With those changes "Ninja Multi-Config" generator was made as the default. That will have as a result a faster switch time between Debug and Release builds and will also be consistent with the CI that also uses this generator.
P.S. @lefticus this might be useful for the Game Jam! not mandatory though.

@lefticus
Copy link
Member

@Jason5480 Sorry I didn't see this PR sooner. I'm hoping to continue to extend the presets for consistency with the developer_mode user_mode settings also (so there's a conflict here right now)

We also now have #16 open, if you think you could give a look at that one.

I'm very much not familiar with CMakePresets and just kind of blindly doing things that seem to work.

@Jason5480
Copy link
Contributor Author

Jason5480 commented Mar 30, 2022

@Jason5480 Sorry I didn't see this PR sooner. I'm hoping to continue to extend the presets for consistency with the developer_mode user_mode settings also (so there's a conflict here right now)

We also now have #16 open, if you think you could give a look at that one.

I'm very much not familiar with CMakePresets and just kind of blindly doing things that seem to work.

The PR #16 is ready, and the added functionality is extremely useful. I will rebase based on that!
Now for the developer/user mode I faced some problems on windows that made the cmake configuration hang. Maybe there are some added dependencies I didn't had that caused that, but had no time to dig in.
Just because "mode" is a different concept I would propose creating hidden presets that can be composed with "inherits" list.
What I had in mind is the following:


"name": "mode-user",
"description": "User mode that...",
"hidden": true,
"cacheVariables": {
      "ENABLE_DEVELOPER_MODE": "OFF"
 },
"name": "mode-developer",
"description": "Developer mode that add...",
"hidden": true,
"cacheVariables": {
      "ENABLE_DEVELOPER_MODE": "ON"
 },
...
{
  "name": "windows-msvc-debug-developer-mode",
  "displayName": "msvc Debug (Developer Mode)",
  "description": "Target Windows with the msvc compiler, debug build type",
  "inherits": [
    "conf-windows-common",
    "mode-developer"
  ],
  "cacheVariables": {
       "CMAKE_C_COMPILER": "cl",
       "CMAKE_CXX_COMPILER": "cl",
       "CMAKE_BUILD_TYPE": "Debug"
     }
},

Note the "multiple inheritance" in windows-msvc-debug-developer-mode.
With that approach if you want to change something in the mode logic e.g. making the ENABLE_DEVELOPER_MODE string or adding a new cmake variable you just modify one preset instead of all *-developer-mode presets.

@Jason5480 Jason5480 mentioned this pull request Apr 1, 2022
4 tasks
@Jason5480
Copy link
Contributor Author

This PR is closed in favor of #19

@Jason5480 Jason5480 closed this Apr 1, 2022
@Jason5480 Jason5480 deleted the feature/ninja-multi-presets-support branch April 6, 2022 09:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants