Fixed bug 3918 - CMake support for android project

This commit is contained in:
Sylvain Becker 2019-08-11 15:23:37 +02:00
parent 102850e1bd
commit 79da113ed7
5 changed files with 64 additions and 2 deletions

View file

@ -22,6 +22,11 @@ android {
arguments "APP_PLATFORM=android-16"
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
// cmake {
// arguments "-DANDROID_APP_PLATFORM=android-16", "-DANDROID_STL=c++_static"
// // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
// abiFilters 'arm64-v8a'
// }
}
}
buildTypes {
@ -38,6 +43,9 @@ android {
ndkBuild {
path 'jni/Android.mk'
}
// cmake {
// path 'jni/CMakeLists.txt'
// }
}
}

View file

@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.6)
project(GAME)
# Settings
set(HIDAPI OFF CACHE BOOL "" FORCE)
# armeabi-v7a requires cpufeatures library
# include(AndroidNdkModules)
# android_ndk_import_module_cpufeatures()
# SDL sources are in a subfolder named "SDL"
add_subdirectory(SDL)
# Your game and its CMakeLists.txt are in a subfolder named "src"
add_subdirectory(src)

View file

@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.6)
project(MY_APP)
find_library(SDL2 SDL2)
add_library(main SHARED)
target_sources(main PRIVATE YourSourceHere.c)
target_link_libraries(main SDL2)