diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
| commit | 5a079a2d114f96d4847d1ee305d5b7c16eeec50e (patch) | |
| tree | 8926ab44f168acf787d8e19608857b3af0f82758 /contrib/SDL-3.2.8/cmake/android/FindSdlAndroid.cmake | |
Initial commit
Diffstat (limited to 'contrib/SDL-3.2.8/cmake/android/FindSdlAndroid.cmake')
| -rw-r--r-- | contrib/SDL-3.2.8/cmake/android/FindSdlAndroid.cmake | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/cmake/android/FindSdlAndroid.cmake b/contrib/SDL-3.2.8/cmake/android/FindSdlAndroid.cmake new file mode 100644 index 0000000..851848f --- /dev/null +++ b/contrib/SDL-3.2.8/cmake/android/FindSdlAndroid.cmake | |||
| @@ -0,0 +1,103 @@ | |||
| 1 | #[=======================================================================[ | ||
| 2 | |||
| 3 | FindSdlAndroid | ||
| 4 | ---------------------- | ||
| 5 | |||
| 6 | Locate various executables that are essential to creating an Android APK archive. | ||
| 7 | This find module uses the FindSdlAndroidBuildTools module to locate some Android utils. | ||
| 8 | |||
| 9 | |||
| 10 | Imported targets | ||
| 11 | ^^^^^^^^^^^^^^^^ | ||
| 12 | |||
| 13 | This module defines the following :prop_tgt:`IMPORTED` target(s): | ||
| 14 | |||
| 15 | `` SdlAndroid::aapt2 `` | ||
| 16 | Imported executable for the "android package tool" v2 | ||
| 17 | |||
| 18 | `` SdlAndroid::apksigner`` | ||
| 19 | Imported executable for the APK signer tool | ||
| 20 | |||
| 21 | `` SdlAndroid::d8 `` | ||
| 22 | Imported executable for the dex compiler | ||
| 23 | |||
| 24 | `` SdlAndroid::zipalign `` | ||
| 25 | Imported executable for the zipalign util | ||
| 26 | |||
| 27 | `` SdlAndroid::adb `` | ||
| 28 | Imported executable for the "android debug bridge" tool | ||
| 29 | |||
| 30 | `` SdlAndroid::keytool `` | ||
| 31 | Imported executable for the keytool, a key and certificate management utility | ||
| 32 | |||
| 33 | `` SdlAndroid::zip `` | ||
| 34 | Imported executable for the zip, for packaging and compressing files | ||
| 35 | |||
| 36 | Result variables | ||
| 37 | ^^^^^^^^^^^^^^^^ | ||
| 38 | |||
| 39 | This module will set the following variables in your project: | ||
| 40 | |||
| 41 | `` AAPT2_BIN `` | ||
| 42 | Path of aapt2 | ||
| 43 | |||
| 44 | `` APKSIGNER_BIN `` | ||
| 45 | Path of apksigner | ||
| 46 | |||
| 47 | `` D8_BIN `` | ||
| 48 | Path of d8 | ||
| 49 | |||
| 50 | `` ZIPALIGN_BIN `` | ||
| 51 | Path of zipalign | ||
| 52 | |||
| 53 | `` ADB_BIN `` | ||
| 54 | Path of adb | ||
| 55 | |||
| 56 | `` KEYTOOL_BIN `` | ||
| 57 | Path of keytool | ||
| 58 | |||
| 59 | `` ZIP_BIN `` | ||
| 60 | Path of zip | ||
| 61 | |||
| 62 | #]=======================================================================] | ||
| 63 | |||
| 64 | cmake_minimum_required(VERSION 3.7...3.28) | ||
| 65 | |||
| 66 | if(NOT PROJECT_NAME MATCHES "^SDL.*") | ||
| 67 | message(WARNING "This module is internal to SDL and is currently not supported.") | ||
| 68 | endif() | ||
| 69 | |||
| 70 | find_package(SdlAndroidBuildTools MODULE) | ||
| 71 | |||
| 72 | function(_sdl_android_find_create_imported_executable NAME) | ||
| 73 | string(TOUPPER "${NAME}" NAME_UPPER) | ||
| 74 | set(varname "${NAME_UPPER}_BIN") | ||
| 75 | find_program("${varname}" NAMES "${NAME}" PATHS ${SDL_ANDROID_BUILD_TOOLS_ROOT}) | ||
| 76 | if(EXISTS "${${varname}}" AND NOT TARGET SdlAndroid::${NAME}) | ||
| 77 | add_executable(SdlAndroid::${NAME} IMPORTED) | ||
| 78 | set_property(TARGET SdlAndroid::${NAME} PROPERTY IMPORTED_LOCATION "${${varname}}") | ||
| 79 | endif() | ||
| 80 | endfunction() | ||
| 81 | |||
| 82 | if(SdlAndroidBuildTools_FOUND) | ||
| 83 | _sdl_android_find_create_imported_executable(aapt2) | ||
| 84 | _sdl_android_find_create_imported_executable(apksigner) | ||
| 85 | _sdl_android_find_create_imported_executable(d8) | ||
| 86 | _sdl_android_find_create_imported_executable(zipalign) | ||
| 87 | endif() | ||
| 88 | |||
| 89 | _sdl_android_find_create_imported_executable(adb) | ||
| 90 | _sdl_android_find_create_imported_executable(keytool) | ||
| 91 | _sdl_android_find_create_imported_executable(zip) | ||
| 92 | include(FindPackageHandleStandardArgs) | ||
| 93 | |||
| 94 | find_package_handle_standard_args(SdlAndroid | ||
| 95 | VERSION_VAR | ||
| 96 | REQUIRED_VARS | ||
| 97 | AAPT2_BIN | ||
| 98 | APKSIGNER_BIN | ||
| 99 | D8_BIN | ||
| 100 | ZIPALIGN_BIN | ||
| 101 | KEYTOOL_BIN | ||
| 102 | ZIP_BIN | ||
| 103 | ) | ||
