-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[config.h] Consider changing how defines are used in raylib to support configuration from build systems #4411
Comments
I think this could be achieved by passing the define with the |
@znichola no that won't work, we have already tried it. Here's a test you can try: #include <stdio.h>
#ifndef EXAMPLE_OPTION
#define EXAMPLE_OPTION 1
#endif
int main(void)
{
#if EXAMPLE_OPTION == 1
puts("option enabled");
#endif
} |
Ah yes of course I see, that's dumb of me, I was thinking from the angle of disabling flags that were added with |
In regards to the current Zig build system, there's currently no way to undefine a macro so it's currently impossible to disable something like I was thinking if it would make sense to make it so if the value of a SUPPORT macro is set to 0, it should be equivalent to not setting the value. |
@sagehane that's exactly what this issue is about, changing all the #if defined (...) to #if will do that |
Description:
Currently, raylib uses
#if defined(SUPPORT_X)
to conditionally enable/disable certain features like file format support. However, setting a define to0
from the build system (e.g.,-DSUPPORT_FILEFORMAT_PNG=0
) doesn't actually disable the feature because the macro is still considered "defined."This limitation makes it difficult to selectively disable certain features without manually editing
config.h
, especially when working with different build systems or when trying to configure raylib via command-line flags alone.Proposed Change:
Switch the current
#if defined(SUPPORT_X)
checks to something like#if SUPPORT_X == 1
. This would allow features to be properly toggled off by defining them as0
from the build system.Example:
This would enable features to be turned off using
-DSUPPORT_FILEFORMAT_PNG=0
in the build system, without requiring edits to the default configuration file.Discussion Summary:
This topic was discussed on the raylib Discord server. The current method was found to be limiting for build systems that rely on command-line defines. While the change is agreed to be useful, it was also acknowledged that it's better suited for a future release after the current planned version has been completed.
The text was updated successfully, but these errors were encountered: