summaryrefslogtreecommitdiff
path: root/src/contrib/SDL-3.2.20/android-project/app/jni
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2025-08-30 16:53:58 -0700
committer3gg <3gg@shellblade.net>2025-08-30 16:53:58 -0700
commit6aaedb813fa11ba0679c3051bc2eb28646b9506c (patch)
tree34acbfc9840e02cb4753e6306ea7ce978bf8b58e /src/contrib/SDL-3.2.20/android-project/app/jni
parent8f228ade99dd3d4c8da9b78ade1815c9adf85c8f (diff)
Update to SDL3
Diffstat (limited to 'src/contrib/SDL-3.2.20/android-project/app/jni')
-rw-r--r--src/contrib/SDL-3.2.20/android-project/app/jni/Android.mk1
-rw-r--r--src/contrib/SDL-3.2.20/android-project/app/jni/Application.mk13
-rw-r--r--src/contrib/SDL-3.2.20/android-project/app/jni/CMakeLists.txt15
-rw-r--r--src/contrib/SDL-3.2.20/android-project/app/jni/src/Android.mk19
-rw-r--r--src/contrib/SDL-3.2.20/android-project/app/jni/src/CMakeLists.txt34
-rw-r--r--src/contrib/SDL-3.2.20/android-project/app/jni/src/YourSourceHere.c26
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
7APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
8
9# Min runtime API level
10APP_PLATFORM=android-21
11
12# https://developer.android.com/guide/practices/page-sizes#update-packaging
13APP_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 @@
1cmake_minimum_required(VERSION 3.6)
2
3project(GAME)
4
5# SDL sources are in a subfolder named "SDL"
6add_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"
14add_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 @@
1LOCAL_PATH := $(call my-dir)
2
3include $(CLEAR_VARS)
4
5LOCAL_MODULE := main
6
7# Add your application source files here...
8LOCAL_SRC_FILES := \
9 YourSourceHere.c
10
11SDL_PATH := ../SDL # SDL
12
13LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(SDL_PATH)/include # SDL
14
15LOCAL_SHARED_LIBRARIES := SDL3
16
17LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid # SDL
18
19include $(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 @@
1cmake_minimum_required(VERSION 3.6)
2
3project(my_app)
4
5if(NOT TARGET SDL3::SDL3)
6 find_package(SDL3 CONFIG)
7endif()
8
9if(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}")
15endif()
16
17if(NOT TARGET SDL3::SDL3)
18 message(FATAL_ERROR "Cannot find SDL3.
19
20Possible 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")
24endif()
25
26add_library(main SHARED
27 YourSourceHere.c
28)
29
30#https://developer.android.com/guide/practices/page-sizes#update-packaging
31target_link_options(main PRIVATE "-Wl,-z,max-page-size=16384")
32target_link_options(main PRIVATE "-Wl,-z,common-page-size=16384")
33
34target_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
10int 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}