From 6aaedb813fa11ba0679c3051bc2eb28646b9506c Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Sat, 30 Aug 2025 16:53:58 -0700 Subject: Update to SDL3 --- .../cmake/android/SdlAndroidScript.cmake | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/contrib/SDL-3.2.20/cmake/android/SdlAndroidScript.cmake (limited to 'src/contrib/SDL-3.2.20/cmake/android/SdlAndroidScript.cmake') diff --git a/src/contrib/SDL-3.2.20/cmake/android/SdlAndroidScript.cmake b/src/contrib/SDL-3.2.20/cmake/android/SdlAndroidScript.cmake new file mode 100644 index 0000000..15dea2d --- /dev/null +++ b/src/contrib/SDL-3.2.20/cmake/android/SdlAndroidScript.cmake @@ -0,0 +1,74 @@ +#[=======================================================================[ + +This CMake script is meant to be used in CMake script mode (cmake -P). +It wraps commands that communicate with an actual Android device. +Because + +#]=======================================================================] + +cmake_minimum_required(VERSION 3.16...3.28) + +if(NOT CMAKE_SCRIPT_MODE_FILE) + message(FATAL_ERROR "This file can only be used in CMake script mode") +endif() +if(NOT ADB) + set(ADB "adb") +endif() + +if(NOT ACTION) + message(FATAL_ERROR "Missing ACTION argument") +endif() + +if(ACTION STREQUAL "uninstall") + # The uninstall action attempts to uninstall all packages. All failures are ignored. + foreach(package IN LISTS PACKAGES) + message("Uninstalling ${package} ...") + execute_process( + COMMAND ${ADB} uninstall ${package} + RESULT_VARIABLE res + ) + message("... result=${res}") + endforeach() +elseif(ACTION STREQUAL "install") + # The install actions attempts to install APK's to an Android device using adb. Failures are ignored. + set(failed_apks "") + foreach(apk IN LISTS APKS) + message("Installing ${apk} ...") + execute_process( + COMMAND ${ADB} install -d -r --streaming ${apk} + RESULT_VARIABLE res + ) + message("... result=${res}") + if(NOT res EQUAL 0) + list(APPEND failed_apks ${apk}) + endif() + endforeach() + if(failed_apks) + message(FATAL_ERROR "Failed to install ${failed_apks}") + endif() +elseif(ACTION STREQUAL "build-install-run") + if(NOT EXECUTABLES) + message(FATAL_ERROR "Missing EXECUTABLES (don't know what executables to build/install and start") + endif() + if(NOT BUILD_FOLDER) + message(FATAL_ERROR "Missing BUILD_FOLDER (don't know where to build the APK's") + endif() + set(install_targets "") + foreach(executable IN LISTS EXECUTABLES) + list(APPEND install_targets "install-${executable}") + endforeach() + execute_process( + COMMAND ${CMAKE_COMMAND} --build "${BUILD_FOLDER}" --target ${install_targets} + RESULT_VARIABLE res + ) + if(NOT res EQUAL 0) + message(FATAL_ERROR "Failed to install APK(s) for ${EXECUTABLES}") + endif() + list(GET EXECUTABLES 0 start_executable) + execute_process( + COMMAND ${CMAKE_COMMAND} --build "${BUILD_FOLDER}" --target start-${start_executable} + RESULT_VARIABLE res + ) +else() + message(FATAL_ERROR "Unknown ACTION=${ACTION}") +endif() -- cgit v1.2.3