diff options
Diffstat (limited to 'src/contrib/SDL-3.2.20/android-project/app/jni')
6 files changed, 108 insertions, 0 deletions
diff --git a/src/contrib/SDL-3.2.20/android-project/app/jni/Android.mk b/src/contrib/SDL-3.2.20/android-project/app/jni/Android.mk new file mode 100644 index 0000000..5053e7d --- /dev/null +++ b/src/contrib/SDL-3.2.20/android-project/app/jni/Android.mk | |||
@@ -0,0 +1 @@ | |||
include $(call all-subdir-makefiles) | |||
diff --git a/src/contrib/SDL-3.2.20/android-project/app/jni/Application.mk b/src/contrib/SDL-3.2.20/android-project/app/jni/Application.mk new file mode 100644 index 0000000..80b73fd --- /dev/null +++ b/src/contrib/SDL-3.2.20/android-project/app/jni/Application.mk | |||
@@ -0,0 +1,13 @@ | |||
1 | |||
2 | # Uncomment this if you're using STL in your project | ||
3 | # You can find more information here: | ||
4 | # https://developer.android.com/ndk/guides/cpp-support | ||
5 | # APP_STL := c++_shared | ||
6 | |||
7 | APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 | ||
8 | |||
9 | # Min runtime API level | ||
10 | APP_PLATFORM=android-21 | ||
11 | |||
12 | # https://developer.android.com/guide/practices/page-sizes#update-packaging | ||
13 | APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true \ No newline at end of file | ||
diff --git a/src/contrib/SDL-3.2.20/android-project/app/jni/CMakeLists.txt b/src/contrib/SDL-3.2.20/android-project/app/jni/CMakeLists.txt new file mode 100644 index 0000000..404b87b --- /dev/null +++ b/src/contrib/SDL-3.2.20/android-project/app/jni/CMakeLists.txt | |||
@@ -0,0 +1,15 @@ | |||
1 | cmake_minimum_required(VERSION 3.6) | ||
2 | |||
3 | project(GAME) | ||
4 | |||
5 | # SDL sources are in a subfolder named "SDL" | ||
6 | add_subdirectory(SDL) | ||
7 | |||
8 | # Compilation of companion libraries | ||
9 | #add_subdirectory(SDL_image) | ||
10 | #add_subdirectory(SDL_mixer) | ||
11 | #add_subdirectory(SDL_ttf) | ||
12 | |||
13 | # Your game and its CMakeLists.txt are in a subfolder named "src" | ||
14 | add_subdirectory(src) | ||
15 | |||
diff --git a/src/contrib/SDL-3.2.20/android-project/app/jni/src/Android.mk b/src/contrib/SDL-3.2.20/android-project/app/jni/src/Android.mk new file mode 100644 index 0000000..61672d4 --- /dev/null +++ b/src/contrib/SDL-3.2.20/android-project/app/jni/src/Android.mk | |||
@@ -0,0 +1,19 @@ | |||
1 | LOCAL_PATH := $(call my-dir) | ||
2 | |||
3 | include $(CLEAR_VARS) | ||
4 | |||
5 | LOCAL_MODULE := main | ||
6 | |||
7 | # Add your application source files here... | ||
8 | LOCAL_SRC_FILES := \ | ||
9 | YourSourceHere.c | ||
10 | |||
11 | SDL_PATH := ../SDL # SDL | ||
12 | |||
13 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(SDL_PATH)/include # SDL | ||
14 | |||
15 | LOCAL_SHARED_LIBRARIES := SDL3 | ||
16 | |||
17 | LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid # SDL | ||
18 | |||
19 | include $(BUILD_SHARED_LIBRARY) | ||
diff --git a/src/contrib/SDL-3.2.20/android-project/app/jni/src/CMakeLists.txt b/src/contrib/SDL-3.2.20/android-project/app/jni/src/CMakeLists.txt new file mode 100644 index 0000000..df0a4d0 --- /dev/null +++ b/src/contrib/SDL-3.2.20/android-project/app/jni/src/CMakeLists.txt | |||
@@ -0,0 +1,34 @@ | |||
1 | cmake_minimum_required(VERSION 3.6) | ||
2 | |||
3 | project(my_app) | ||
4 | |||
5 | if(NOT TARGET SDL3::SDL3) | ||
6 | find_package(SDL3 CONFIG) | ||
7 | endif() | ||
8 | |||
9 | if(NOT TARGET SDL3::SDL3) | ||
10 | find_library(SDL3_LIBRARY NAMES "SDL3") | ||
11 | find_path(SDL3_INCLUDE_DIR NAMES "SDL3/SDL.h") | ||
12 | add_library(SDL3::SDL3 UNKNOWN IMPORTED) | ||
13 | set_property(TARGET SDL3::SDL3 PROPERTY IMPORTED_LOCATION "${SDL3_LIBRARY}") | ||
14 | set_property(TARGET SDL3::SDL3 PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIR}") | ||
15 | endif() | ||
16 | |||
17 | if(NOT TARGET SDL3::SDL3) | ||
18 | message(FATAL_ERROR "Cannot find SDL3. | ||
19 | |||
20 | Possible ways to fix this: | ||
21 | - Use a SDL3 Android aar archive, and configure gradle to use it: prefab is required. | ||
22 | - Add add_subdirectory(path/to/SDL) to your CMake script, and make sure a vendored SDL is present there. | ||
23 | ") | ||
24 | endif() | ||
25 | |||
26 | add_library(main SHARED | ||
27 | YourSourceHere.c | ||
28 | ) | ||
29 | |||
30 | #https://developer.android.com/guide/practices/page-sizes#update-packaging | ||
31 | target_link_options(main PRIVATE "-Wl,-z,max-page-size=16384") | ||
32 | target_link_options(main PRIVATE "-Wl,-z,common-page-size=16384") | ||
33 | |||
34 | target_link_libraries(main PRIVATE SDL3::SDL3) | ||
diff --git a/src/contrib/SDL-3.2.20/android-project/app/jni/src/YourSourceHere.c b/src/contrib/SDL-3.2.20/android-project/app/jni/src/YourSourceHere.c new file mode 100644 index 0000000..87b8297 --- /dev/null +++ b/src/contrib/SDL-3.2.20/android-project/app/jni/src/YourSourceHere.c | |||
@@ -0,0 +1,26 @@ | |||
1 | #include <SDL3/SDL.h> | ||
2 | #include <SDL3/SDL_main.h> | ||
3 | |||
4 | /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ | ||
5 | /* */ | ||
6 | /* Remove this source, and replace with your SDL sources */ | ||
7 | /* */ | ||
8 | /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ | ||
9 | |||
10 | int main(int argc, char *argv[]) { | ||
11 | (void)argc; | ||
12 | (void)argv; | ||
13 | if (!SDL_Init(SDL_INIT_EVENTS | SDL_INIT_VIDEO)) { | ||
14 | SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init failed (%s)", SDL_GetError()); | ||
15 | return 1; | ||
16 | } | ||
17 | |||
18 | if (!SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Hello World", | ||
19 | "!! Your SDL project successfully runs on Android !!", NULL)) { | ||
20 | SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_ShowSimpleMessageBox failed (%s)", SDL_GetError()); | ||
21 | return 1; | ||
22 | } | ||
23 | |||
24 | SDL_Quit(); | ||
25 | return 0; | ||
26 | } | ||