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

add private definitions to SDL_build_config.h.cmake #12199

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Arcnor
Copy link
Contributor

@Arcnor Arcnor commented Feb 6, 2025

Hi, I'm adding CMake support for some of the private targets, and for them to work with the automatically generated config file all these definitions are needed (well, at least some of them of course).

Maybe the most "controversial" one will be the last conditional include. I made it that way because that allows us to undefine certain automatically detected functions that are incorrectly detected, as well as manually add anything we need, but I'm open to suggestions about how to tackle that (without modifying the main CMakeLists.txt which was the whole point).

This is not the only thing needed, there are other things I needed but we can discuss them on their respective repos.

@madebr
Copy link
Contributor

madebr commented Feb 6, 2025

Perhaps we need to make the CMake script more modular (see #6781)?
I have a poc at madebr@04c4847 (9 months old atm).

In that poc, I was thinking about making the platform configurable through an optional SDL_CMAKE_PLATFORM_FILE argument)

if(NOT DEFINED SDL_CMAKE_PLATFORM_FILE)
  set(SDL_CMAKE_PLATFORM_FILE "${SDL3_SOURCE_DIR}/cmake/sdl_platforms/${SDL_CMAKE_PLATFORM_FILENAME_DEFAULT}.cmake")
endif()

What I did not think about yet is how to handle extra defines, and/or SDL3/SDL_platform_defines.h.
But that should be do-able if we split SDL_build_config.h.cmake as well.

@Arcnor
Copy link
Contributor Author

Arcnor commented Feb 6, 2025

Perhaps we need to make the CMake script more modular (see #6781)? I have a poc at madebr@04c4847 (9 months old atm).

In that poc, I was thinking about making the platform configurable through an optional SDL_CMAKE_PLATFORM_FILE argument)

if(NOT DEFINED SDL_CMAKE_PLATFORM_FILE)
  set(SDL_CMAKE_PLATFORM_FILE "${SDL3_SOURCE_DIR}/cmake/sdl_platforms/${SDL_CMAKE_PLATFORM_FILENAME_DEFAULT}.cmake")
endif()

In my current case I've just included the "base" SDL project from the private platform project, similar to what's already done on the official ones. But passing a separate file should work, although currently I need to modify the targets after they've been defined, so I'll take a look at those customization points you added, maybe the solution will be there.

What I did not think about yet is how to handle extra defines, and/or SDL3/SDL_platform_defines.h. But that should be do-able if we split SDL_build_config.h.cmake as well.

That's why I added that extra "include" on the define at the bottom, but again, happy to see alternatives to that.

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