Auto pack axslc into android apk

This commit is contained in:
halx99 2023-07-20 01:18:27 +08:00
parent 02616bb774
commit 60bbd3b1a3
7 changed files with 42 additions and 0 deletions

View File

@ -30,6 +30,13 @@ option(AX_ENABLE_EXT_LUA "Build lua libraries" ON)
# hold the extensions list to auto link to app
set(_AX_EXTENSION_LIBS "" CACHE INTERNAL "extensions for auto link to target application")
# configure android GLSLCC compile output, this is the first include cmake module
if (ANDROID)
file(TO_NATIVE_PATH "${PROJECT_SOURCE_DIR}/proj.android/build/runtime/axslc" _GLSLCC_OUT_DIR)
set(GLSLCC_OUT_DIR "${_GLSLCC_OUT_DIR}" CACHE STRING "" FORCE)
message(AUTHOR_WARNING "Set GLSLCC_OUT_DIR to ${GLSLCC_OUT_DIR} for android")
endif()
# include helper functions
include(AXBuildHelpers)

View File

@ -88,6 +88,7 @@ android {
android.applicationVariants.all { variant ->
def project_root_folder = "${projectDir}/../.."
def dest_assets_folder = "${projectDir}/assets"
def axslc_folder = "${projectDir}/../build/runtime/axslc"
// delete previous files first
delete dest_assets_folder
@ -100,6 +101,10 @@ android.applicationVariants.all { variant ->
into "${dest_assets_folder}"
exclude "**/*.gz"
}
copy {
from "${axslc_folder}"
into "${dest_assets_folder}/axslc"
}
}
tasks.getByName("pre${targetName}Build").dependsOn copyTaskName
}

View File

@ -89,6 +89,8 @@ android.applicationVariants.all { variant ->
def project_root_folder = "${projectDir}/../.."
def dest_assets_folder = "${projectDir}/assets"
def axslc_folder = "${projectDir}/../build/runtime/axslc"
// delete previous files first
delete dest_assets_folder
def targetName = variant.name.capitalize()
@ -100,6 +102,10 @@ android.applicationVariants.all { variant ->
into "${dest_assets_folder}"
exclude "**/*.gz"
}
copy {
from "${axslc_folder}"
into "${dest_assets_folder}/axslc"
}
}
tasks.getByName("pre${targetName}Build").dependsOn copyTaskName
}

View File

@ -91,6 +91,8 @@ android.applicationVariants.all { variant ->
delete "${projectDir}/assets"
def targetName = variant.name.capitalize()
def copyTaskName = "copy${targetName}ResourcesToAssets"
def axslc_folder = "${projectDir}/../build/runtime/axslc"
tasks.register(copyTaskName) {
copy {
@ -98,6 +100,10 @@ android.applicationVariants.all { variant ->
into "${projectDir}/assets"
exclude "**/*.gz"
}
copy {
from "${axslc_folder}"
into "${projectDir}/assets/axslc"
}
}
tasks.getByName("pre${targetName}Build").dependsOn copyTaskName
}

View File

@ -90,6 +90,8 @@ android {
android.applicationVariants.all { variant ->
delete "${projectDir}/assets"
def axslc_folder = "${projectDir}/../build/runtime/axslc"
def targetName = variant.name.capitalize()
def copyTaskName = "copy${targetName}ResourcesToAssets"
@ -99,6 +101,10 @@ android.applicationVariants.all { variant ->
into "${projectDir}/assets"
exclude "**/*.gz"
}
copy {
from "${axslc_folder}"
into "${projectDir}/assets/axslc"
}
}
tasks.getByName("pre${targetName}Build").dependsOn copyTaskName
}

View File

@ -89,6 +89,7 @@ android.applicationVariants.all { variant ->
// delete previous files first
delete "${projectDir}/assets"
def axslc_folder = "${projectDir}/../build/runtime/axslc"
def targetName = variant.name.capitalize()
def copyTaskName = "copy${targetName}ResourcesToAssets"
@ -98,6 +99,10 @@ android.applicationVariants.all { variant ->
into "${projectDir}/assets"
exclude "**/*.gz"
}
copy {
from "${axslc_folder}"
into "${projectDir}/assets/axslc"
}
}
tasks.getByName("pre${targetName}Build").dependsOn copyTaskName
}

View File

@ -89,6 +89,8 @@ android {
android.applicationVariants.all { variant ->
delete "${projectDir}/assets"
def axslc_folder = "${projectDir}/../build/runtime/axslc"
def targetName = variant.name.capitalize()
def copyTaskName = "copy${targetName}ResourcesToAssets"
@ -114,6 +116,11 @@ android.applicationVariants.all { variant ->
from "${projectDir}/../../../../../extensions/scripting/lua-bindings/script"
into "${projectDir}/assets/src/axmol"
}
copy {
from "${axslc_folder}"
into "${projectDir}/assets/axslc"
}
}
tasks.getByName("pre${targetName}Build").dependsOn copyTaskName
}