mirror of https://github.com/axmolengine/axmol.git
Improve gradle scripts
Add cmake options from gradle command line properties support
This commit is contained in:
parent
fbb40dd47f
commit
0651f77a3c
|
@ -95,10 +95,10 @@ class axutils {
|
||||||
|
|
||||||
// Detecting sdkRoot
|
// Detecting sdkRoot
|
||||||
def sdkRoot = null
|
def sdkRoot = null
|
||||||
Properties projProps = new Properties()
|
Properties localProps = new Properties()
|
||||||
try {
|
try {
|
||||||
projProps.load(project.rootProject.file("local.properties").newDataInputStream())
|
localProps.load(project.rootProject.file("local.properties").newDataInputStream())
|
||||||
sdkRoot = projProps.getProperty("sdk.dir")
|
sdkRoot = localProps.getProperty("sdk.dir")
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
ex.printStackTrace()
|
ex.printStackTrace()
|
||||||
|
@ -111,9 +111,10 @@ class axutils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def rets = new String[3] // ndkVer,ndkPath,cmakeVer
|
def rets = new ArrayList(4) // ndkVer,ndkPath,cmakeVer,cmakeOptions(AX_USE_XXX, AX_ENABLE_XXX, AX_ENABLE_EXT_XXX)
|
||||||
findNDK(sdkRoot, ndkVer, rets)
|
findNDK(sdkRoot, ndkVer, rets)
|
||||||
findCMake(sdkRoot, cmakeVer, rets)
|
findCMake(sdkRoot, cmakeVer, rets)
|
||||||
|
parseCMakeOptions(project.properties, rets)
|
||||||
return rets
|
return rets
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,6 +229,16 @@ class axutils {
|
||||||
rets[2] = foundCMakeVer
|
rets[2] = foundCMakeVer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void parseCMakeOptions(properties, rets) {
|
||||||
|
def options = new ArrayList<Object>()
|
||||||
|
for(item in properties) {
|
||||||
|
if (item.key.startsWith('AX_')) {
|
||||||
|
options.add("\"-D${item.key}=${item.value}\"")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rets[3] = options
|
||||||
|
}
|
||||||
|
|
||||||
private static int compareVersion(String ver1, String ver2) {
|
private static int compareVersion(String ver1, String ver2) {
|
||||||
return new VersionComparator().compare(ver1, ver2)
|
return new VersionComparator().compare(ver1, ver2)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ android {
|
||||||
ndkPath = nbtInfo[1]
|
ndkPath = nbtInfo[1]
|
||||||
}
|
}
|
||||||
def cmakeVer = nbtInfo[2]
|
def cmakeVer = nbtInfo[2]
|
||||||
|
def cmakeOptions = Eval.me(nbtInfo[3])
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.axmol.hellocpp"
|
applicationId "org.axmol.hellocpp"
|
||||||
|
@ -22,6 +23,7 @@ android {
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE"
|
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE"
|
||||||
|
arguments.addAll(cmakeOptions)
|
||||||
cppFlags "-frtti -fexceptions -fsigned-char"
|
cppFlags "-frtti -fexceptions -fsigned-char"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ android {
|
||||||
ndkPath = nbtInfo[1]
|
ndkPath = nbtInfo[1]
|
||||||
}
|
}
|
||||||
def cmakeVer = nbtInfo[2]
|
def cmakeVer = nbtInfo[2]
|
||||||
|
def cmakeOptions = Eval.me(nbtInfo[3])
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.axmol.hellolua"
|
applicationId "org.axmol.hellolua"
|
||||||
|
@ -22,6 +23,7 @@ android {
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE"
|
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE"
|
||||||
|
arguments.addAll(cmakeOptions)
|
||||||
cppFlags "-frtti -fexceptions -fsigned-char"
|
cppFlags "-frtti -fexceptions -fsigned-char"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ android {
|
||||||
ndkPath = nbtInfo[1]
|
ndkPath = nbtInfo[1]
|
||||||
}
|
}
|
||||||
def cmakeVer = nbtInfo[2]
|
def cmakeVer = nbtInfo[2]
|
||||||
|
def cmakeOptions = Eval.me(nbtInfo[3])
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.axmol.cpp_tests"
|
applicationId "org.axmol.cpp_tests"
|
||||||
|
@ -23,6 +24,7 @@ android {
|
||||||
cmake {
|
cmake {
|
||||||
targets 'cpp_tests'
|
targets 'cpp_tests'
|
||||||
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE"
|
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE"
|
||||||
|
arguments.addAll(cmakeOptions)
|
||||||
cppFlags "-frtti -fexceptions -fsigned-char"
|
cppFlags "-frtti -fexceptions -fsigned-char"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ android {
|
||||||
ndkPath = nbtInfo[1]
|
ndkPath = nbtInfo[1]
|
||||||
}
|
}
|
||||||
def cmakeVer = nbtInfo[2]
|
def cmakeVer = nbtInfo[2]
|
||||||
|
def cmakeOptions = Eval.me(nbtInfo[3])
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.axmol.fairygui_tests"
|
applicationId "org.axmol.fairygui_tests"
|
||||||
|
@ -24,6 +25,7 @@ android {
|
||||||
targets "fairygui_tests"
|
targets "fairygui_tests"
|
||||||
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang",
|
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang",
|
||||||
"-DANDROID_ARM_NEON=TRUE"
|
"-DANDROID_ARM_NEON=TRUE"
|
||||||
|
arguments.addAll(cmakeOptions)
|
||||||
cppFlags "-frtti -fexceptions -fsigned-char"
|
cppFlags "-frtti -fexceptions -fsigned-char"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ android {
|
||||||
ndkPath = nbtInfo[1]
|
ndkPath = nbtInfo[1]
|
||||||
}
|
}
|
||||||
def cmakeVer = nbtInfo[2]
|
def cmakeVer = nbtInfo[2]
|
||||||
|
def cmakeOptions = Eval.me(nbtInfo[3])
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.axmol.live2d_tests"
|
applicationId "org.axmol.live2d_tests"
|
||||||
|
@ -22,6 +23,7 @@ android {
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", "-DAX_ENABLE_EXT_LIVE2D=TRUE"
|
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", "-DAX_ENABLE_EXT_LIVE2D=TRUE"
|
||||||
|
arguments.addAll(cmakeOptions)
|
||||||
cppFlags "-frtti -fexceptions -fsigned-char"
|
cppFlags "-frtti -fexceptions -fsigned-char"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ android {
|
||||||
ndkPath = nbtInfo[1]
|
ndkPath = nbtInfo[1]
|
||||||
}
|
}
|
||||||
def cmakeVer = nbtInfo[2]
|
def cmakeVer = nbtInfo[2]
|
||||||
|
def cmakeOptions = Eval.me(nbtInfo[3])
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.axmol.lua_tests"
|
applicationId "org.axmol.lua_tests"
|
||||||
|
@ -23,6 +24,7 @@ android {
|
||||||
cmake {
|
cmake {
|
||||||
targets 'lua_tests'
|
targets 'lua_tests'
|
||||||
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE"
|
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE"
|
||||||
|
arguments.addAll(cmakeOptions)
|
||||||
cppFlags "-frtti -fexceptions -fsigned-char"
|
cppFlags "-frtti -fexceptions -fsigned-char"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue