project-generator / project_generator

Project generators for various embedded tools (IDE). IAR, uVision, Makefile, CoIDE, Eclipse and many more in the roadmap!
Apache License 2.0
272 stars 95 forks source link

Add support for CMake for GCC / ARMCC / ARMCLANG #475

Closed mbrossard closed 3 years ago

mbrossard commented 3 years ago

This build on #474 (so not that many commits)

I completely rewrote using target_* commands rather than appending variables, this means CMake is much more helpful with escaping flags, and opens the way to a workspace-wide CMake. Armclang support was a little more tedious because it feel like I have to fight against the support in CMake. Using the -o option in build and generate commands allows to pass options to the toolchain build() function, e.g. -o generator=<g> selects the CMake generator, the options for <g> are make (default), ninja, mingw-make, nmake.

Using CMake can be faster with the make back-end than progen's make tool option with workspace (see #480)

0xc0170 commented 3 years ago

Master is now unblocked (travis should pass), shall this be rebased?

mbrossard commented 3 years ago

It builds on #474 and I have a lot of fixes and improvements for CMake support in my development branch. What do you think would be appropriate steps/progression? There are a lot of changes that could be put in different blocks in different orders:

flit commented 3 years ago

Instead of USE_NINJA, could you add a command line argument to the generate and build subcommands to set the CMake generator?

mbrossard commented 3 years ago

This is changed in a commit on development I did yesterday. It is currently at the API level, but I was thinking something like -o generator=ninja for the command-line. This mechanism could be also useful for make_* toolchains where for instance you might want to call gmake instead of make.

mbrossard commented 3 years ago
* make/armclang support + some additions from @flit (in #474).
* alignement and fixes for make (gcc, armcc and armclang): macro quoting, windows support (in `development`)

This is in #474.

* cmake support for gcc/armcc/armclang (all together or separately?) (this ticket + `development`)
* `build_project` for cmake (in `development`)

This is in #475 (this ticket)

* workspace support in make (in `development`)
* workspace support in cmake (in `development`)

This is in #480.

mbrossard commented 3 years ago

Added mbrossard/project_generator#1 from @flit.

0xc0170 commented 3 years ago

This is in #474.

It was merged, shall this be rebased ?

mbrossard commented 3 years ago

Rebased on master