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
|
||||
def sdkRoot = null
|
||||
Properties projProps = new Properties()
|
||||
Properties localProps = new Properties()
|
||||
try {
|
||||
projProps.load(project.rootProject.file("local.properties").newDataInputStream())
|
||||
sdkRoot = projProps.getProperty("sdk.dir")
|
||||
localProps.load(project.rootProject.file("local.properties").newDataInputStream())
|
||||
sdkRoot = localProps.getProperty("sdk.dir")
|
||||
}
|
||||
catch(Exception ex) {
|
||||
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)
|
||||
findCMake(sdkRoot, cmakeVer, rets)
|
||||
parseCMakeOptions(project.properties, rets)
|
||||
return rets
|
||||
}
|
||||
|
||||
|
@ -228,6 +229,16 @@ class axutils {
|
|||
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) {
|
||||
return new VersionComparator().compare(ver1, ver2)
|
||||
}
|
||||
|
@ -268,7 +279,7 @@ class axutils {
|
|||
|
||||
private static String findCMakeFromBinDir(String cmakeVer, String cmakeBin, boolean allowNewerCMake) {
|
||||
def foundCMakeVer = null
|
||||
|
||||
|
||||
String ninjaPath = cmakeBin + File.separator + getNinjaProgramName()
|
||||
if(!new File(ninjaPath).isFile()) {
|
||||
println("The required ninja program is not present in cmake bin dir: '$cmakeBin'")
|
||||
|
|
|
@ -11,6 +11,7 @@ android {
|
|||
ndkPath = nbtInfo[1]
|
||||
}
|
||||
def cmakeVer = nbtInfo[2]
|
||||
def cmakeOptions = Eval.me(nbtInfo[3])
|
||||
|
||||
defaultConfig {
|
||||
applicationId "org.axmol.hellocpp"
|
||||
|
@ -22,6 +23,7 @@ android {
|
|||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE"
|
||||
arguments.addAll(cmakeOptions)
|
||||
cppFlags "-frtti -fexceptions -fsigned-char"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ android {
|
|||
ndkPath = nbtInfo[1]
|
||||
}
|
||||
def cmakeVer = nbtInfo[2]
|
||||
def cmakeOptions = Eval.me(nbtInfo[3])
|
||||
|
||||
defaultConfig {
|
||||
applicationId "org.axmol.hellolua"
|
||||
|
@ -22,6 +23,7 @@ android {
|
|||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE"
|
||||
arguments.addAll(cmakeOptions)
|
||||
cppFlags "-frtti -fexceptions -fsigned-char"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ android {
|
|||
ndkPath = nbtInfo[1]
|
||||
}
|
||||
def cmakeVer = nbtInfo[2]
|
||||
def cmakeOptions = Eval.me(nbtInfo[3])
|
||||
|
||||
defaultConfig {
|
||||
applicationId "org.axmol.cpp_tests"
|
||||
|
@ -23,6 +24,7 @@ android {
|
|||
cmake {
|
||||
targets 'cpp_tests'
|
||||
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE"
|
||||
arguments.addAll(cmakeOptions)
|
||||
cppFlags "-frtti -fexceptions -fsigned-char"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ android {
|
|||
ndkPath = nbtInfo[1]
|
||||
}
|
||||
def cmakeVer = nbtInfo[2]
|
||||
def cmakeOptions = Eval.me(nbtInfo[3])
|
||||
|
||||
defaultConfig {
|
||||
applicationId "org.axmol.fairygui_tests"
|
||||
|
@ -24,6 +25,7 @@ android {
|
|||
targets "fairygui_tests"
|
||||
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang",
|
||||
"-DANDROID_ARM_NEON=TRUE"
|
||||
arguments.addAll(cmakeOptions)
|
||||
cppFlags "-frtti -fexceptions -fsigned-char"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ android {
|
|||
ndkPath = nbtInfo[1]
|
||||
}
|
||||
def cmakeVer = nbtInfo[2]
|
||||
def cmakeOptions = Eval.me(nbtInfo[3])
|
||||
|
||||
defaultConfig {
|
||||
applicationId "org.axmol.live2d_tests"
|
||||
|
@ -22,6 +23,7 @@ android {
|
|||
externalNativeBuild {
|
||||
cmake {
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ android {
|
|||
ndkPath = nbtInfo[1]
|
||||
}
|
||||
def cmakeVer = nbtInfo[2]
|
||||
def cmakeOptions = Eval.me(nbtInfo[3])
|
||||
|
||||
defaultConfig {
|
||||
applicationId "org.axmol.lua_tests"
|
||||
|
@ -23,6 +24,7 @@ android {
|
|||
cmake {
|
||||
targets 'lua_tests'
|
||||
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE"
|
||||
arguments.addAll(cmakeOptions)
|
||||
cppFlags "-frtti -fexceptions -fsigned-char"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue