···11# based on the files generated by CMake's write_basic_package_version_file
2233# SDL CMake version configuration file:
44-# This file is meant to be placed in share/cmake/SDL3, next to SDL3.xcframework
44+# This file is meant to be placed in Resources/CMake of a SDL3 framework
5566cmake_minimum_required(VERSION 3.12)
7788-get_filename_component(_sdl3_xcframework_parent_path "${CMAKE_CURRENT_LIST_DIR}" REALPATH) # /share/cmake/SDL3/
99-get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" REALPATH) # /share/cmake/SDL3/
1010-get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" PATH) # /share/cmake
1111-get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" PATH) # /share
1212-get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" PATH) # /
1313-set(_sdl3_xcframework "${_sdl3_xcframework_parent_path}/SDL3.xcframework") # /SDL3.xcframework
1414-set(_sdl3_framework "${_sdl3_xcframework}/macos-arm64_x86_64/SDL3.framework") # /SDL3.xcframework/macos-arm64_x86_64/SDL3.framework
1515-set(_sdl3_version_h "${_sdl3_framework}/Headers/SDL_version.h") # /SDL3.xcframework/macos-arm64_x86_64/SDL3.framework/Headers/SDL_version.h
1616-1717-if(NOT EXISTS "${_sdl3_version_h}")
1818- message(AUTHOR_WARNING "Cannot not find ${_sdl3_framework}. This script is meant to be placed in share/cmake/SDL3, next to SDL3.xcframework")
88+if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h")
99+ message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the Resources/CMake directory of SDL2.framework")
1910 return()
2011endif()
21122222-file(READ "${_sdl3_version_h}" _sdl_version_h)
2323-2424-unset(_sdl3_xcframework_parent_path)
2525-unset(_sdl3_framework)
2626-unset(_sdl3_xcframework)
2727-unset(_sdl3_version_h)
2828-1313+file(READ "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h" _sdl_version_h)
2914string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_major_re "${_sdl_version_h}")
3015set(_sdl_major "${CMAKE_MATCH_1}")
3116string(REGEX MATCH "#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_version_h}")
···7055if(NOT "${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
7156 set(PACKAGE_VERSION_UNSUITABLE TRUE)
7257endif()
7373-7474-if(NOT CMAKE_SYSTEM_NAME MATCHES "^(Darwin|iOS|tvOS)$")
7575- set(PACKAGE_VERSION_UNSUITABLE TRUE)
7676-endif()
···11-The Simple DirectMedia Layer (SDL for short) is a cross-platform
22-library designed to make it easy to write multi-media software,
11+The Simple DirectMedia Layer (SDL for short) is a cross-platform
22+library designed to make it easy to write multi-media software,
33such as games and emulators.
4455-The Simple DirectMedia Layer library source code is available from:
55+The Simple DirectMedia Layer library source code is available from:
66http://www.libsdl.org/
7788-This library is distributed under the terms of the zlib license:
88+This library is distributed under the terms of the zlib license:
99http://zlib.net/zlib_license.html
101011111212-This packages contains the SDL framework for macOS.
1313-Conforming with Apple guidelines, this framework
1212+This packages contains the SDL framework for macOS.
1313+Conforming with Apple guidelines, this framework
1414contains both the SDL runtime component and development header files.
151516161717To Install:
1818-Copy the SDL3.framework to /Library/Frameworks
1818+Copy "SDL3.xcframework" and "share" to /Library/Frameworks
19192020-You may alternatively install it in <Your home directory>/Library/Frameworks
2020+You may alternatively install it in <Your home directory>/Library/Frameworks
2121if your access privileges are not high enough.
222223232424Use in CMake projects:
2525-SDL3.framework can be used in CMake projects using the following pattern:
2626-```
2525+SDL3.xcframework can be used in CMake projects using the following pattern:
2626+```cmake
2727find_package(SDL3 REQUIRED COMPONENTS SDL3)
2828add_executable(my_game ${MY_SOURCES})
2929target_link_libraries(my_game PRIVATE SDL3::SDL3)
···35353636Additional References:
37373838- - Screencast tutorials for getting started with OpenSceneGraph/macOS are
3838+ - Screencast tutorials for getting started with OpenSceneGraph/macOS are
3939 available at:
4040 http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/MacOSXTips
4141- Though these are OpenSceneGraph centric, the same exact concepts apply to
4141+ Though these are OpenSceneGraph centric, the same exact concepts apply to
4242 SDL, thus the videos are recommended for everybody getting started with
4343 developing on macOS. (You can skim over the PlugIns stuff since SDL
4444 doesn't have any PlugIns to worry about.)