Simple Directmedia Layer

xcode: cmake scripts inside frameworks in side xcframework differ from the top cmake script

authored by

Anonymous Maarten and committed by
Anonymous Maarten
8954e42b e10207e8

+271 -99
+11
.github/workflows/release.yml
··· 168 168 -Werror=dev \ 169 169 -B build_darwin 170 170 cmake --build build_darwin --config Release --verbose 171 + 172 + cmake -S "${{ steps.src.outputs.path }}/cmake/test" \ 173 + -DTEST_FULL=FALSE \ 174 + -DTEST_STATIC=FALSE \ 175 + -DTEST_TEST=FALSE \ 176 + -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}/SDL3.xcframework/macos-arm64_x86_64" \ 177 + -DCMAKE_SYSTEM_NAME=Darwin \ 178 + -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ 179 + -Werror=dev \ 180 + -B build_darwin_2 181 + cmake --build build_darwin --config Release --verbose 171 182 - name: 'CMake (configure + build) iOS' 172 183 run: | 173 184 cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
+1 -1
Xcode/SDL/SDL.xcodeproj/project.pbxproj
··· 2624 2624 ); 2625 2625 runOnlyForDeploymentPostprocessing = 0; 2626 2626 shellPath = /bin/sh; 2627 - shellScript = "set -ex\n\nmkdir -p build/dmg-tmp/share/cmake/SDL3\ncp -a build/SDL3.xcframework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt build/dmg-tmp\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\ncp pkg-support/resources/CMake/sdl3-config.cmake build/dmg-tmp/share/cmake/SDL3\ncp pkg-support/resources/CMake/sdl3-config-version.cmake build/dmg-tmp/share/cmake/SDL3\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL3 -srcfolder build/dmg-tmp build/SDL3.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n"; 2627 + shellScript = "set -ex\n\nmkdir -p build/dmg-tmp/share/cmake/SDL3\ncp -a build/SDL3.xcframework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt build/dmg-tmp\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\ncp pkg-support/resources/share/cmake/SDL3/sdl3-config.cmake build/dmg-tmp/share/cmake/SDL3\ncp pkg-support/resources/share/cmake/SDL3/sdl3-config-version.cmake build/dmg-tmp/share/cmake/SDL3\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL3 -srcfolder build/dmg-tmp build/SDL3.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n"; 2628 2628 }; 2629 2629 F3B38CF0296F63D1005DA6D3 /* ShellScript */ = { 2630 2630 isa = PBXShellScriptBuildPhase;
+4 -23
Xcode/SDL/pkg-support/resources/CMake/sdl3-config-version.cmake
··· 1 1 # based on the files generated by CMake's write_basic_package_version_file 2 2 3 3 # SDL CMake version configuration file: 4 - # This file is meant to be placed in share/cmake/SDL3, next to SDL3.xcframework 4 + # This file is meant to be placed in Resources/CMake of a SDL3 framework 5 5 6 6 cmake_minimum_required(VERSION 3.12) 7 7 8 - get_filename_component(_sdl3_xcframework_parent_path "${CMAKE_CURRENT_LIST_DIR}" REALPATH) # /share/cmake/SDL3/ 9 - get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" REALPATH) # /share/cmake/SDL3/ 10 - get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" PATH) # /share/cmake 11 - get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" PATH) # /share 12 - get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" PATH) # / 13 - set(_sdl3_xcframework "${_sdl3_xcframework_parent_path}/SDL3.xcframework") # /SDL3.xcframework 14 - set(_sdl3_framework "${_sdl3_xcframework}/macos-arm64_x86_64/SDL3.framework") # /SDL3.xcframework/macos-arm64_x86_64/SDL3.framework 15 - set(_sdl3_version_h "${_sdl3_framework}/Headers/SDL_version.h") # /SDL3.xcframework/macos-arm64_x86_64/SDL3.framework/Headers/SDL_version.h 16 - 17 - if(NOT EXISTS "${_sdl3_version_h}") 18 - message(AUTHOR_WARNING "Cannot not find ${_sdl3_framework}. This script is meant to be placed in share/cmake/SDL3, next to SDL3.xcframework") 8 + if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h") 9 + message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the Resources/CMake directory of SDL2.framework") 19 10 return() 20 11 endif() 21 12 22 - file(READ "${_sdl3_version_h}" _sdl_version_h) 23 - 24 - unset(_sdl3_xcframework_parent_path) 25 - unset(_sdl3_framework) 26 - unset(_sdl3_xcframework) 27 - unset(_sdl3_version_h) 28 - 13 + file(READ "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h" _sdl_version_h) 29 14 string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_major_re "${_sdl_version_h}") 30 15 set(_sdl_major "${CMAKE_MATCH_1}") 31 16 string(REGEX MATCH "#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_version_h}") ··· 70 55 if(NOT "${CMAKE_SIZEOF_VOID_P}" EQUAL "8") 71 56 set(PACKAGE_VERSION_UNSUITABLE TRUE) 72 57 endif() 73 - 74 - if(NOT CMAKE_SYSTEM_NAME MATCHES "^(Darwin|iOS|tvOS)$") 75 - set(PACKAGE_VERSION_UNSUITABLE TRUE) 76 - endif()
+13 -63
Xcode/SDL/pkg-support/resources/CMake/sdl3-config.cmake
··· 1 - # SDL CMake configuration file: 2 - # This file is meant to be placed in share/cmake/SDL3, next to SDL3.xcframework 1 + # SDL3 CMake configuration file: 2 + # This file is meant to be placed in Resources/CMake of a SDL3 framework 3 3 4 4 # INTERFACE_LINK_OPTIONS needs CMake 3.12 5 5 cmake_minimum_required(VERSION 3.12) ··· 31 31 32 32 set(SDL3_FOUND TRUE) 33 33 34 - macro(_check_target_is_simulator) 35 - include(CheckCSourceCompiles) 36 - check_c_source_compiles([===[ 37 - #include <TargetConditionals.h> 38 - #if defined(TARGET_OS_SIMULATOR) 39 - int target_is_simulator; 40 - #endif 41 - int main(int argc, char *argv[]) { return target_is_simulator; } 42 - ]===] SDL_TARGET_IS_SIMULATOR) 43 - endmacro() 44 - 45 - if(CMAKE_SYSTEM_NAME STREQUAL "iOS") 46 - _check_target_is_simulator() 47 - if(SDL_TARGET_IS_SIMULATOR) 48 - set(_xcfw_target_subdir "ios-arm64_x86_64-simulator") 49 - else() 50 - set(_xcfw_target_subdir "ios-arm64") 51 - endif() 52 - elseif(CMAKE_SYSTEM_NAME STREQUAL "tvOS") 53 - _check_target_is_simulator() 54 - if(SDL_TARGET_IS_SIMULATOR) 55 - set(_xcfw_target_subdir "tvos-arm64_x86_64-simulator") 56 - else() 57 - set(_xcfw_target_subdir "tvos-arm64") 58 - endif() 59 - elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") 60 - set(_xcfw_target_subdir "macos-arm64_x86_64") 61 - else() 62 - message(WARNING "Unsupported Apple platform (${CMAKE_SYSTEM_NAME}) and broken sdl3-config-version.cmake") 63 - set(SDL3_FOUND FALSE) 64 - return() 65 - endif() 66 - 67 34 # Compute the installation prefix relative to this file. 68 - get_filename_component(_sdl3_xcframework_parent_path "${CMAKE_CURRENT_LIST_DIR}" REALPATH) # /share/cmake/SDL3/ 69 - get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" REALPATH) # /share/cmake/SDL3/ 70 - get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" PATH) # /share/cmake 71 - get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" PATH) # /share 72 - get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" PATH) # / 73 - set_and_check(_sdl3_xcframework_path "${_sdl3_xcframework_parent_path}/SDL3.xcframework") # /SDL3.xcframework 74 - set_and_check(_sdl3_framework_parent_path "${_sdl3_xcframework_path}/${_xcfw_target_subdir}") # /SDL3.xcframework/macos-arm64_x86_64 75 - set_and_check(_sdl3_framework_path "${_sdl3_framework_parent_path}/SDL3.framework") # /SDL3.xcframework/macos-arm64_x86_64/SDL3.framework 76 - set_and_check(_sdl3_include_dirs "${_sdl3_framework_path}/Headers") 35 + set(_sdl3_framework_path "${CMAKE_CURRENT_LIST_DIR}") # > /SDL3.framework/Resources/CMake/ 36 + get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" REALPATH) # > /SDL3.framework/Versions/Current/Resources/CMake 37 + get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" REALPATH) # > /SDL3.framework/Versions/A/Resources/CMake/ 38 + get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/Versions/A/Resources/ 39 + get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/Versions/A/ 40 + get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/Versions/ 41 + get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/ 42 + get_filename_component(_sdl3_framework_parent_path "${_sdl3_framework_path}" PATH) # > / 77 43 78 44 79 45 # All targets are created, even when some might not be requested though COMPONENTS. ··· 84 50 set_target_properties(SDL3::Headers 85 51 PROPERTIES 86 52 INTERFACE_COMPILE_OPTIONS "SHELL:-F \"${_sdl3_framework_parent_path}\"" 87 - INTERFACE_INCLUDE_DIRECTORIES "${_sdl3_include_dirs}" 88 53 ) 89 54 endif() 90 55 set(SDL3_Headers_FOUND TRUE) 91 56 92 57 if(NOT TARGET SDL3::SDL3-shared) 93 58 add_library(SDL3::SDL3-shared SHARED IMPORTED) 94 - if(CMAKE_VERSION GREATER_EQUAL "3.28") 95 - set_target_properties(SDL3::SDL3-shared 96 - PROPERTIES 97 - FRAMEWORK "TRUE" 98 - IMPORTED_LOCATION "${_sdl3_xcframework_path}" 99 - INTERFACE_LINK_LIBRARIES "SDL3::Headers" 100 - ) 101 - else() 102 - set_target_properties(SDL3::SDL3-shared 103 - PROPERTIES 104 - FRAMEWORK "TRUE" 105 - IMPORTED_LOCATION "${_sdl3_framework_path}/SDL3" 106 - INTERFACE_LINK_LIBRARIES "SDL3::Headers" 107 - ) 108 - endif() 109 59 set_target_properties(SDL3::SDL3-shared 110 60 PROPERTIES 61 + FRAMEWORK "TRUE" 62 + IMPORTED_LOCATION "${_sdl3_framework_path}/SDL3" 63 + INTERFACE_LINK_LIBRARIES "SDL3::Headers" 111 64 COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED" 112 65 INTERFACE_SDL3_SHARED "ON" 113 66 COMPATIBLE_INTERFACE_STRING "SDL_VERSION" ··· 120 73 121 74 set(SDL3_SDL3_test FALSE) 122 75 123 - unset(_sdl3_xcframework_parent_path) 124 - unset(_sdl3_xcframework_path) 125 76 unset(_sdl3_framework_parent_path) 126 77 unset(_sdl3_framework_path) 127 - unset(_sdl3_include_dirs) 128 78 129 79 if(SDL3_SDL3-shared_FOUND) 130 80 set(SDL3_SDL3_FOUND TRUE)
+12 -12
Xcode/SDL/pkg-support/resources/ReadMe.txt
··· 1 - The Simple DirectMedia Layer (SDL for short) is a cross-platform 2 - library designed to make it easy to write multi-media software, 1 + The Simple DirectMedia Layer (SDL for short) is a cross-platform 2 + library designed to make it easy to write multi-media software, 3 3 such as games and emulators. 4 4 5 - The Simple DirectMedia Layer library source code is available from: 5 + The Simple DirectMedia Layer library source code is available from: 6 6 http://www.libsdl.org/ 7 7 8 - This library is distributed under the terms of the zlib license: 8 + This library is distributed under the terms of the zlib license: 9 9 http://zlib.net/zlib_license.html 10 10 11 11 12 - This packages contains the SDL framework for macOS. 13 - Conforming with Apple guidelines, this framework 12 + This packages contains the SDL framework for macOS. 13 + Conforming with Apple guidelines, this framework 14 14 contains both the SDL runtime component and development header files. 15 15 16 16 17 17 To Install: 18 - Copy the SDL3.framework to /Library/Frameworks 18 + Copy "SDL3.xcframework" and "share" to /Library/Frameworks 19 19 20 - You may alternatively install it in <Your home directory>/Library/Frameworks 20 + You may alternatively install it in <Your home directory>/Library/Frameworks 21 21 if your access privileges are not high enough. 22 22 23 23 24 24 Use in CMake projects: 25 - SDL3.framework can be used in CMake projects using the following pattern: 26 - ``` 25 + SDL3.xcframework can be used in CMake projects using the following pattern: 26 + ```cmake 27 27 find_package(SDL3 REQUIRED COMPONENTS SDL3) 28 28 add_executable(my_game ${MY_SOURCES}) 29 29 target_link_libraries(my_game PRIVATE SDL3::SDL3) ··· 35 35 36 36 Additional References: 37 37 38 - - Screencast tutorials for getting started with OpenSceneGraph/macOS are 38 + - Screencast tutorials for getting started with OpenSceneGraph/macOS are 39 39 available at: 40 40 http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/MacOSXTips 41 - Though these are OpenSceneGraph centric, the same exact concepts apply to 41 + Though these are OpenSceneGraph centric, the same exact concepts apply to 42 42 SDL, thus the videos are recommended for everybody getting started with 43 43 developing on macOS. (You can skim over the PlugIns stuff since SDL 44 44 doesn't have any PlugIns to worry about.)
+76
Xcode/SDL/pkg-support/resources/share/cmake/SDL3/sdl3-config-version.cmake
··· 1 + # based on the files generated by CMake's write_basic_package_version_file 2 + 3 + # SDL CMake version configuration file: 4 + # This file is meant to be placed in share/cmake/SDL3, next to SDL3.xcframework 5 + 6 + cmake_minimum_required(VERSION 3.12) 7 + 8 + get_filename_component(_sdl3_xcframework_parent_path "${CMAKE_CURRENT_LIST_DIR}" REALPATH) # /share/cmake/SDL3/ 9 + get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" REALPATH) # /share/cmake/SDL3/ 10 + get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" PATH) # /share/cmake 11 + get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" PATH) # /share 12 + get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" PATH) # / 13 + set(_sdl3_xcframework "${_sdl3_xcframework_parent_path}/SDL3.xcframework") # /SDL3.xcframework 14 + set(_sdl3_framework "${_sdl3_xcframework}/macos-arm64_x86_64/SDL3.framework") # /SDL3.xcframework/macos-arm64_x86_64/SDL3.framework 15 + set(_sdl3_version_h "${_sdl3_framework}/Headers/SDL_version.h") # /SDL3.xcframework/macos-arm64_x86_64/SDL3.framework/Headers/SDL_version.h 16 + 17 + if(NOT EXISTS "${_sdl3_version_h}") 18 + message(AUTHOR_WARNING "Cannot not find ${_sdl3_framework}. This script is meant to be placed in share/cmake/SDL3, next to SDL3.xcframework") 19 + return() 20 + endif() 21 + 22 + file(READ "${_sdl3_version_h}" _sdl_version_h) 23 + 24 + unset(_sdl3_xcframework_parent_path) 25 + unset(_sdl3_framework) 26 + unset(_sdl3_xcframework) 27 + unset(_sdl3_version_h) 28 + 29 + string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_major_re "${_sdl_version_h}") 30 + set(_sdl_major "${CMAKE_MATCH_1}") 31 + string(REGEX MATCH "#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_version_h}") 32 + set(_sdl_minor "${CMAKE_MATCH_1}") 33 + string(REGEX MATCH "#define[ \t]+SDL_MICRO_VERSION[ \t]+([0-9]+)" _sdl_micro_re "${_sdl_version_h}") 34 + set(_sdl_micro "${CMAKE_MATCH_1}") 35 + if(_sdl_major_re AND _sdl_minor_re AND _sdl_micro_re) 36 + set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_micro}") 37 + else() 38 + message(AUTHOR_WARNING "Could not extract version from SDL_version.h.") 39 + return() 40 + endif() 41 + 42 + unset(_sdl_major_re) 43 + unset(_sdl_major) 44 + unset(_sdl_minor_re) 45 + unset(_sdl_minor) 46 + unset(_sdl_micro_re) 47 + unset(_sdl_micro) 48 + 49 + if(PACKAGE_FIND_VERSION_RANGE) 50 + # Package version must be in the requested version range 51 + if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN) 52 + OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX) 53 + OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX))) 54 + set(PACKAGE_VERSION_COMPATIBLE FALSE) 55 + else() 56 + set(PACKAGE_VERSION_COMPATIBLE TRUE) 57 + endif() 58 + else() 59 + if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) 60 + set(PACKAGE_VERSION_COMPATIBLE FALSE) 61 + else() 62 + set(PACKAGE_VERSION_COMPATIBLE TRUE) 63 + if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) 64 + set(PACKAGE_VERSION_EXACT TRUE) 65 + endif() 66 + endif() 67 + endif() 68 + 69 + # The SDL3.xcframework only contains 64-bit archives 70 + if(NOT "${CMAKE_SIZEOF_VOID_P}" EQUAL "8") 71 + set(PACKAGE_VERSION_UNSUITABLE TRUE) 72 + endif() 73 + 74 + if(NOT CMAKE_SYSTEM_NAME MATCHES "^(Darwin|iOS|tvOS)$") 75 + set(PACKAGE_VERSION_UNSUITABLE TRUE) 76 + endif()
+154
Xcode/SDL/pkg-support/resources/share/cmake/SDL3/sdl3-config.cmake
··· 1 + # SDL3 CMake configuration file: 2 + # This file is meant to be placed in share/cmake/SDL3, next to SDL3.xcframework 3 + 4 + # INTERFACE_LINK_OPTIONS needs CMake 3.12 5 + cmake_minimum_required(VERSION 3.12) 6 + 7 + include(FeatureSummary) 8 + set_package_properties(SDL3 PROPERTIES 9 + URL "https://www.libsdl.org/" 10 + DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" 11 + ) 12 + 13 + # Copied from `configure_package_config_file` 14 + macro(set_and_check _var _file) 15 + set(${_var} "${_file}") 16 + if(NOT EXISTS "${_file}") 17 + message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") 18 + endif() 19 + endmacro() 20 + 21 + # Copied from `configure_package_config_file` 22 + macro(check_required_components _NAME) 23 + foreach(comp ${${_NAME}_FIND_COMPONENTS}) 24 + if(NOT ${_NAME}_${comp}_FOUND) 25 + if(${_NAME}_FIND_REQUIRED_${comp}) 26 + set(${_NAME}_FOUND FALSE) 27 + endif() 28 + endif() 29 + endforeach() 30 + endmacro() 31 + 32 + set(SDL3_FOUND TRUE) 33 + 34 + macro(_check_target_is_simulator) 35 + include(CheckCSourceCompiles) 36 + check_c_source_compiles([===[ 37 + #include <TargetConditionals.h> 38 + #if defined(TARGET_OS_SIMULATOR) 39 + int target_is_simulator; 40 + #endif 41 + int main(int argc, char *argv[]) { return target_is_simulator; } 42 + ]===] SDL_TARGET_IS_SIMULATOR) 43 + endmacro() 44 + 45 + if(CMAKE_SYSTEM_NAME STREQUAL "iOS") 46 + _check_target_is_simulator() 47 + if(SDL_TARGET_IS_SIMULATOR) 48 + set(_xcfw_target_subdir "ios-arm64_x86_64-simulator") 49 + else() 50 + set(_xcfw_target_subdir "ios-arm64") 51 + endif() 52 + elseif(CMAKE_SYSTEM_NAME STREQUAL "tvOS") 53 + _check_target_is_simulator() 54 + if(SDL_TARGET_IS_SIMULATOR) 55 + set(_xcfw_target_subdir "tvos-arm64_x86_64-simulator") 56 + else() 57 + set(_xcfw_target_subdir "tvos-arm64") 58 + endif() 59 + elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") 60 + set(_xcfw_target_subdir "macos-arm64_x86_64") 61 + else() 62 + message(WARNING "Unsupported Apple platform (${CMAKE_SYSTEM_NAME}) and broken sdl3-config-version.cmake") 63 + set(SDL3_FOUND FALSE) 64 + return() 65 + endif() 66 + 67 + # Compute the installation prefix relative to this file. 68 + get_filename_component(_sdl3_xcframework_parent_path "${CMAKE_CURRENT_LIST_DIR}" REALPATH) # /share/cmake/SDL3/ 69 + get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" REALPATH) # /share/cmake/SDL3/ 70 + get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" PATH) # /share/cmake 71 + get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" PATH) # /share 72 + get_filename_component(_sdl3_xcframework_parent_path "${_sdl3_xcframework_parent_path}" PATH) # / 73 + set_and_check(_sdl3_xcframework_path "${_sdl3_xcframework_parent_path}/SDL3.xcframework") # /SDL3.xcframework 74 + set_and_check(_sdl3_framework_parent_path "${_sdl3_xcframework_path}/${_xcfw_target_subdir}") # /SDL3.xcframework/macos-arm64_x86_64 75 + set_and_check(_sdl3_framework_path "${_sdl3_framework_parent_path}/SDL3.framework") # /SDL3.xcframework/macos-arm64_x86_64/SDL3.framework 76 + 77 + 78 + # All targets are created, even when some might not be requested though COMPONENTS. 79 + # This is done for compatibility with CMake generated SDL3-target.cmake files. 80 + 81 + if(NOT TARGET SDL3::Headers) 82 + add_library(SDL3::Headers INTERFACE IMPORTED) 83 + set_target_properties(SDL3::Headers 84 + PROPERTIES 85 + INTERFACE_COMPILE_OPTIONS "SHELL:-F \"${_sdl3_framework_parent_path}\"" 86 + ) 87 + endif() 88 + set(SDL3_Headers_FOUND TRUE) 89 + 90 + if(NOT TARGET SDL3::SDL3-shared) 91 + add_library(SDL3::SDL3-shared SHARED IMPORTED) 92 + if(CMAKE_VERSION GREATER_EQUAL "3.28") 93 + set_target_properties(SDL3::SDL3-shared 94 + PROPERTIES 95 + FRAMEWORK "TRUE" 96 + IMPORTED_LOCATION "${_sdl3_xcframework_path}" 97 + INTERFACE_LINK_LIBRARIES "SDL3::Headers" 98 + ) 99 + else() 100 + set_target_properties(SDL3::SDL3-shared 101 + PROPERTIES 102 + FRAMEWORK "TRUE" 103 + IMPORTED_LOCATION "${_sdl3_framework_path}/SDL3" 104 + INTERFACE_LINK_LIBRARIES "SDL3::Headers" 105 + ) 106 + endif() 107 + set_target_properties(SDL3::SDL3-shared 108 + PROPERTIES 109 + COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED" 110 + INTERFACE_SDL3_SHARED "ON" 111 + COMPATIBLE_INTERFACE_STRING "SDL_VERSION" 112 + INTERFACE_SDL_VERSION "SDL3" 113 + ) 114 + endif() 115 + set(SDL3_SDL3-shared_FOUND TRUE) 116 + 117 + set(SDL3_SDL3-static FALSE) 118 + 119 + set(SDL3_SDL3_test FALSE) 120 + 121 + unset(_sdl3_xcframework_parent_path) 122 + unset(_sdl3_xcframework_path) 123 + unset(_sdl3_framework_parent_path) 124 + unset(_sdl3_framework_path) 125 + unset(_sdl3_include_dirs) 126 + 127 + if(SDL3_SDL3-shared_FOUND) 128 + set(SDL3_SDL3_FOUND TRUE) 129 + endif() 130 + 131 + function(_sdl_create_target_alias_compat NEW_TARGET TARGET) 132 + if(CMAKE_VERSION VERSION_LESS "3.18") 133 + # Aliasing local targets is not supported on CMake < 3.18, so make it global. 134 + add_library(${NEW_TARGET} INTERFACE IMPORTED) 135 + set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}") 136 + else() 137 + add_library(${NEW_TARGET} ALIAS ${TARGET}) 138 + endif() 139 + endfunction() 140 + 141 + # Make sure SDL3::SDL3 always exists 142 + if(NOT TARGET SDL3::SDL3) 143 + if(TARGET SDL3::SDL3-shared) 144 + _sdl_create_target_alias_compat(SDL3::SDL3 SDL3::SDL3-shared) 145 + endif() 146 + endif() 147 + 148 + check_required_components(SDL3) 149 + 150 + set(SDL3_LIBRARIES SDL3::SDL3) 151 + set(SDL3_STATIC_LIBRARIES SDL3::SDL3-static) 152 + set(SDL3_STATIC_PRIVATE_LIBS) 153 + 154 + set(SDL3TEST_LIBRARY SDL3::SDL3_test)