*/}}
YimingWu 5 ay önce
ebeveyn
işleme
2dbd6db882
5 değiştirilmiş dosya ile 21 ekleme ve 4 silme
  1. 1 0
      .gitignore
  2. 4 0
      apk_build.cmake
  3. 3 3
      src/AndroidManifest.xml
  4. 7 0
      src/CMakeLists.txt
  5. 6 1
      src/hello_android.c

+ 1 - 0
.gitignore

@@ -2,3 +2,4 @@ build/*
 .vscode/
 screenshots/
 *.udf
+keystore.jks

+ 4 - 0
apk_build.cmake

@@ -21,6 +21,7 @@ set(PNG_SRC_DIR "${PNG_SRC_DIR_SRC_DIR}" CACHE PATH "Path to PNG source")
 set(LAGUI_SRC_DIR "${LAGUI_SRC_DIR}" CACHE PATH "Path to LaGUI source")
 set(EXECUTABLE_NAME "${EXECUTABLE_NAME}" CACHE PATH "Executable name")
 set(EXECUTABLE_SRC_DIR "${EXECUTABLE_SRC_DIR}" CACHE PATH "Executable source")
+set(ANDROID_NATIVE_API_LEVEL 24 CACHE STRING "Api level")
 
 find_program(ADB       NAMES adb       REQUIRED PATHS ${ANDROID_PLATFORM_TOOLS_DIR})
 find_program(AAPT2     NAMES aapt2     REQUIRED PATHS ${ANDROID_BUILD_TOOLS_DIR})
@@ -57,6 +58,7 @@ macro(setup_variant VARIANT)
     -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/install/${VARIANT}
     #-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${APK_CONTENTS_ROOT}/lib/${VARIANT}
     #-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${APK_CONTENTS_ROOT}/lib/${VARIANT}
+    -DANDROID_NATIVE_API_LEVEL=${ANDROID_NATIVE_API_LEVEL}
     -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake
     BUILD_ALWAYS True
   )
@@ -77,6 +79,7 @@ macro(setup_variant VARIANT)
     -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/install/${VARIANT}
     #-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${APK_CONTENTS_ROOT}/lib/${VARIANT}
     #-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${APK_CONTENTS_ROOT}/lib/${VARIANT}
+    -DANDROID_NATIVE_API_LEVEL=${ANDROID_NATIVE_API_LEVEL}
     -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake
     BUILD_ALWAYS True
   )
@@ -99,6 +102,7 @@ macro(setup_variant VARIANT)
     -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/install/${VARIANT}
     -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${APK_CONTENTS_ROOT}/lib/${VARIANT}
     -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${APK_CONTENTS_ROOT}/lib/${VARIANT}
+    -DANDROID_NATIVE_API_LEVEL=${ANDROID_NATIVE_API_LEVEL}
     -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake
     BUILD_ALWAYS True
     )

+ 3 - 3
src/AndroidManifest.xml

@@ -4,15 +4,15 @@
   android:versionCode="1"
   android:versionName="1.0">
 
-  <uses-sdk android:minSdkVersion="26"/>
-  <uses-feature android:glEsVersion="0x00030000" android:required="true" />
+  <uses-sdk android:minSdkVersion="24"/>
+  <uses-feature android:glEsVersion="0x00030002" android:required="true" />
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 
   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> 
 
   <!-- This .apk has no Java code itself, so set hasCode to false. -->
   <!-- android:icon="@mipmap/ic_launcher" --> 
   <application
-    android:allowBackup="true"
+    android:allowBackup="false"
     android:label="@string/app_name"
     android:hasCode="false">
 

+ 7 - 0
src/CMakeLists.txt

@@ -19,6 +19,11 @@ endif()
 LINK_DIRECTORIES(../build/install/${ANDROID_ABI}/lib)
 LINK_DIRECTORIES(../build/install/${ANDROID_ABI}/lib/lagui)
 
+add_compile_options(-fpermissive
+    -Wno-error=incompatible-function-pointer-types
+    -Wno-error=int-conversion
+)
+
 add_library(${PROJECT_NAME} SHARED hello_android.c ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
 
 if(${ANDROID_ABI} STREQUAL "armeabi-v7a")
@@ -27,9 +32,11 @@ else()
 set(GLLIBVER GLESv3)
 endif()
 
+add_link_options(-v)
 target_link_libraries(${PROJECT_NAME} PUBLIC log lagui ${GLLIBVER} EGL android z png freetype)
 
 
+target_link_options(${PROJECT_NAME} BEFORE PUBLIC "-v")
 target_link_options(${PROJECT_NAME} BEFORE PUBLIC "-Wl,--start-group")
 target_link_options(${PROJECT_NAME} PUBLIC "-Wl,--end-group")
 

+ 6 - 1
src/hello_android.c

@@ -26,8 +26,13 @@ void MyPanel(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColum
 }
 
 int main(int argc, char *argv[]){
+    laInitArguments ia={0};
+    laSetCompleteInitArguments(&ia);
+    laProcessInitArguments(argc,argv,&ia);
     laSetFontFolderPath(".");
-    laGetReady();
+    ia.EnableLogStdOut=1;
+    ia.GLDebug=1;
+    laGetReadyWith(&ia);
 
     transSetLanguage("zh-CN");