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

[build]: Replace fatal errors with conditional warnings for Clipboard Image Support #4477

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

evertonse
Copy link
Contributor

@evertonse evertonse commented Nov 10, 2024

Fixes #4459

Conditional compilation warnings instead of warnings to inform developers about the necessary dependencies when enabling clipboard image support (e.g. SUPPORT_MODULE_RTEXTURES, specific image formats , etc ...).

This allows for more flexible configuration while still alerting users, although subtely.

NOTE: 6.10.7 C standard says that any unrecognized #pragma should be ignored, so it should be no problem is case of less common C compilers.

Comment on lines +531 to +534
// Not needed because `rtexture.c` will automatically defined STBI_REQUIRED when any SUPPORT_FILEFORMAT_* is defined.
// #if !defined(STBI_REQUIRED)
// #pragma message ("Warning: "STBI_REQUIRED is not defined, that means we can't load images from clipbard"
// #endif

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
@raysan5 raysan5 merged commit 5cc06f4 into raysan5:master Nov 11, 2024
14 checks passed
@raysan5
Copy link
Owner

raysan5 commented Nov 11, 2024

@evertonse Merging this review but maybe it will be redesigned, I usually try to avoid/minimize #pragma errors/warnings in raylib... but I need to think about it...

@evertonse
Copy link
Contributor Author

evertonse commented Nov 11, 2024

@evertonse Merging this review but maybe it will be redesigned, I usually try to avoid/minimize #pragma errors/warnings in raylib... but I need to think about it...

That's completely fine.

A better solution might be to pull all the dependencies inside rcore.c itsself, as I suggested here, because it seems that building with cmake -DCUSTOMIZE_BUILD it doesn't pull config.h, I might be wrong but it seems that way.

@raysan5
Copy link
Owner

raysan5 commented Nov 11, 2024

@evertonse config.h didn't force any flags, just define the user desired ones (but lately some conditionals were added).

The approach usually used on raylib was just checking required flag availability at a function level and fail gracefully with a TraceLog(LOG_WARNING, ...) message. It's up to the user to enable required/desired flags.

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