On Fri, Sep 22, 2023 at 11:18:47AM +0200, Страхиња Радић wrote:
> ./build.sh
I did not advocate for `build.sh`.
And the wikipedia article I linked explains how unity-builds works
pretty well already:
https://en.wikipedia.org/wiki/Unity_build
But in short: you simply include any `.c` file into one. There's zero
problem adapting to a different compiler or compiler flags. In fact,
it's *easier* to do than a makefile (which I also said on my previous
mail).
$ gcc -o exe src.c
$ clang -o exe src.c # no need to "clean" anything
Doing cross-platform is also easy by just making your core application
"platform-agonistic" and having the "platform layer" provide platform
specific functionality. For example, here's a hypothetical
`app-windows.c` file:
#include "app.c" // platform-agonistic application
// ...
// now add windows specific functionalities and
// an entry point (i.e main function) below.
And the same for a "app-posix.c". And then you compile in a single
command, for example:
$ cc -o exe src-posix.c # on posix platforms
$ cl src-windows.c [...] # on windows with msvc without requiring mingw or similar
- NRK
Received on Fri Sep 22 2023 - 12:06:25 CEST