Skip to content

Commit 5bacbbd

Browse files
committed
Fix cmake symlink path in gradle
1 parent 8c0d803 commit 5bacbbd

1 file changed

Lines changed: 16 additions & 19 deletions

File tree

core/platform/android/dsl/axmol.gradle

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ class AxmolUtils {
131131
}
132132

133133
// ndkVer,ndkPath,cmakeVer,cmakeOptions(AX_USE_XXX, AX_ENABLE_XXX, AX_ENABLE_EXT_XXX),cmakeDir<nullable>
134-
findNDK(sdkRoot, ndkVer, buildProfiles)
135-
findNinja(ninjaVer, buildProfiles)
136-
findCMake(sdkRoot, cmakeVer, buildProfiles)
134+
resolveNDK(sdkRoot, ndkVer, buildProfiles)
135+
resolveNinja(ninjaVer, buildProfiles)
136+
resolveCMake(sdkRoot, cmakeVer, buildProfiles)
137137
generateCMakeOptions(project, buildProfiles)
138138

139139
// dump build profiles
@@ -231,7 +231,7 @@ class AxmolUtils {
231231
* @param ndkVer The required ndk version for current project
232232
* @param buildProfiles
233233
*/
234-
private static void findNDK(sdkRoot, ndkVer, buildProfiles) {
234+
private static void resolveNDK(sdkRoot, ndkVer, buildProfiles) {
235235
if (ndkVer.endsWith('+')) {
236236
ndkVer = ndkVer.substring(0, ndkVer.length() - 1)
237237
}
@@ -267,15 +267,13 @@ class AxmolUtils {
267267
}
268268

269269

270-
private static void findNinja(ninjaVer, buildProfiles) {
270+
private static void resolveNinja(ninjaVer, buildProfiles) {
271271
def allowNewerNinja = false
272272
if(ninjaVer.endsWith('+')) {
273273
allowNewerNinja = true
274274
ninjaVer = ninjaVer.substring(0, ninjaVer.length() - 1)
275275
}
276276

277-
278-
279277
def ninjaBinDirs = []
280278

281279
def ninjaBinDir = findExecutableDirInPath("ninja${getExecutableSuffix()}")
@@ -298,7 +296,7 @@ class AxmolUtils {
298296
}
299297

300298
if(verifiedVer == null) {
301-
throw new Exception("No suitable ninja found, required $ninjaVer")
299+
throw new Exception("No suitable ninja found, required $ninjaVer, please run setup.ps1 and try again")
302300
}
303301

304302
buildProfiles['ninjaPath'] = verifiedPath
@@ -307,19 +305,18 @@ class AxmolUtils {
307305

308306

309307
/**
310-
* Find suitable cmake for current project
308+
* Resolve suitable cmake for current project
311309
* @param project The current android project
312310
* @param cmakeVer The required cmake version of project
313311
* @param buildProfiles
314312
*/
315-
private static void findCMake(sdkRoot, String cmakeVer, buildProfiles) {
313+
private static void resolveCMake(sdkRoot, String cmakeVer, buildProfiles) {
316314
def allowNewerCMake = false
317315
if(cmakeVer.endsWith('+')) {
318316
allowNewerCMake = true
319317
cmakeVer = cmakeVer.substring(0, cmakeVer.length() - 1)
320318
}
321319

322-
323320
def cmakeBinDirs = []
324321
def verList = []
325322

@@ -351,8 +348,8 @@ class AxmolUtils {
351348
}
352349

353350
// Use engine cmake as fallback
354-
def fallbackCMakeDir = joinPath(Paths.get("${getEngineRoot()}").toAbsolutePath().toString(), 'tools', 'external', 'cmake', 'bin')
355-
cmakeBinDirs.add(fallbackCMakeDir)
351+
def fallbackCMakeDir = joinPath(Paths.get("${getEngineRoot()}").toAbsolutePath().toString(), 'tools', 'external', 'cmake')
352+
cmakeBinDirs.add(joinPath(fallbackCMakeDir, 'bin'))
356353

357354
// find in cmakeBinDirs
358355
def verifiedVer = null
@@ -367,6 +364,12 @@ class AxmolUtils {
367364
++index
368365
}
369366

367+
if(verifiedVer == null) {
368+
throw new Exception("No suitable cmake found, required $cmakeVer, please run setup.ps1 and try again")
369+
}
370+
371+
buildProfiles['cmakeVer'] = verifiedVer
372+
370373
// Create symlink at sdk cmake when using fallback cmake in axmol engine
371374
// Only present for compatibility purpose, may remove in future axmol releases
372375
if (index == (cmakeBinDirs.size() - 1)) {
@@ -385,12 +388,6 @@ class AxmolUtils {
385388
println "The symlinkd ${symlinkDir} ==> ${fallbackCMakeDir} exist"
386389
}
387390
}
388-
389-
if(verifiedVer == null) {
390-
throw new Exception("No suitable cmake found, required $cmakeVer")
391-
}
392-
393-
buildProfiles['cmakeVer'] = verifiedVer
394391
}
395392

396393
private static String joinPath(String first, String... more) {

0 commit comments

Comments
 (0)