cmake: install Android.mk files for ndk-build

This allows including SDL2 with ndk-build using
NDK_MODULE_PATH + import-module

An install tree looks like:
```
`-- share
    |-- aclocal
    |   `-- sdl2.m4
    |-- licenses
    |   `-- SDL2
    |       `-- LICENSE.txt
    `-- ndk-modules
        |-- SDL2
        |   `-- Android.mk
        |-- SDL2-static
        |   `-- Android.mk
        |-- SDL2main
        |   `-- Android.mk
        `-- SDL2test
            `-- Android.mk
```

The generated `/share/ndk-modules/SDL2/Android.mk` contains:
```
LOCAL_PATH := $(call my-dir)
_IMPORT_PREFIX := $(LOCAL_PATH)/../../..

include $(CLEAR_VARS)
LOCAL_MODULE := SDL2
LOCAL_SRC_FILES := $(_IMPORT_PREFIX)/lib/libSDL2.so
LOCAL_CPP_FEATURES := rtti exceptions
LOCAL_EXPORT_C_INCLUDES := ${_IMPORT_PREFIX}/include\
${_IMPORT_PREFIX}/include/SDL2
include $(PREBUILT_SHARED_LIBRARY)`
```
This commit is contained in:
Anonymous Maarten 2022-06-16 03:37:05 +02:00 committed by Anonymous Maarten
parent b3159714db
commit 3617691fe0
1 changed files with 16 additions and 0 deletions

View File

@ -3160,6 +3160,10 @@ if(NOT SDL2_DISABLE_INSTALL)
NAMESPACE SDL2::
DESTINATION ${PKG_PREFIX}
)
if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7)
install(EXPORT_ANDROID_MK SDL2Targets
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL2")
endif()
endif()
if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN)
@ -3168,6 +3172,10 @@ if(NOT SDL2_DISABLE_INSTALL)
NAMESPACE SDL2::
DESTINATION ${PKG_PREFIX}
)
if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7)
install(EXPORT_ANDROID_MK SDL2mainTargets
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL2main")
endif()
endif()
if(SDL_STATIC)
@ -3176,6 +3184,10 @@ if(NOT SDL2_DISABLE_INSTALL)
NAMESPACE SDL2::
DESTINATION ${PKG_PREFIX}
)
if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7)
install(EXPORT_ANDROID_MK SDL2staticTargets
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL2-static")
endif()
endif()
if(SDL_TEST)
@ -3184,6 +3196,10 @@ if(NOT SDL2_DISABLE_INSTALL)
NAMESPACE SDL2::
DESTINATION ${PKG_PREFIX}
)
if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7)
install(EXPORT_ANDROID_MK SDL2testTargets
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL2test")
endif()
endif()
install(