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

vendor:raylib: add options to link with raylib/raygui from system #4619

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

Conversation

spitulax
Copy link

@spitulax spitulax commented Dec 24, 2024

Odin ships the libraries for raylib and raygui and links to them when using their bindings from vendor. But this does not play well with Nix, presumably because the libraries are not compiled for Nix.
This is the issue with the way Odin passes library paths to the linker. I made a PR addressing this issue in #4719. With this, compiling with the vendored library should be fine, but you have to fiddle with dependencies like libX11 or glfw to get the program actually running.
To alternatively use vendor:raylib on Nix, you have to also compile the libraries for Nix and link with it.
This added options to link the libraries from system instead of the libraries shipped into the compiler.
This is easier to set up with Nix, because adding the raylib package from nixpkgs to buildInputs automatically adds some dependencies.

Comment on lines +8 to +11
when RAYGUI_SYSTEM {
foreign import lib "system:raygui"
} else when ODIN_OS == .Windows {
Copy link
Member

Choose a reason for hiding this comment

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

This will break on Windows.

Copy link
Author

@spitulax spitulax Jan 1, 2025

Choose a reason for hiding this comment

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

RAYLIB_SYSTEM and RAYGUI_SYSTEM allow building in some systems that wouldn't accept bundled libraries like Nix. If you don't enable them on Windows it should just use the bundled libraries.

Arsalan2356 added a commit to Arsalan2356/dotfiles that referenced this pull request Jan 3, 2025
Add nixpkgs-master to flake inputs
Rename test branch to custom
Add odin with a patch to use raylib from the system
(can remove patch if odin pr closes
(odin-lang/Odin#4619)
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.

2 participants