build-cpp / cmkr

Modern build system based on CMake and TOML.
https://cmkr.build
MIT License
431 stars 27 forks source link

My changes to cmkr #5

Closed mrexodia closed 3 years ago

mrexodia commented 3 years ago

Comments are welcome šŸ™‚

MoAlyousef commented 3 years ago

Thanks for all the improvements :)

mrexodia commented 3 years ago

I know the changes are getting out of hand a bit šŸ˜¬, but do you have some comments perhaps?

I started using cmkr for everything and I'm slowly integrating features I require. For features that are not yet implemented (or so custom that they should never be implemented) in cmkr I use include-after or cmake-after to inject CMake directly:

https://github.com/mrexodia/IXWebSocket_template/blob/faea4869afea9a953c3a7ddf6f3f5794804eadf7/cmake.toml#L1-L23

It still needs a lot of work, but it would be nice if you could take a look and see if this is going in a direction you like.

MoAlyousef commented 3 years ago

Hi Yeah I'm glad you're using it :) I also like the changes I'm seeing, especially the ability to inject CMake code in the toml. Also moving to terms closer to the CMake terms is probably better and should be more familiar to more developers. I'm generally not a fan of vendoring dependencies, but it's not a show-stopper for me.

mrexodia commented 3 years ago

Good to hear :)

Iā€™m also not a big fan of vendoring dependencies, but in this case I think itā€™s justified to keep the configure+compile times as low as possible. Iā€™ve been thinking about doing amalgamation as well, but fetching+building cmkr takes only a few seconds now and there are more important things to solve...

Currently tests are definitely missing and I collected quite a few TODO comments that need to be addressed eventually. For conditional compilation and platform/compiler specific flags I have the following idea:

[conditions]
msvc = ā€œMSVCā€
osx = ā€œOSX_SPECIFIC_CONDITIONā€

[target.hello]
type = ā€œexecutableā€
sources = [ā€œhello.cppā€]
osx.sources = [ā€œosx_hacks.cppā€]
msvc.compile-flags = [...]

[msvc.target.msvc_only_target]
type = ā€œexecutableā€
sources = [...]

It will require a bit of work and because of the weird nature of toml tables you can also express this in a very strange alternative syntax, but it seems quite intuitive to me and additionally it allows infinite complexity by injecting cmake and using a variable set there as the condition.