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

Updates and fixes to build_configs #11397

Merged
merged 11 commits into from
Dec 24, 2024
Merged

Conversation

Lzard
Copy link
Contributor

@Lzard Lzard commented Nov 2, 2024

Adds missing macro definitions to SDL_build_config.h.cmake, removes unused ones, changes unneeded @VAR@ replacements to 1s, and fixes a few little things.

Those are issues I came across while working with SDL_build_config.h.cmake for a personal project that uses CMake configuration headers, but not CMake itself.

@Lzard Lzard force-pushed the build-config-updates branch from 402151a to 44ae21d Compare November 2, 2024 21:13
@slouken slouken requested a review from madebr November 3, 2024 02:23
@slouken slouken added this to the 3.2.0 milestone Nov 3, 2024
@slouken
Copy link
Collaborator

slouken commented Dec 4, 2024

@madebr, can you take a look at this? It mostly looks good to me, I just want a second pair of eyes on this.

@slouken
Copy link
Collaborator

slouken commented Dec 24, 2024

@madebr, ping?

Copy link
Contributor

@madebr madebr left a comment

Choose a reason for hiding this comment

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

Thanks for painstakingly checking the configure options, and removing the ones that we didn't use anymore.

#cmakedefine HAVE_ICONV_H 1
#cmakedefine HAVE_INTTYPES_H 1
#cmakedefine HAVE_LIBUNWIND_H 1
Copy link
Contributor

Choose a reason for hiding this comment

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

This macro can be removed from all SDL_build_config* headers. It's only used by SDL_test, which does not use the config header.

include/build_config/SDL_build_config.h.cmake Show resolved Hide resolved
@@ -144,6 +129,7 @@
#cmakedefine HAVE_CEILF 1
#cmakedefine HAVE_COPYSIGN 1
#cmakedefine HAVE_COPYSIGNF 1
#cmakedefine HAVE__COPYSIGN 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Should _copysign be tested in CMakeLists.txt?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, it's available in Windows builds.

@@ -182,6 +168,7 @@
#cmakedefine HAVE_TANF 1
#cmakedefine HAVE_TRUNC 1
#cmakedefine HAVE_TRUNCF 1
#cmakedefine HAVE__FSEEKI64 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Add this one to CMakeLists.txt?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, also available in Windows builds.

Comment on lines 34 to 48
#cmakedefine SDL_REVISION "@SDL_REVISION@ (" SDL_VENDOR_INFO ")"
#else
#define SDL_REVISION "@SDL_REVISION@"
#cmakedefine SDL_REVISION "@SDL_REVISION@"
#endif

#ifndef SDL_REVISION
#ifdef SDL_VENDOR_INFO
#define SDL_REVISION SDL_VENDOR_INFO
#else
#define SDL_REVISION ""
#endif
#endif

#ifndef SDL_VENDOR_INFO
#define SDL_VENDOR_INFO ""
Copy link
Contributor

Choose a reason for hiding this comment

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

This has changed in current SDL3 main.
The CMake script always defines a SDL_REVISION string, and optionally adds a vendor info string.

Please verify, but I think the current SDL_revision.h.cmake can remain as is.

Lzard added 11 commits December 24, 2024 13:09
Those are only used in build_config files that define them themselves, or not used at all.
Those are defined in other build_configs files and used elsewhere in SDL.
Currently, `SDL_DEFAULT_ASSERT_LEVEL` is commented out by CMake when its value is 0, setting the assertions level to the default value instead of disabling them.
This change:
- defines `SDL_DEFAULT_ASSERT_LEVEL_CONFIGURED` when its value is non-zero.
- defines `SDL_DEFAULT_ASSERT_LEVEL`, regardless of its value, when `SDL_DEFAULT_ASSERT_LEVEL_CONFIGURED` is defined.
Makes all macros only used in `#ifdef`s defined as `1` when they exist, instead of the CMake value of the corresponding variable.
I messed up some spacing, so I thought I might as well strip all those unnecessary spaces.
It is only used in SDL_test, which does not use the config header.
@Lzard Lzard force-pushed the build-config-updates branch from 44ae21d to 1e19fda Compare December 24, 2024 12:24
@Lzard
Copy link
Contributor Author

Lzard commented Dec 24, 2024

Rebased and fixed the issues:

  • SDL_REVISION will indeed always be defined, so I dropped the related commit.
  • HAVE_LIBUNWIND_H removed.
  • calloc, free and realloc removed from symbols_to_check and _copysign and _fseeki64 added to it on Windows.

@slouken slouken merged commit 440d575 into libsdl-org:main Dec 24, 2024
40 checks passed
@slouken
Copy link
Collaborator

slouken commented Dec 24, 2024

Looks good, thanks!

@Lzard Lzard deleted the build-config-updates branch December 24, 2024 19:05
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.

3 participants