Open planetis-m opened 2 weeks ago
I think this could be achieved by passing the define with the -U
flag to undefine it, at least this is available with gcc. Not sure how easy this would be to make portable, but it does seem like a lower impact solution.
@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 -D
(if for instance using a raylib wrapper and not wanting to modify its build script), but that is not the case with the config.h.
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.