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
[feat, build] Compatibility with other CMake generators #861
Conversation
Pass `USE_NINJA=1` or `CMAKE="cmake -G 'Generator Name'"`.
Makefile.defs
Outdated
KO_BUILD_SYSTEM=$(MAKE) | ||
ifdef USE_NINJA | ||
CMAKE:=cmake -G Ninja | ||
KO_BUILD_SYSTEM:=ninja |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NiLuJe Any feedback on the variable name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a huge fan, but I'm at a loss for anything better right now...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(It's mainly the loss of MAKE
in the name that bothers me, as that's recognizable at a glance).
Even if it technically wouldn't make much sense when MAKE isn't make anymore, but, still :D.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'd actually called it something like KOMAKE
at first (not sure if that was it; never committed that) but then I looked at KOMAKE:=ninja
and changed the name. :-P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could also be called something like (KO)MAKE_BACKEND
, although that makes me think more of GNU Make vs BSD Make or whatever. But maybe KO_BUILD_BACKEND
sounds better than system?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just something like KO_CMAKE_GENERATOR
since it is in fact intended for CMake, with that KO_
prefix to differentiate it from CMake's built-in CMAKE_GENERATOR
thingy? Or possibly not even that because CMake doesn't care about environment variables like that, although that might be confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, except CMake uses names like Ninja
and Unix Makefiles
for that one. They do use MAKE
in this one:
//Program used to build from build.ninja files.
CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/ninja
So… (KO_)CMAKE_MAKE_PROGRAM
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I like that one ;)!
# generator there's no recursion. For us that other generator is ninja, but | ||
# maybe one day also Visual Studio or Xcode… | ||
if(CMAKE_GENERATOR MATCHES Makefiles) | ||
set(KO_MAKE_RECURSIVE "$(MAKE)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NiLuJe And also this one.
The system works slightly faster on first build, and should provide a more noticeable speed-up in front on rebuilds, so I pretty much intend to switch over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues with that one ;).
ninja mainly for faster builds in CI in front & of course also for hackers using the Docker image, cf. koreader/koreader-base#861 koxtoolchain just because I'm pushing new images anyway, cf. koreader/koxtoolchain#11
…lable The difference for builds from scratch is negligible, but for rebuilds (i.e., us hackers & the CI here in front) it should bring a speed improvement. Cf. koreader/koreader-base#861, koreader/koreader-base#862 and https://github.com/koreader/virdevenv/pull/34/files
…lable (#4808) The difference for builds from scratch is negligible, but for rebuilds (i.e., for us hackers & the CI here in front) it should bring a speed improvement. Automatic fallback to Make when Ninja is not available, or override with `USE_MAKE=1`. You can (theoretically) choose your own generator with a sensible combination of `CMAKE_FLAGS` and `CMAKE_MAKE_PROGRAM`. I also added `MAKE_FLAGS` and `NINJA_FLAGS`. That way you can easily pass `MAKE_FLAGS=-n` or `NINJA_FLAGS=-n` for a dry run, for example. To switch you might have to run something like `make dist-clean USE_MAKE=1`. Cf. koreader/koreader-base#861, koreader/koreader-base#862 and https://github.com/koreader/virdevenv/pull/34/files
ninja mainly for faster builds in CI in front & of course also for hackers using the Docker image, cf. koreader/koreader-base#861 koxtoolchain just because I'm pushing new images anyway, cf. koreader/koxtoolchain#11
…lable (koreader#4808) The difference for builds from scratch is negligible, but for rebuilds (i.e., for us hackers & the CI here in front) it should bring a speed improvement. Automatic fallback to Make when Ninja is not available, or override with `USE_MAKE=1`. You can (theoretically) choose your own generator with a sensible combination of `CMAKE_FLAGS` and `CMAKE_MAKE_PROGRAM`. I also added `MAKE_FLAGS` and `NINJA_FLAGS`. That way you can easily pass `MAKE_FLAGS=-n` or `NINJA_FLAGS=-n` for a dry run, for example. To switch you might have to run something like `make dist-clean USE_MAKE=1`. Cf. koreader/koreader-base#861, koreader/koreader-base#862 and https://github.com/koreader/virdevenv/pull/34/files
Pass
USE_NINJA=1
orCMAKE="cmake -G 'Generator Name'" CMAKE_MAKE_PROGRAM=generator-executable
.