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

Improve CMake project behaviours for feature parity with Makefile projects #758

Open
jld01 opened this issue Apr 12, 2024 · 13 comments
Open
Milestone

Comments

@jld01
Copy link
Contributor

jld01 commented Apr 12, 2024

There are a number of CDT behaviours available within classic Makefile projects that are not available within CMake projects:

This issue has been created for discussion on how we can work towards feature parity of CMake projects with classic Makefile projects.

@ewaterlander
Copy link
Contributor

I would say: make Core Build (CMake and Makefile) on par with Managed Build (classic Makefile).

@ewaterlander
Copy link
Contributor

A fundamental difference between Managed and Core build project is that Managed projects have a "C/C++ Build" section in the project properties and Core Build projects don't. Core build projects have the build settings in the launch configuration, and these settings are limited to selecting a toolchain and setting a build command. There is one launch configuration for Running and one for Debug, but this is hidden for the user. They are selected based on the Launch Mode in the LaunchBar. The Core Build launch configurations are not visible in the Run- and Debug Configurations windows, but only in the LaunchBar.

To get on par with Managed build the Core Build projects could also get a C/C++ Build section in the project properties, but without the Makefile generation stuff (Settings >Tool Settings).
Or the Core build launch configurations could be extended w.r.t. build settings. But I find a launch configuration a strange place to store build settings. I don't know why this was chosen in the past. Perhaps to make it simpler for the user.

Also w.r.t. launching the Core Build launch configurations are much more limited than the standard C/C++ launch configurations. I typically use the Core Build launch configuration only for building, and then a normal launch configuration for running and debug.

@ewaterlander
Copy link
Contributor

The idea for a new build system came from Doug Schaefer in 2010, see Bug 321443 - Build Model Enhancements. Doug started implementing in 2015 Bug 321443 - First implementation of new build model.. CMake Core Build launches were introduced in 2016
Introduce Core Build launches and Launch Bar integration.
. Doug left CDT in 2019 and since then Core Build development got slowed down a lot. The intention was that Core Build would replace Managed build, but up till today Managed Makefile is still the front flow in CDT.

I'm very much in favor of improving CMake and Makefile Core Build. In my opinion Managed Build is out of date as I wrote here.

@ewaterlander
Copy link
Contributor

  • Ability to define Build Variables and Environment which may be used to customize the behaviour of build tools

W.r.t. environment variables, I think this should not be added. The Core Build flow was made for environments where command line is king. See here. CDT is not the master of the build information. One user uses command line, another user uses Eclipse/CDT. And you have CI regressions. The environment should be the environment in which you start Eclipse.

If you mean CFLAGS and so on with Build Variables, for those counts the same. The user enters these in CMakeList.txt or Makefile. CDT gets it from compile_commands.json (cmake) or from build output parsing (make). CDT should not hold those variables, because the command line user would miss them.

@ewaterlander
Copy link
Contributor

To get on par with Managed build the Core Build projects could also get a C/C++ Build section in the project properties, but without the Makefile generation stuff (Settings >Tool Settings). Or the Core build launch configurations could be extended w.r.t. build settings. But I find a launch configuration a strange place to store build settings. I don't know why this was chosen in the past. Perhaps to make it simpler for the user.

I think the idea to store the tool chain in the launch config was taken from the Arduino build system (I have never seen it). See here. Each launch should determine its toolchain. See also here.

For other build settings, e.g. Error Parsers selection, it's OK to put them in the Project-scoped preferences per config.

@jantje
Copy link
Contributor

jantje commented May 28, 2024

Not that anyone cares or anyone wants this but my 2 cents
I don't know much about cmake but I doubt it would be hard to add cmake as a builder to autoBuild.

@jld01
Copy link
Contributor Author

jld01 commented May 30, 2024

Hi @ewaterlander, thank you for your useful input.

W.r.t. environment variables, I think this should not be added. The Core Build flow was made for environments where command line is king. See here. CDT is not the master of the build information. One user uses command line, another user uses Eclipse/CDT. And you have CI regressions. The environment should be the environment in which you start Eclipse.

I understand this argument, but setting up the environment outside the IDE can be quite alien to some users who, nevertheless, have a legitimate need to work with CMake projects. If the user can extend the PATH to allow for location of additional project-specific tools, for example, I see this as a big usability win.

If you mean CFLAGS and so on with Build Variables, for those counts the same. The user enters these in CMakeList.txt or Makefile. CDT gets it from compile_commands.json (cmake) or from build output parsing (make). CDT should not hold those variables, because the command line user would miss them.

At present, we use a build variable (gnu_tool_prefix) to support launching of tools such as objdump. This variable is relevant only within CDT and does not affect project build. We could consider an alternative mechanism to allow lookup of the relevant GNU tool prefix for Core Build projects based on toolchain selection.

@ewaterlander
Copy link
Contributor

ewaterlander commented May 31, 2024

Hi @ewaterlander, thank you for your useful input.

I understand this argument, but setting up the environment outside the IDE can be quite alien to some users who, nevertheless, have a legitimate need to work with CMake projects. If the user can extend the PATH to allow for location of additional project-specific tools, for example, I see this as a big usability win.

Hi @jld01 ,

I think the user should be educated how the new flow works. The CDT user documentation is far behind...

Like Core Build flow, vscode also uses the environment in which it was started for building. In vscode you can set environment variables only for launching, see Is there any way to set environment variables in Visual Studio Code?.

A CDT C/C++ launch configuration also has an option to set environment variables, e.g. for debugging. The default Core Build launch configuration does not have it. For now you have to create a C/C++ launch configuration by hand if you want to do something extra. This is not so difficult. W.r.t. launching we are lacking behind with the Core Build projects. That is where we should get in parity.

At present, we use a build variable (gnu_tool_prefix) to support launching of tools such as objdump. This variable is relevant only within CDT and does not affect project build. We could consider an alternative mechanism to allow lookup of the relevant GNU tool prefix for Core Build projects based on toolchain selection.

The Core Build configuration is aware of the selected toolchain. Based on that it should be able to find all tools in the toolchain like objdump.

@ewaterlander
Copy link
Contributor

Like Core Build flow, vscode also uses the environment in which it was started for building. In vscode you can set environment variables only for launching, see Is there any way to set environment variables in Visual Studio Code?.

Just checked. The vscode CMake plugin preferences does have an option to set environment variables to be passed to cmake during build.
In CDT CMake this can be done by adding additional CMake arguments in the launch configuration. I think this is the correct place, because the Core Build idea is to "build for launch". Perhaps there is some improvement needed here wrt user friendliness

image

@ghentschke ghentschke pinned this issue Jun 8, 2024
@ghentschke
Copy link
Contributor

@ewaterlander is the above shown screenshot part of basic cdt? I cannot fin this page

@ewaterlander
Copy link
Contributor

@ewaterlander is the above shown screenshot part of basic cdt? I cannot fin this page

@ghentschke
Yes, this is standard CDT. Click on the gear in the launch bar to see the properties on the launch configuration. The Core Build launch configurations are not visible in the configurations window you get via the menu Run >> Run/Debug Configurations...
Core Build launch configurations (CMake/Makefile/Autotools/Arduino) are only visible in the launch bar.

The thing is that using vanilla CDT the standard Core Build projects are not usable for the default Local target. You can't even set for instance arguments or the working directory in the default launch configuration. The tabs are missing. How can this have happened unnoticed? I think because all the small users at home, who simple want to build a local Linux or Windows application, ran away to vscode. The semiconductor companies who build custom IDE's on top of CDT don't see the problem, because they have their own custom solution.

@ewaterlander
Copy link
Contributor

Uploaded PR #821 to fix the issue of not being able to set arguments.
Also needed: Environment variables and debug settings.

@jld01 jld01 unpinned this issue Aug 20, 2024
ewaterlander added a commit to ewaterlander/cdt that referenced this issue Nov 18, 2024
A new Main Tab was created for Core Build local projects based on the Main
Tab used for the classic Managed Build projects. It adds these
features:

* Option to select a different binary.
* Option to control launch pre-builds.

The default value for the binary is empty string. With empty string
the behaviour for binary selection stays the same as it was.

The project name is fixed and cannot be changed. A Core Build launch
configuration is created with the project and tied to it.

This change relates to eclipse-cdt#758. It affects all Core Build projects,
including CMake projects.
ewaterlander added a commit to ewaterlander/cdt that referenced this issue Nov 18, 2024
A new Main Tab was created for Core Build local projects based on the Main
Tab used for the classic Managed Build projects. It adds these
features:

* Option to select a different binary.
* Option to control launch pre-builds.

The default value for the binary is empty string. With empty string
the behaviour for binary selection stays the same as it was.

The project name is fixed and cannot be changed. A Core Build launch
configuration is created with the project and tied to it.

This change relates to eclipse-cdt#758. It affects all Core Build projects,
including CMake projects.
ewaterlander added a commit to ewaterlander/cdt that referenced this issue Nov 19, 2024
A new Main Tab was created for Core Build local projects based on the Main
Tab used for the classic Managed Build projects. It adds these
features:

* Option to select a different binary.
* Option to control launch pre-builds.

The default value for the binary is empty string. With empty string
the behaviour for binary selection stays the same as it was.

The project name is fixed and cannot be changed. A Core Build launch
configuration is created with the project and tied to it.

This change relates to eclipse-cdt#758. It affects all Core Build projects,
including CMake projects.
ewaterlander added a commit to ewaterlander/cdt that referenced this issue Nov 19, 2024
A new Main Tab was created for Core Build local projects based on the Main
Tab used for the classic Managed Build projects. It adds these
features:

* Option to select a different binary.
* Option to control launch pre-builds.

The default value for the binary is empty string. With empty string
the behaviour for binary selection stays the same as it was.

The project name is fixed and cannot be changed. A Core Build launch
configuration is created with the project and tied to it.

This change relates to eclipse-cdt#758. It affects all Core Build projects,
including CMake projects.
ewaterlander added a commit to ewaterlander/cdt that referenced this issue Nov 19, 2024
A new Main Tab was created for Core Build local projects based on the Main
Tab used for the classic Managed Build projects. It adds these
features:

* Option to select a different binary.
* Option to control launch pre-builds.

The default value for the binary is empty string. With empty string
the behaviour for binary selection stays the same as it was.

The project name is fixed and cannot be changed. A Core Build launch
configuration is created with the project and tied to it.

There is no option to select a build configuration, because for Core
Build projects this is selected via the LaunchBar's Launch Mode.

This change relates to eclipse-cdt#758. It affects all Core Build projects,
including CMake projects.
ewaterlander added a commit to ewaterlander/cdt that referenced this issue Nov 21, 2024
A new Main Tab was created for Core Build local projects based on the Main
Tab used for the classic Managed Build projects. It adds these
features:

* Option to select a different binary.
* Option to control launch pre-builds.

The default value for the binary is empty string. With empty string
the behaviour for binary selection stays the same as it was.

The project name is fixed and cannot be changed. A Core Build launch
configuration is created with the project and tied to it.

There is no option to select a build configuration, because for Core
Build projects this is selected via the LaunchBar's Launch Mode.

This change relates to eclipse-cdt#758. It affects all Core Build projects,
including CMake projects.
jonahgraham pushed a commit that referenced this issue Nov 27, 2024
A new Main Tab was created for Core Build local projects based on the Main
Tab used for the classic Managed Build projects. It adds these
features:

* Option to select a different binary.
* Option to control launch pre-builds.

The default value for the binary is empty string. With empty string
the behaviour for binary selection stays the same as it was.

The project name is fixed and cannot be changed. A Core Build launch
configuration is created with the project and tied to it.

There is no option to select a build configuration, because for Core
Build projects this is selected via the LaunchBar's Launch Mode.

This change relates to #758. It affects all Core Build projects,
including CMake projects.
ewaterlander added a commit to ewaterlander/cdt that referenced this issue Nov 29, 2024
The launch configuration for local Core Build projects got the
Debugger and Source tabs in debug mode. Now the user can set the stop
at startup, a specific debugger, and all other Debug options as we
know from Managed Build projects.

The GdbLaunch class automatically picks up all the debug settings from
these new tabs. No additional code was needed for that.

The composition of Core Build tab groups is now fully done via the
launchConfigurationTabGroups extension-point.

This change relates to eclipse-cdt#758. It affects all Core Build projects,
including CMake projects.
ewaterlander added a commit to ewaterlander/cdt that referenced this issue Nov 29, 2024
The launch configuration for local Core Build projects got the
Debugger and Source tabs in debug mode. Now the user can set the stop
at startup, a specific debugger, and all other Debug options as we
know from Managed Build projects.

The GdbLaunch class automatically picks up all the debug settings from
these new tabs. No additional code was needed for that.

The composition of Core Build tab groups is now fully done via the
launchConfigurationTabGroups extension-point.

This change relates to eclipse-cdt#758. It affects all Core Build projects,
including CMake projects.
ewaterlander added a commit to ewaterlander/cdt that referenced this issue Nov 29, 2024
The launch configuration for local Core Build projects got the
Debugger and Source tabs in debug mode. Now the user can set the stop
at startup, a specific debugger, and all other Debug options as we
know from Managed Build projects.

The GdbLaunch class automatically picks up all the debug settings from
these new tabs. No additional code was needed for that.

The composition of Core Build tab groups is now fully done via the
launchConfigurationTabGroups extension-point.

This change relates to eclipse-cdt#758. It affects all Core Build projects,
including CMake projects.
jonahgraham pushed a commit that referenced this issue Dec 10, 2024
The launch configuration for local Core Build projects got the
Debugger and Source tabs in debug mode. Now the user can set the stop
at startup, a specific debugger, and all other Debug options as we
know from Managed Build projects.

The GdbLaunch class automatically picks up all the debug settings from
these new tabs. No additional code was needed for that.

The composition of Core Build tab groups is now fully done via the
launchConfigurationTabGroups extension-point.

This change relates to #758. It affects all Core Build projects,
including CMake projects.
@ewaterlander
Copy link
Contributor

The Core Build tabs for local launch configuration are now at the level MBS local launch configurations. See #970

@jonahgraham jonahgraham added this to the 12.0.0 milestone Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants