Skip to content

[hlc] automatic compilation with Ninja generator #726

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Apprentice-Alchemist
Copy link
Contributor

Ninja is a fast cross-platform build system designed for use-cases like this.
https://ninja-build.org/

Marking as a draft because this PR still needs some more testing to make sure it works on all platforms.

@skial skial mentioned this pull request Nov 22, 2024
1 task
@Simn
Copy link
Member

Simn commented Apr 9, 2025

What's the status here? I'd be happy to give it a try!

@Apprentice-Alchemist Apprentice-Alchemist force-pushed the feature/ninja-generator branch 2 times, most recently from fa9713b to 5d0bdbe Compare April 9, 2025 11:55
@Apprentice-Alchemist Apprentice-Alchemist marked this pull request as ready for review April 9, 2025 11:59
@Apprentice-Alchemist
Copy link
Contributor Author

Good enough to merge, not good enough to enable by default.

Linux/macOS with an install in /usr/local/ work, other setups (eg when installed from Homebrew or a Linux package manager) don't work yet.

@Apprentice-Alchemist Apprentice-Alchemist force-pushed the feature/ninja-generator branch from 5d0bdbe to 41160d9 Compare May 7, 2025 11:56
@Apprentice-Alchemist
Copy link
Contributor Author

Other setups (including Windows) now work too.

@Apprentice-Alchemist Apprentice-Alchemist force-pushed the feature/ninja-generator branch from 41160d9 to 928c651 Compare May 7, 2025 12:00
final libflags = config.libs.map((lib) -> switch lib {
case "std": "-lhl";
case "uv": '$prefix/lib/$lib.hdll -luv';
case var lib: '$prefix/lib/$lib.hdll';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An issue here on linux is that the libraries will always be loaded as this full path, so if the binaries are meant to be distributed as a relocatable set of binaries then it will fail to load it from $ORIGIN. This can be fixed if hdlls are always linked with --soname <name>.hdll, which is already the case with cmake but not with make. This would be a requirement for user made hdlls too.

Also, do we need additional -l flags for other hdlls like sdl etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the lack of soname/install name is a problem for relocatable builds, but let's leave that for another PR.

Also, do we need additional -l flags for other hdlls like sdl etc?

No, uv is the only one because the bindings use certain symbols from libuv directly.
The other libraries don't do that.

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.

3 participants