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

SDL3 installation instructions for macOS should include non-XCode case #12017

Closed
nbriggs opened this issue Jan 18, 2025 · 5 comments
Closed

SDL3 installation instructions for macOS should include non-XCode case #12017

nbriggs opened this issue Jan 18, 2025 · 5 comments

Comments

@nbriggs
Copy link

nbriggs commented Jan 18, 2025

If you build on macOS using standard Makefiles rather than XCode, the installation instructions in INSTALL.md don't contain sufficient information.
You need to drop the share and SDL3.xcframework folders into /Library/Frameworks to make them publicly available.

Using a sample CMakeLists.txt such as below, it's still the case that you need to add the BUILD_RPATH property to locate the library at runtime (checked using cmake version 3.30.5, and 3.31.4).

cmake_minimum_required(VERSION 3.16)
project(hello)

# set the output directory for built objects.
# This makes sure that the dynamic library goes into the build directory automatically.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>")

# Create your game executable target as usual
add_executable(hello hello.c)

# Link to the actual SDL3 library.
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3)
target_link_libraries(hello SDL3::SDL3)
set_property(TARGET hello APPEND PROPERTY BUILD_RPATH "/Library/Frameworks/SDL3.xcframework/macos-arm64_x86_64")

@madebr
Copy link
Contributor

madebr commented Jan 18, 2025

We updated the documentation slightly in #12010

When copying both the xcframework and the share folder, there should not be a rpath issue with the latest issue.
(We're using the internal frameworks instead of the xcframework in the cmake files)

@nbriggs
Copy link
Author

nbriggs commented Jan 18, 2025

@madebr Great - so that change will make it into 3.1.12 ? I'll test again when that's available.

@nbriggs nbriggs closed this as completed Jan 18, 2025
@madebr
Copy link
Contributor

madebr commented Jan 18, 2025

What is your experience with SDL3 3.1.10?

@nbriggs
Copy link
Author

nbriggs commented Jan 18, 2025

@madebr - I learned that it was painful to port from SDL2 to SDL3 if not using the SDL2 compatibility package. I had started to port before that was available. I set the 2-to-3 porting aside waiting for a stable SDL3 release candidate, having been tripped up by using early versions before the API was stable. It looks as though you're there, so I'll be back to it as soon as I can. I'll probably have to maintain code supporting both SDL2 and SDL3 as we still have to run on older systems for which I don't expect there'll be SDL3 packages in the older distro's package collection any time soon, if ever.

@madebr
Copy link
Contributor

madebr commented Jan 18, 2025

In the foreseeable future, I think Ubuntu 24.04 LTS will remain the big driver for SDL2 support.
Next year, a new LTS will appear and SDL3 will become mainstream (or available to more people).
Then you can consider starting to deprecate SDL2 support, or support it with extended support for $$$ (following Microsoft's playbook ;) )

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

No branches or pull requests

2 participants