소스 검색

Initial step of integrating with CMake and Megasource

Miku AuahDark 3 년 전
부모
커밋
d4da2103a4
3개의 변경된 파일26개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      README.md
  2. 17 0
      app/build.gradle
  3. 7 0
      app/src/main/cpp/CMakeLists.txt

+ 2 - 2
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

+ 17 - 0
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 {

+ 7 - 0
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)