mirror of
https://github.com/Dark98/SliceBeam.git
synced 2026-07-05 08:39:03 +00:00
Enable Gradle Configuration Cache
This commit is contained in:
+193
-108
@@ -94,11 +94,62 @@ tasks.withType(JavaCompile).configureEach {
|
|||||||
|
|
||||||
static String getGitCommitHash(File dir) {
|
static String getGitCommitHash(File dir) {
|
||||||
try {
|
try {
|
||||||
return Runtime.getRuntime().exec("git rev-parse HEAD", null, dir).inputStream.readLines().get(0).substring(0, 10)
|
File gitDir = new File(dir, ".git")
|
||||||
} catch (Exception e){
|
if (!gitDir.exists()) {
|
||||||
println("Unable to get git commit hash:")
|
return "non-git"
|
||||||
e.printStackTrace()
|
}
|
||||||
return "non-git build"
|
|
||||||
|
// Worktree/submodule support: .git may be a file with "gitdir: <path>".
|
||||||
|
if (gitDir.isFile()) {
|
||||||
|
String pointer = gitDir.text.trim()
|
||||||
|
if (pointer.startsWith("gitdir:")) {
|
||||||
|
gitDir = new File(dir, pointer.substring("gitdir:".length()).trim())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gitDir.exists() || !gitDir.isDirectory()) {
|
||||||
|
return "non-git"
|
||||||
|
}
|
||||||
|
|
||||||
|
File headFile = new File(gitDir, "HEAD")
|
||||||
|
if (!headFile.exists()) {
|
||||||
|
return "non-git"
|
||||||
|
}
|
||||||
|
|
||||||
|
String head = headFile.text.trim()
|
||||||
|
String fullHash = null
|
||||||
|
if (head.startsWith("ref:")) {
|
||||||
|
String refPath = head.substring("ref:".length()).trim()
|
||||||
|
File refFile = new File(gitDir, refPath)
|
||||||
|
if (refFile.exists()) {
|
||||||
|
fullHash = refFile.text.trim()
|
||||||
|
} else {
|
||||||
|
File packedRefs = new File(gitDir, "packed-refs")
|
||||||
|
if (packedRefs.exists()) {
|
||||||
|
String prefix = refPath + " "
|
||||||
|
for (String line : packedRefs.readLines()) {
|
||||||
|
if (line.startsWith("#") || line.startsWith("^") || line.trim().isEmpty()) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
int space = line.indexOf(' ')
|
||||||
|
if (space > 0 && line.substring(space + 1).trim() == refPath) {
|
||||||
|
fullHash = line.substring(0, space).trim()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Detached HEAD.
|
||||||
|
fullHash = head
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fullHash || fullHash.length() < 10) {
|
||||||
|
return "non-git"
|
||||||
|
}
|
||||||
|
return fullHash.substring(0, 10)
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
return "non-git"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,40 +224,64 @@ def occtDistArmv7 = "${rootDir}/third_party/occt/dist/android-armeabi-v7a"
|
|||||||
def boostDir = "${rootDir}/third_party/Boost-for-Android"
|
def boostDir = "${rootDir}/third_party/Boost-for-Android"
|
||||||
def boostOutArm64 = "${boostDir}/build/out/arm64-v8a"
|
def boostOutArm64 = "${boostDir}/build/out/arm64-v8a"
|
||||||
def boostOutArmv7 = "${boostDir}/build/out/armeabi-v7a"
|
def boostOutArmv7 = "${boostDir}/build/out/armeabi-v7a"
|
||||||
|
def rootPathForTasks = rootProject.projectDir.absolutePath
|
||||||
|
def appProjectPath = project.projectDir.absolutePath
|
||||||
|
def boostArm64OutLib = "${appProjectPath}/src/main/jniImports/boost/lib/arm64-v8a/lib/libboost_atomic-clang-mt-a64-1_85.a"
|
||||||
|
def boostArmv7OutLib = "${appProjectPath}/src/main/jniImports/boost/lib/armeabi-v7a/lib/libboost_atomic-clang-mt-a32-1_85.a"
|
||||||
|
def boostHeadersOut = "${appProjectPath}/src/main/jniImports/boost/include/boost/variant.hpp"
|
||||||
|
def tbbArm64LibA = "${appProjectPath}/src/main/jniImports/oneTBB/lib/arm64-v8a/libtbb.a"
|
||||||
|
def tbbArm64MallocA = "${appProjectPath}/src/main/jniImports/oneTBB/lib/arm64-v8a/libtbbmalloc.a"
|
||||||
|
def tbbArm64So = "${appProjectPath}/src/main/jniLibs/arm64-v8a/libtbb.so"
|
||||||
|
def tbbArm64MallocSo = "${appProjectPath}/src/main/jniLibs/arm64-v8a/libtbbmalloc.so"
|
||||||
|
def tbbArmv7LibA = "${appProjectPath}/src/main/jniImports/oneTBB/lib/armeabi-v7a/libtbb.a"
|
||||||
|
def tbbArmv7MallocA = "${appProjectPath}/src/main/jniImports/oneTBB/lib/armeabi-v7a/libtbbmalloc.a"
|
||||||
|
def tbbArmv7So = "${appProjectPath}/src/main/jniLibs/armeabi-v7a/libtbb.so"
|
||||||
|
def tbbArmv7MallocSo = "${appProjectPath}/src/main/jniLibs/armeabi-v7a/libtbbmalloc.so"
|
||||||
|
def tbbHeaderOut = "${appProjectPath}/src/main/jniImports/oneTBB/include/tbb/tbb.h"
|
||||||
|
def occtArm64So = "${appProjectPath}/src/main/occt/jniLibs/arm64-v8a/libTKDESTEP.so"
|
||||||
|
def occtArmv7So = "${appProjectPath}/src/main/occt/jniLibs/armeabi-v7a/libTKDESTEP.so"
|
||||||
|
def occtHeaderArm64Out = "${appProjectPath}/src/main/occt/include/arm64-v8a/STEPCAFControl_Reader.hxx"
|
||||||
|
def occtHeaderArmv7Out = "${appProjectPath}/src/main/occt/include/armeabi-v7a/STEPCAFControl_Reader.hxx"
|
||||||
|
|
||||||
tasks.register("ensureThirdParty") {
|
tasks.register("ensureThirdParty") {
|
||||||
doLast {
|
doLast {
|
||||||
def thirdPartyDir = file("${rootDir}/third_party")
|
def rootPath = rootPathForTasks
|
||||||
|
def thirdPartyDir = new File(rootPath, "third_party")
|
||||||
if (!thirdPartyDir.exists()) {
|
if (!thirdPartyDir.exists()) {
|
||||||
thirdPartyDir.mkdirs()
|
thirdPartyDir.mkdirs()
|
||||||
}
|
}
|
||||||
def repos = [
|
def repos = [
|
||||||
[path: "${rootDir}/third_party/Boost-for-Android", url: "https://github.com/moritz-wundke/Boost-for-Android.git"],
|
[path: "${rootPath}/third_party/Boost-for-Android", url: "https://github.com/moritz-wundke/Boost-for-Android.git"],
|
||||||
[path: "${rootDir}/third_party/openvdb-android", url: "https://github.com/syoyo/openvdb-android.git"],
|
[path: "${rootPath}/third_party/openvdb-android", url: "https://github.com/syoyo/openvdb-android.git"],
|
||||||
[path: "${rootDir}/third_party/occt", url: "https://github.com/Open-Cascade-SAS/OCCT.git"]
|
[path: "${rootPath}/third_party/occt", url: "https://github.com/Open-Cascade-SAS/OCCT.git"]
|
||||||
]
|
]
|
||||||
repos.each { repo ->
|
def runCommand = { List<String> cmd, File workDir ->
|
||||||
if (!file(repo.path).exists()) {
|
Process process = new ProcessBuilder(cmd)
|
||||||
exec {
|
.directory(workDir)
|
||||||
workingDir rootDir
|
.inheritIO()
|
||||||
commandLine "git", "clone", "--depth", "1", repo.url, repo.path
|
.start()
|
||||||
}
|
int exitCode = process.waitFor()
|
||||||
|
if (exitCode != 0) {
|
||||||
|
throw new GradleException("Command failed (${exitCode}): ${cmd.join(' ')}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def vdbRoot = file("${rootDir}/third_party/openvdb-android")
|
for (def repo : repos) {
|
||||||
if (file("${vdbRoot}/.gitmodules").exists() && !file("${vdbRoot}/tbb-aarch64/CMakeLists.txt").exists()) {
|
if (!new File(repo.path).exists()) {
|
||||||
exec {
|
runCommand(["git", "clone", "--depth", "1", repo.url, repo.path], new File(rootPath))
|
||||||
workingDir vdbRoot
|
|
||||||
commandLine "git", "submodule", "update", "--init", "--recursive"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
def vdbRoot = new File(rootPath, "third_party/openvdb-android")
|
||||||
|
if (new File(vdbRoot, ".gitmodules").exists() && !new File(vdbRoot, "tbb-aarch64/CMakeLists.txt").exists()) {
|
||||||
|
runCommand(["git", "submodule", "update", "--init", "--recursive"], vdbRoot)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("patchBoostForAndroid") {
|
tasks.register("patchBoostForAndroid") {
|
||||||
dependsOn("ensureThirdParty")
|
dependsOn("ensureThirdParty")
|
||||||
doLast {
|
doLast {
|
||||||
def scriptFile = file("${boostDir}/build-android.sh")
|
def boostRoot = new File(rootPathForTasks, "third_party/Boost-for-Android")
|
||||||
|
def scriptFile = new File(boostRoot, "build-android.sh")
|
||||||
if (scriptFile.exists()) {
|
if (scriptFile.exists()) {
|
||||||
def scriptText = scriptFile.getText("UTF-8")
|
def scriptText = scriptFile.getText("UTF-8")
|
||||||
def changed = false
|
def changed = false
|
||||||
@@ -246,7 +321,7 @@ tasks.register("patchBoostForAndroid") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def commonFile = file("${boostDir}/configs/user-config-ndk23-1_85_0-common.jam")
|
def commonFile = new File(boostRoot, "configs/user-config-ndk23-1_85_0-common.jam")
|
||||||
if (commonFile.exists()) {
|
if (commonFile.exists()) {
|
||||||
def commonText = commonFile.getText("UTF-8")
|
def commonText = commonFile.getText("UTF-8")
|
||||||
def commonChanged = false
|
def commonChanged = false
|
||||||
@@ -270,7 +345,7 @@ tasks.register("patchBoostForAndroid") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def arm64File = file("${boostDir}/configs/user-config-ndk23-1_85_0-arm64-v8a.jam")
|
def arm64File = new File(boostRoot, "configs/user-config-ndk23-1_85_0-arm64-v8a.jam")
|
||||||
if (arm64File.exists()) {
|
if (arm64File.exists()) {
|
||||||
def text = arm64File.getText("UTF-8")
|
def text = arm64File.getText("UTF-8")
|
||||||
if (!text.contains("<arch>")) {
|
if (!text.contains("<arch>")) {
|
||||||
@@ -279,7 +354,7 @@ tasks.register("patchBoostForAndroid") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def armv7File = file("${boostDir}/configs/user-config-ndk23-1_85_0-armeabi-v7a.jam")
|
def armv7File = new File(boostRoot, "configs/user-config-ndk23-1_85_0-armeabi-v7a.jam")
|
||||||
if (armv7File.exists()) {
|
if (armv7File.exists()) {
|
||||||
def text = armv7File.getText("UTF-8")
|
def text = armv7File.getText("UTF-8")
|
||||||
if (!text.contains("<arch>")) {
|
if (!text.contains("<arch>")) {
|
||||||
@@ -294,10 +369,10 @@ tasks.register("buildTbbArm64") {
|
|||||||
dependsOn("ensureThirdParty")
|
dependsOn("ensureThirdParty")
|
||||||
onlyIf {
|
onlyIf {
|
||||||
forceNativeRebuild ||
|
forceNativeRebuild ||
|
||||||
!file("${projectDir}/src/main/jniImports/oneTBB/lib/arm64-v8a/libtbb.a").exists() ||
|
!new File(tbbArm64LibA).exists() ||
|
||||||
!file("${projectDir}/src/main/jniImports/oneTBB/lib/arm64-v8a/libtbbmalloc.a").exists() ||
|
!new File(tbbArm64MallocA).exists() ||
|
||||||
!file("${projectDir}/src/main/jniLibs/arm64-v8a/libtbb.so").exists() ||
|
!new File(tbbArm64So).exists() ||
|
||||||
!file("${projectDir}/src/main/jniLibs/arm64-v8a/libtbbmalloc.so").exists()
|
!new File(tbbArm64MallocSo).exists()
|
||||||
}
|
}
|
||||||
doLast {
|
doLast {
|
||||||
exec {
|
exec {
|
||||||
@@ -325,10 +400,10 @@ tasks.register("buildTbbArmv7") {
|
|||||||
dependsOn("ensureThirdParty")
|
dependsOn("ensureThirdParty")
|
||||||
onlyIf {
|
onlyIf {
|
||||||
forceNativeRebuild ||
|
forceNativeRebuild ||
|
||||||
!file("${projectDir}/src/main/jniImports/oneTBB/lib/armeabi-v7a/libtbb.a").exists() ||
|
!new File(tbbArmv7LibA).exists() ||
|
||||||
!file("${projectDir}/src/main/jniImports/oneTBB/lib/armeabi-v7a/libtbbmalloc.a").exists() ||
|
!new File(tbbArmv7MallocA).exists() ||
|
||||||
!file("${projectDir}/src/main/jniLibs/armeabi-v7a/libtbb.so").exists() ||
|
!new File(tbbArmv7So).exists() ||
|
||||||
!file("${projectDir}/src/main/jniLibs/armeabi-v7a/libtbbmalloc.so").exists()
|
!new File(tbbArmv7MallocSo).exists()
|
||||||
}
|
}
|
||||||
doLast {
|
doLast {
|
||||||
exec {
|
exec {
|
||||||
@@ -356,10 +431,10 @@ tasks.register("copyTbbArm64", Copy) {
|
|||||||
dependsOn("buildTbbArm64")
|
dependsOn("buildTbbArm64")
|
||||||
onlyIf {
|
onlyIf {
|
||||||
forceNativeRebuild ||
|
forceNativeRebuild ||
|
||||||
!file("${projectDir}/src/main/jniImports/oneTBB/lib/arm64-v8a/libtbb.a").exists() ||
|
!new File(tbbArm64LibA).exists() ||
|
||||||
!file("${projectDir}/src/main/jniImports/oneTBB/lib/arm64-v8a/libtbbmalloc.a").exists() ||
|
!new File(tbbArm64MallocA).exists() ||
|
||||||
!file("${projectDir}/src/main/jniLibs/arm64-v8a/libtbb.so").exists() ||
|
!new File(tbbArm64So).exists() ||
|
||||||
!file("${projectDir}/src/main/jniLibs/arm64-v8a/libtbbmalloc.so").exists()
|
!new File(tbbArm64MallocSo).exists()
|
||||||
}
|
}
|
||||||
from("${tbbInstallArm64}/lib") {
|
from("${tbbInstallArm64}/lib") {
|
||||||
include "libtbb_static.a"
|
include "libtbb_static.a"
|
||||||
@@ -395,10 +470,10 @@ tasks.register("copyTbbArmv7", Copy) {
|
|||||||
dependsOn("buildTbbArmv7")
|
dependsOn("buildTbbArmv7")
|
||||||
onlyIf {
|
onlyIf {
|
||||||
forceNativeRebuild ||
|
forceNativeRebuild ||
|
||||||
!file("${projectDir}/src/main/jniImports/oneTBB/lib/armeabi-v7a/libtbb.a").exists() ||
|
!new File(tbbArmv7LibA).exists() ||
|
||||||
!file("${projectDir}/src/main/jniImports/oneTBB/lib/armeabi-v7a/libtbbmalloc.a").exists() ||
|
!new File(tbbArmv7MallocA).exists() ||
|
||||||
!file("${projectDir}/src/main/jniLibs/armeabi-v7a/libtbb.so").exists() ||
|
!new File(tbbArmv7So).exists() ||
|
||||||
!file("${projectDir}/src/main/jniLibs/armeabi-v7a/libtbbmalloc.so").exists()
|
!new File(tbbArmv7MallocSo).exists()
|
||||||
}
|
}
|
||||||
from("${tbbInstallArmv7}/lib") {
|
from("${tbbInstallArmv7}/lib") {
|
||||||
include "libtbb_static.a"
|
include "libtbb_static.a"
|
||||||
@@ -432,7 +507,7 @@ tasks.register("copyTbbArmv7", Copy) {
|
|||||||
|
|
||||||
tasks.register("copyTbbHeaders") {
|
tasks.register("copyTbbHeaders") {
|
||||||
dependsOn("buildTbbArm64")
|
dependsOn("buildTbbArm64")
|
||||||
onlyIf { !file("${projectDir}/src/main/jniImports/oneTBB/include/tbb/tbb.h").exists() }
|
onlyIf { !new File(tbbHeaderOut).exists() }
|
||||||
doLast {
|
doLast {
|
||||||
copy {
|
copy {
|
||||||
from "${tbbInstallArm64}/include/tbb"
|
from "${tbbInstallArm64}/include/tbb"
|
||||||
@@ -447,21 +522,25 @@ tasks.register("copyTbbHeaders") {
|
|||||||
|
|
||||||
tasks.register("buildBoostArm64") {
|
tasks.register("buildBoostArm64") {
|
||||||
dependsOn("patchBoostForAndroid")
|
dependsOn("patchBoostForAndroid")
|
||||||
onlyIf { !file("${projectDir}/src/main/jniImports/boost/lib/arm64-v8a/lib/libboost_atomic-clang-mt-a64-1_85.a").exists() }
|
onlyIf { !new File(boostArm64OutLib).exists() }
|
||||||
doLast {
|
doLast {
|
||||||
if (isWindows) {
|
if (isWindows) {
|
||||||
if (!file(wslExe).exists()) {
|
if (!new File(wslExe).exists()) {
|
||||||
throw new GradleException("WSL is required to build Boost on Windows. Install WSL or provide prebuilt Boost libs.")
|
throw new GradleException("WSL is required to build Boost on Windows. Install WSL or provide prebuilt Boost libs.")
|
||||||
}
|
}
|
||||||
def ndkWsl = toWslPath(ndkDir)
|
def ndkWsl = toWslPath(ndkDir)
|
||||||
def boostWsl = toWslPath(boostDir)
|
def boostWsl = toWslPath(boostDir)
|
||||||
def binWsl = toWslPath(llvmBinDir)
|
def binWsl = toWslPath(llvmBinDir)
|
||||||
exec {
|
def cmd = "set -euo pipefail; cd ${boostWsl}; chmod +x ${binWsl}/aarch64-linux-android21-clang++ ${binWsl}/llvm-ar.exe ${binWsl}/llvm-ranlib.exe || true; FORCE_PLATFORM_OS=windows AndroidCompilerSuffix= AndroidToolSuffix=.exe ./build-android.sh ${ndkWsl} --boost=1.85.0 --arch=arm64-v8a --target-version=21 --without-libraries=context,coroutine,fiber,python"
|
||||||
commandLine wslExe, "bash", "-lc", "set -euo pipefail; cd ${boostWsl}; chmod +x ${binWsl}/aarch64-linux-android21-clang++ ${binWsl}/llvm-ar.exe ${binWsl}/llvm-ranlib.exe || true; FORCE_PLATFORM_OS=windows AndroidCompilerSuffix= AndroidToolSuffix=.exe ./build-android.sh ${ndkWsl} --boost=1.85.0 --arch=arm64-v8a --target-version=21 --without-libraries=context,coroutine,fiber,python"
|
Process p = new ProcessBuilder([wslExe, "bash", "-lc", cmd]).inheritIO().start()
|
||||||
|
if (p.waitFor() != 0) {
|
||||||
|
throw new GradleException("Boost arm64 build failed")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
exec {
|
def cmd = "set -euo pipefail; cd ${boostDir}; chmod +x ${llvmBinDir}/aarch64-linux-android21-clang++ ${llvmBinDir}/llvm-ar ${llvmBinDir}/llvm-ranlib || true; ./build-android.sh ${ndkDir} --boost=1.85.0 --arch=arm64-v8a --target-version=21 --without-libraries=context,coroutine,fiber,python"
|
||||||
commandLine "bash", "-lc", "set -euo pipefail; cd ${boostDir}; chmod +x ${llvmBinDir}/aarch64-linux-android21-clang++ ${llvmBinDir}/llvm-ar ${llvmBinDir}/llvm-ranlib || true; ./build-android.sh ${ndkDir} --boost=1.85.0 --arch=arm64-v8a --target-version=21 --without-libraries=context,coroutine,fiber,python"
|
Process p = new ProcessBuilder(["bash", "-lc", cmd]).inheritIO().start()
|
||||||
|
if (p.waitFor() != 0) {
|
||||||
|
throw new GradleException("Boost arm64 build failed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -469,21 +548,25 @@ tasks.register("buildBoostArm64") {
|
|||||||
|
|
||||||
tasks.register("buildBoostArmv7") {
|
tasks.register("buildBoostArmv7") {
|
||||||
dependsOn("patchBoostForAndroid")
|
dependsOn("patchBoostForAndroid")
|
||||||
onlyIf { !file("${projectDir}/src/main/jniImports/boost/lib/armeabi-v7a/lib/libboost_atomic-clang-mt-a32-1_85.a").exists() }
|
onlyIf { !new File(boostArmv7OutLib).exists() }
|
||||||
doLast {
|
doLast {
|
||||||
if (isWindows) {
|
if (isWindows) {
|
||||||
if (!file(wslExe).exists()) {
|
if (!new File(wslExe).exists()) {
|
||||||
throw new GradleException("WSL is required to build Boost on Windows. Install WSL or provide prebuilt Boost libs.")
|
throw new GradleException("WSL is required to build Boost on Windows. Install WSL or provide prebuilt Boost libs.")
|
||||||
}
|
}
|
||||||
def ndkWsl = toWslPath(ndkDir)
|
def ndkWsl = toWslPath(ndkDir)
|
||||||
def boostWsl = toWslPath(boostDir)
|
def boostWsl = toWslPath(boostDir)
|
||||||
def binWsl = toWslPath(llvmBinDir)
|
def binWsl = toWslPath(llvmBinDir)
|
||||||
exec {
|
def cmd = "set -euo pipefail; cd ${boostWsl}; chmod +x ${binWsl}/armv7a-linux-androideabi21-clang++ ${binWsl}/llvm-ar.exe ${binWsl}/llvm-ranlib.exe || true; FORCE_PLATFORM_OS=windows AndroidCompilerSuffix= AndroidToolSuffix=.exe ./build-android.sh ${ndkWsl} --boost=1.85.0 --arch=armeabi-v7a --target-version=21 --without-libraries=context,coroutine,fiber,python"
|
||||||
commandLine wslExe, "bash", "-lc", "set -euo pipefail; cd ${boostWsl}; chmod +x ${binWsl}/armv7a-linux-androideabi21-clang++ ${binWsl}/llvm-ar.exe ${binWsl}/llvm-ranlib.exe || true; FORCE_PLATFORM_OS=windows AndroidCompilerSuffix= AndroidToolSuffix=.exe ./build-android.sh ${ndkWsl} --boost=1.85.0 --arch=armeabi-v7a --target-version=21 --without-libraries=context,coroutine,fiber,python"
|
Process p = new ProcessBuilder([wslExe, "bash", "-lc", cmd]).inheritIO().start()
|
||||||
|
if (p.waitFor() != 0) {
|
||||||
|
throw new GradleException("Boost armv7 build failed")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
exec {
|
def cmd = "set -euo pipefail; cd ${boostDir}; chmod +x ${llvmBinDir}/armv7a-linux-androideabi21-clang++ ${llvmBinDir}/llvm-ar ${llvmBinDir}/llvm-ranlib || true; ./build-android.sh ${ndkDir} --boost=1.85.0 --arch=armeabi-v7a --target-version=21 --without-libraries=context,coroutine,fiber,python"
|
||||||
commandLine "bash", "-lc", "set -euo pipefail; cd ${boostDir}; chmod +x ${llvmBinDir}/armv7a-linux-androideabi21-clang++ ${llvmBinDir}/llvm-ar ${llvmBinDir}/llvm-ranlib || true; ./build-android.sh ${ndkDir} --boost=1.85.0 --arch=armeabi-v7a --target-version=21 --without-libraries=context,coroutine,fiber,python"
|
Process p = new ProcessBuilder(["bash", "-lc", cmd]).inheritIO().start()
|
||||||
|
if (p.waitFor() != 0) {
|
||||||
|
throw new GradleException("Boost armv7 build failed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -491,7 +574,7 @@ tasks.register("buildBoostArmv7") {
|
|||||||
|
|
||||||
tasks.register("copyBoostArm64", Copy) {
|
tasks.register("copyBoostArm64", Copy) {
|
||||||
dependsOn("buildBoostArm64")
|
dependsOn("buildBoostArm64")
|
||||||
onlyIf { !file("${projectDir}/src/main/jniImports/boost/lib/arm64-v8a/lib/libboost_atomic-clang-mt-a64-1_85.a").exists() }
|
onlyIf { !new File(boostArm64OutLib).exists() }
|
||||||
from("${boostOutArm64}/lib") {
|
from("${boostOutArm64}/lib") {
|
||||||
include "libboost_*.a"
|
include "libboost_*.a"
|
||||||
}
|
}
|
||||||
@@ -500,7 +583,7 @@ tasks.register("copyBoostArm64", Copy) {
|
|||||||
|
|
||||||
tasks.register("copyBoostArmv7", Copy) {
|
tasks.register("copyBoostArmv7", Copy) {
|
||||||
dependsOn("buildBoostArmv7")
|
dependsOn("buildBoostArmv7")
|
||||||
onlyIf { !file("${projectDir}/src/main/jniImports/boost/lib/armeabi-v7a/lib/libboost_atomic-clang-mt-a32-1_85.a").exists() }
|
onlyIf { !new File(boostArmv7OutLib).exists() }
|
||||||
from("${boostOutArmv7}/lib") {
|
from("${boostOutArmv7}/lib") {
|
||||||
include "libboost_*.a"
|
include "libboost_*.a"
|
||||||
}
|
}
|
||||||
@@ -509,74 +592,76 @@ tasks.register("copyBoostArmv7", Copy) {
|
|||||||
|
|
||||||
tasks.register("copyBoostHeaders", Copy) {
|
tasks.register("copyBoostHeaders", Copy) {
|
||||||
dependsOn("ensureThirdParty")
|
dependsOn("ensureThirdParty")
|
||||||
onlyIf { !file("${projectDir}/src/main/jniImports/boost/include/boost/variant.hpp").exists() }
|
onlyIf { !new File(boostHeadersOut).exists() }
|
||||||
from("${boostDir}/boost_1_85_0/boost")
|
from("${boostDir}/boost_1_85_0/boost")
|
||||||
into("${projectDir}/src/main/jniImports/boost/include/boost")
|
into("${projectDir}/src/main/jniImports/boost/include/boost")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("buildOcctArm64") {
|
tasks.register("buildOcctArm64") {
|
||||||
dependsOn("ensureThirdParty")
|
dependsOn("ensureThirdParty")
|
||||||
onlyIf { forceNativeRebuild || !file("${projectDir}/src/main/occt/jniLibs/arm64-v8a/libTKDESTEP.so").exists() }
|
onlyIf { forceNativeRebuild || !new File(occtArm64So).exists() }
|
||||||
doLast {
|
doLast {
|
||||||
exec {
|
List<String> cfgCmd = [
|
||||||
commandLine cmakeExe, "-G", "Ninja",
|
cmakeExe, "-G", "Ninja",
|
||||||
"-S", occtSrc,
|
"-S", occtSrc,
|
||||||
"-B", occtBuildArm64,
|
"-B", occtBuildArm64,
|
||||||
"-DCMAKE_MAKE_PROGRAM=${ninjaExe}",
|
"-DCMAKE_MAKE_PROGRAM=${ninjaExe}",
|
||||||
"-DCMAKE_TOOLCHAIN_FILE=${toolchainFile}",
|
"-DCMAKE_TOOLCHAIN_FILE=${toolchainFile}",
|
||||||
"-DANDROID_ABI=arm64-v8a",
|
"-DANDROID_ABI=arm64-v8a",
|
||||||
"-DANDROID_PLATFORM=android-21",
|
"-DANDROID_PLATFORM=android-21",
|
||||||
"-DCMAKE_BUILD_TYPE=Release",
|
"-DCMAKE_BUILD_TYPE=Release",
|
||||||
"-DBUILD_LIBRARY_TYPE=Shared",
|
"-DBUILD_LIBRARY_TYPE=Shared",
|
||||||
"-DCMAKE_SHARED_LINKER_FLAGS=${pageSizeLinkerFlags}",
|
"-DCMAKE_SHARED_LINKER_FLAGS=${pageSizeLinkerFlags}",
|
||||||
"-DINSTALL_DIR_LIB=libs/arm64-v8a",
|
"-DINSTALL_DIR_LIB=libs/arm64-v8a",
|
||||||
"-DINSTALL_DIR_INCLUDE=inc",
|
"-DINSTALL_DIR_INCLUDE=inc",
|
||||||
"-DBUILD_DOC_Overview=OFF",
|
"-DBUILD_DOC_Overview=OFF",
|
||||||
"-DBUILD_DOC_RefMan=OFF",
|
"-DBUILD_DOC_RefMan=OFF",
|
||||||
"-DUSE_FREETYPE=OFF",
|
"-DUSE_FREETYPE=OFF",
|
||||||
"-DUSE_RAPIDJSON=OFF",
|
"-DUSE_RAPIDJSON=OFF",
|
||||||
"-DUSE_DRACO=OFF",
|
"-DUSE_DRACO=OFF",
|
||||||
"-DCMAKE_INSTALL_PREFIX=${occtDistArm64}"
|
"-DCMAKE_INSTALL_PREFIX=${occtDistArm64}"
|
||||||
}
|
]
|
||||||
exec {
|
Process p1 = new ProcessBuilder(cfgCmd).inheritIO().start()
|
||||||
commandLine cmakeExe, "--build", occtBuildArm64, "--target", "install", "--config", "Release", "--", "-j2"
|
if (p1.waitFor() != 0) throw new GradleException("OCCT arm64 configure failed")
|
||||||
}
|
Process p2 = new ProcessBuilder([cmakeExe, "--build", occtBuildArm64, "--target", "install", "--config", "Release", "--", "-j2"]).inheritIO().start()
|
||||||
|
if (p2.waitFor() != 0) throw new GradleException("OCCT arm64 build failed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("buildOcctArmv7") {
|
tasks.register("buildOcctArmv7") {
|
||||||
dependsOn("ensureThirdParty")
|
dependsOn("ensureThirdParty")
|
||||||
onlyIf { forceNativeRebuild || !file("${projectDir}/src/main/occt/jniLibs/armeabi-v7a/libTKDESTEP.so").exists() }
|
onlyIf { forceNativeRebuild || !new File(occtArmv7So).exists() }
|
||||||
doLast {
|
doLast {
|
||||||
exec {
|
List<String> cfgCmd = [
|
||||||
commandLine cmakeExe, "-G", "Ninja",
|
cmakeExe, "-G", "Ninja",
|
||||||
"-S", occtSrc,
|
"-S", occtSrc,
|
||||||
"-B", occtBuildArmv7,
|
"-B", occtBuildArmv7,
|
||||||
"-DCMAKE_MAKE_PROGRAM=${ninjaExe}",
|
"-DCMAKE_MAKE_PROGRAM=${ninjaExe}",
|
||||||
"-DCMAKE_TOOLCHAIN_FILE=${toolchainFile}",
|
"-DCMAKE_TOOLCHAIN_FILE=${toolchainFile}",
|
||||||
"-DANDROID_ABI=armeabi-v7a",
|
"-DANDROID_ABI=armeabi-v7a",
|
||||||
"-DANDROID_PLATFORM=android-21",
|
"-DANDROID_PLATFORM=android-21",
|
||||||
"-DCMAKE_BUILD_TYPE=Release",
|
"-DCMAKE_BUILD_TYPE=Release",
|
||||||
"-DBUILD_LIBRARY_TYPE=Shared",
|
"-DBUILD_LIBRARY_TYPE=Shared",
|
||||||
"-DCMAKE_SHARED_LINKER_FLAGS=${pageSizeLinkerFlags}",
|
"-DCMAKE_SHARED_LINKER_FLAGS=${pageSizeLinkerFlags}",
|
||||||
"-DINSTALL_DIR_LIB=libs/armeabi-v7a",
|
"-DINSTALL_DIR_LIB=libs/armeabi-v7a",
|
||||||
"-DINSTALL_DIR_INCLUDE=inc",
|
"-DINSTALL_DIR_INCLUDE=inc",
|
||||||
"-DBUILD_DOC_Overview=OFF",
|
"-DBUILD_DOC_Overview=OFF",
|
||||||
"-DBUILD_DOC_RefMan=OFF",
|
"-DBUILD_DOC_RefMan=OFF",
|
||||||
"-DUSE_FREETYPE=OFF",
|
"-DUSE_FREETYPE=OFF",
|
||||||
"-DUSE_RAPIDJSON=OFF",
|
"-DUSE_RAPIDJSON=OFF",
|
||||||
"-DUSE_DRACO=OFF",
|
"-DUSE_DRACO=OFF",
|
||||||
"-DCMAKE_INSTALL_PREFIX=${occtDistArmv7}"
|
"-DCMAKE_INSTALL_PREFIX=${occtDistArmv7}"
|
||||||
}
|
]
|
||||||
exec {
|
Process p1 = new ProcessBuilder(cfgCmd).inheritIO().start()
|
||||||
commandLine cmakeExe, "--build", occtBuildArmv7, "--target", "install", "--config", "Release", "--", "-j2"
|
if (p1.waitFor() != 0) throw new GradleException("OCCT armv7 configure failed")
|
||||||
}
|
Process p2 = new ProcessBuilder([cmakeExe, "--build", occtBuildArmv7, "--target", "install", "--config", "Release", "--", "-j2"]).inheritIO().start()
|
||||||
|
if (p2.waitFor() != 0) throw new GradleException("OCCT armv7 build failed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("copyOcctArm64", Copy) {
|
tasks.register("copyOcctArm64", Copy) {
|
||||||
dependsOn("buildOcctArm64")
|
dependsOn("buildOcctArm64")
|
||||||
onlyIf { forceNativeRebuild || !file("${projectDir}/src/main/occt/jniLibs/arm64-v8a/libTKDESTEP.so").exists() }
|
onlyIf { forceNativeRebuild || !new File(occtArm64So).exists() }
|
||||||
from("${occtDistArm64}/libs/arm64-v8a") {
|
from("${occtDistArm64}/libs/arm64-v8a") {
|
||||||
include "*.so"
|
include "*.so"
|
||||||
}
|
}
|
||||||
@@ -585,7 +670,7 @@ tasks.register("copyOcctArm64", Copy) {
|
|||||||
|
|
||||||
tasks.register("copyOcctArmv7", Copy) {
|
tasks.register("copyOcctArmv7", Copy) {
|
||||||
dependsOn("buildOcctArmv7")
|
dependsOn("buildOcctArmv7")
|
||||||
onlyIf { forceNativeRebuild || !file("${projectDir}/src/main/occt/jniLibs/armeabi-v7a/libTKDESTEP.so").exists() }
|
onlyIf { forceNativeRebuild || !new File(occtArmv7So).exists() }
|
||||||
from("${occtDistArmv7}/libs/armeabi-v7a") {
|
from("${occtDistArmv7}/libs/armeabi-v7a") {
|
||||||
include "*.so"
|
include "*.so"
|
||||||
}
|
}
|
||||||
@@ -594,14 +679,14 @@ tasks.register("copyOcctArmv7", Copy) {
|
|||||||
|
|
||||||
tasks.register("copyOcctHeadersArm64", Copy) {
|
tasks.register("copyOcctHeadersArm64", Copy) {
|
||||||
dependsOn("buildOcctArm64")
|
dependsOn("buildOcctArm64")
|
||||||
onlyIf { !file("${projectDir}/src/main/occt/include/arm64-v8a/STEPCAFControl_Reader.hxx").exists() }
|
onlyIf { !new File(occtHeaderArm64Out).exists() }
|
||||||
from("${occtDistArm64}/inc")
|
from("${occtDistArm64}/inc")
|
||||||
into("${projectDir}/src/main/occt/include/arm64-v8a")
|
into("${projectDir}/src/main/occt/include/arm64-v8a")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("copyOcctHeadersArmv7", Copy) {
|
tasks.register("copyOcctHeadersArmv7", Copy) {
|
||||||
dependsOn("buildOcctArmv7")
|
dependsOn("buildOcctArmv7")
|
||||||
onlyIf { !file("${projectDir}/src/main/occt/include/armeabi-v7a/STEPCAFControl_Reader.hxx").exists() }
|
onlyIf { !new File(occtHeaderArmv7Out).exists() }
|
||||||
from("${occtDistArmv7}/inc")
|
from("${occtDistArmv7}/inc")
|
||||||
into("${projectDir}/src/main/occt/include/armeabi-v7a")
|
into("${projectDir}/src/main/occt/include/armeabi-v7a")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,3 +19,4 @@ android.useAndroidX=true
|
|||||||
# resources declared in the library itself and none from the library's dependencies,
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
# thereby reducing the size of the R class for that library
|
# thereby reducing the size of the R class for that library
|
||||||
android.nonTransitiveRClass=true
|
android.nonTransitiveRClass=true
|
||||||
|
org.gradle.configuration-cache=true
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#This file is generated by updateDaemonJvm
|
||||||
|
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/536afcd1dff540251f85e5d2c80458cf/redirect
|
||||||
|
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/ecd23fd7707c683afbcd6052998cb6a9/redirect
|
||||||
|
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/536afcd1dff540251f85e5d2c80458cf/redirect
|
||||||
|
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/67a0fee3c4236b6397dcbe8575ca2011/redirect
|
||||||
|
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/10fc3bf1ee0001078a473afe6e43cfdb/redirect
|
||||||
|
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/658299a896470fbb3103ba3a430ee227/redirect
|
||||||
|
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/536afcd1dff540251f85e5d2c80458cf/redirect
|
||||||
|
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/67a0fee3c4236b6397dcbe8575ca2011/redirect
|
||||||
|
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/248ffb1098f61659502d0c09aa348294/redirect
|
||||||
|
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/056dc25d3b9d168ede8b94d3d2f99942/redirect
|
||||||
|
toolchainVendor=JETBRAINS
|
||||||
|
toolchainVersion=21
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
plugins {
|
||||||
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
|
||||||
|
}
|
||||||
def localPropsFile = file("local.properties")
|
def localPropsFile = file("local.properties")
|
||||||
if (!localPropsFile.exists()) {
|
if (!localPropsFile.exists()) {
|
||||||
def sdkRoot = System.getenv("ANDROID_SDK_ROOT") ?: System.getenv("ANDROID_HOME")
|
def sdkRoot = System.getenv("ANDROID_SDK_ROOT") ?: System.getenv("ANDROID_HOME")
|
||||||
|
|||||||
Reference in New Issue
Block a user