diff --git a/README.md b/README.md index 7ce32f10..2d4f4be2 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,8 @@ Quick Start: Before you start, install JDK 11 or later. If you intend to build from Android Studio, skip this step as Android Studio bundles its own JDK 11. -Install Android SDK with SDK API 31 (31.0.0) and Android NDK 23.1.7779620, set the environment variables -`ANDROID_SDK_ROOT` to your Android SDK location and run. +Install CMake version 3.21 or later in your system. Install Android SDK with SDK API 31 (31.0.0) and Android NDK 23.1.7779620. +Set the environment variables `ANDROID_SDK_ROOT` to your Android SDK location and run. ``` $ ./gradlew assembleNormalRecord diff --git a/app/build.gradle b/app/build.gradle index f1f16b84..9eca1ebd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,6 +4,7 @@ plugins { android { compileSdk 31 + ndkVersion "23.1.7779620" defaultConfig { applicationId "org.love2d.android" @@ -11,6 +12,11 @@ android { versionName "12.0" minSdk 21 targetSdk 31 + externalNativeBuild { + cmake { + cppFlags '' + } + } } buildTypes { @@ -58,6 +64,17 @@ android { buildFeatures { viewBinding true } + externalNativeBuild { + cmake { + path file('src/main/cpp/CMakeLists.txt') + // '+' notation apparently has been supported long time ago + // https://issuetracker.google.com/issues/110693527#comment22 + // We require CMake 3.21 because r23 has important fixes + // that's only fixed if CMake 3.21 is used. + // https://github.com/android/ndk/issues/463 + version '3.21.0+' + } + } } dependencies { diff --git a/app/src/main/cpp/CMakeLists.txt b/app/src/main/cpp/CMakeLists.txt new file mode 100644 index 00000000..a2fce344 --- /dev/null +++ b/app/src/main/cpp/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.10) + +project(love-android LANGUAGES C CXX) + +set(MEGA_LOVE "${CMAKE_CURRENT_SOURCE_DIR}/love") + +add_subdirectory(megasource)