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

Make use of the resource bundle optional #8

Merged
merged 2 commits into from
Aug 14, 2024
Merged

Conversation

paulcadman
Copy link
Owner

The goal of this PR is to allow configuration of the project for loadImage path (and future APIs that load resources) to load resources from the filesystem instead of the resource bundle.h.

This is done in multiple steps.

  1. The makeBundle.lean script now creates resources in bundle.h with path prefixed with resource/, i.e their relative paths in the repository. So now in the Window example the image is loaded using loadImage "resources/Asset.svg" instead of loadImage "Asset.svg".

  2. A C-flag RAYLEAN_NO_BUNDLE is added so that raylib-binding.c can be configured to use the Raylib LoadFileData instead of loading data from the bundle. The loadImage "resources/Asset.svg" will continue to work when the example executable is run from the root of the project (i.e with just run).

  3. A config option bundle is now used in the lakefile to configure if the bundle is used or not.

Builds using just will continue to use the resource bundle by default.

To disable use of the bundle in just use:

just disableBundle=y build

Projects that depend on the raylean library will have the bundle disabled by default. It can be enabled by setting the bundle configuration setting to on in the lakefile requires block:

require raylean from git "https://github.com/paulcadman/raylean" @ "main" with
  NameMap.empty
    |>.insert `bundle "on"

or via the CLI:

lake build -R -K bundle=on build

The raylib-binding.c can be configured to disable use of the bundle by
setting th RAYLEAN_NO_BUNDLE flag.

When the bundle is disabled the function `loadImage path` will load an
image from the filesystem instead of the resource bundle.

Builds using just will continue to use the resource bundle by default.

To disable use of the bundle in just use:

```
just disableBundle=y build
```

Projects that depend on the raylean library will have the bundle
disabled by default. It can be enabled by setting the `bundle`
configuration setting to on in the lakefile requires block:

```
require raylean from git "https://github.com/paulcadman/raylean" @ "main" with
  NameMap.empty
    |>.insert `bundle "on"
```

or via the CLI:

```
lake build -R -K bundle=on build
```
@paulcadman paulcadman merged commit 1ceed03 into main Aug 14, 2024
1 check passed
@paulcadman paulcadman deleted the optional-bundle branch August 14, 2024 19:50
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.

1 participant