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

[feat, build] Compatibility with other CMake generators #861

Merged
merged 3 commits into from Mar 15, 2019

Conversation

Frenzie
Copy link
Member

@Frenzie Frenzie commented Mar 15, 2019

Pass USE_NINJA=1 or CMAKE="cmake -G 'Generator Name'" CMAKE_MAKE_PROGRAM=generator-executable.

Makefile.defs Outdated
KO_BUILD_SYSTEM=$(MAKE)
ifdef USE_NINJA
CMAKE:=cmake -G Ninja
KO_BUILD_SYSTEM:=ninja
Copy link
Member Author

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?

Copy link
Member

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...

Copy link
Member

@NiLuJe NiLuJe Mar 15, 2019

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.

Copy link
Member Author

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

Copy link
Member Author

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?

Copy link
Member Author

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.

Copy link
Member Author

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?

Copy link
Member

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)")
Copy link
Member Author

@Frenzie Frenzie Mar 15, 2019

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.

Copy link
Member

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 ;).

@Frenzie Frenzie merged commit a79a1a6 into koreader:master Mar 15, 2019
@Frenzie Frenzie deleted the ninja branch March 15, 2019 19:49
Frenzie added a commit to Frenzie/virdevenv that referenced this pull request Mar 15, 2019
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
Frenzie added a commit to Frenzie/koreader that referenced this pull request Mar 16, 2019
…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
Frenzie added a commit to koreader/koreader that referenced this pull request Mar 16, 2019
…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
Frenzie added a commit to koreader/virdevenv that referenced this pull request Mar 16, 2019
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
mwoz123 pushed a commit to mwoz123/koreader that referenced this pull request Mar 29, 2020
…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
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

Successfully merging this pull request may close these issues.

None yet

2 participants