diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b759103 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,15 @@ +{ + "java.configuration.updateBuildConfiguration": "automatic", + "java.jdt.ls.java.home": "C:\\Program Files\\Android\\Android Studio\\jbr", + "java.configuration.runtimes": [ + { + "name": "JavaSE-21", + "path": "C:\\Program Files\\Android\\Android Studio\\jbr", + "default": true + } + ], + "terminal.integrated.env.windows": { + "JAVA_HOME": "C:\\Program Files\\Android\\Android Studio\\jbr", + "PATH": "C:\\Program Files\\Android\\Android Studio\\jbr\\bin;${env:PATH}" + } +} diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index c3b2b39..9d58732 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -22,7 +22,7 @@ add_compile_options(-fsigned-char) # Suppress all warnings add_definitions(-w) add_definitions(-DNDEBUG) -add_definitions(-DSLIC3R_VERSION=${SLIC3R_VERSION}) +add_definitions(-DSLIC3R_VERSION="${SLIC3R_VERSION}") add_definitions(-DSLIC3R_BUILD_ID=${SLIC3R_BUILD_ID}) set(jni_imports ${CMAKE_SOURCE_DIR}/src/main/jniImports) @@ -40,10 +40,10 @@ elseif (${ANDROID_ABI} STREQUAL "x86") set(BOOST_ARCH "x32") endif() -set(BOOST_LIBS atomic charconv chrono container context contract coroutine date_time exception fiber +set(BOOST_LIBS atomic charconv chrono container contract date_time exception filesystem graph iostreams json log log_setup math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l nowide prg_exec_monitor program_options random regex serialization stacktrace_basic - stacktrace_noop system test_exec_moinotr thread timer type_erasure unit_test_framework url wave + stacktrace_noop system test_exec_monitor thread timer type_erasure unit_test_framework url wave wserialization) foreach (NAME IN LISTS BOOST_LIBS) @@ -1320,12 +1320,9 @@ target_link_libraries(slic3r PRIVATE boost_charconv boost_chrono boost_container - boost_context boost_contract - boost_coroutine boost_date_time boost_exception - boost_fiber boost_filesystem boost_graph boost_iostreams diff --git a/app/build.gradle b/app/build.gradle index 06c54ae..b14a7f9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,3 +1,6 @@ +import org.gradle.jvm.toolchain.JavaLanguageVersion +import org.gradle.jvm.toolchain.JavaToolchainService + plugins { id 'com.android.application' } @@ -54,8 +57,8 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_21 + targetCompatibility JavaVersion.VERSION_21 } externalNativeBuild { @@ -76,6 +79,13 @@ android { } } +def javaToolchainService = extensions.getByType(JavaToolchainService) +tasks.withType(JavaCompile).configureEach { + javaCompiler = javaToolchainService.compilerFor { + languageVersion = JavaLanguageVersion.of(21) + } +} + static String getGitCommitHash(File dir) { try { return Runtime.getRuntime().exec("git rev-parse HEAD", null, dir).inputStream.readLines().get(0).substring(0, 10) @@ -100,4 +110,483 @@ dependencies { implementation 'com.google.android.material:material:1.12.0' implementation 'com.loopj.android:android-async-http:1.4.11' implementation 'androidx.activity:activity:1.10.1' -} \ No newline at end of file +} + +def loadLocalProperties() { + def props = new Properties() + def propsFile = rootProject.file("local.properties") + if (propsFile.exists()) { + propsFile.withInputStream { props.load(it) } + } + return props +} + +def toWslPath(String winPath) { + return winPath.replaceAll('^([A-Za-z]):') { m -> "/mnt/${m[1].toLowerCase()}" }.replace('\\', '/') +} + +def localProps = loadLocalProperties() +def sdkDir = localProps.getProperty("sdk.dir") ?: System.getenv("ANDROID_SDK_ROOT") ?: System.getenv("ANDROID_HOME") +if (!sdkDir) { + throw new GradleException("Missing sdk.dir in local.properties and ANDROID_SDK_ROOT/ANDROID_HOME is not set") +} +def ndkDir = "${sdkDir}/ndk/${android.ndkVersion}" +if (!file(ndkDir).exists()) { + throw new GradleException("NDK not found at ${ndkDir} (ndkVersion=${android.ndkVersion})") +} +def cmakeRoot = file("${sdkDir}/cmake") +def cmakeDir = cmakeRoot.listFiles()?.findAll { it.isDirectory() }?.sort { a, b -> b.name <=> a.name }?.first() +if (!cmakeDir) { + throw new GradleException("No CMake found under ${sdkDir}/cmake") +} +def cmakeExe = "${cmakeDir}/bin/cmake.exe" +def ninjaExe = "${cmakeDir}/bin/ninja.exe" +def toolchainFile = "${ndkDir}/build/cmake/android.toolchain.cmake" +def wslExe = "${System.getenv("SystemRoot") ?: "C:/Windows"}/System32/wsl.exe" + +def tbbSrc = "${rootDir}/third_party/openvdb-android/tbb-aarch64" +def tbbBuildArm64 = "${rootDir}/third_party/openvdb-android/build-tbb-android-21-arm64" +def tbbInstallArm64 = "${rootDir}/third_party/openvdb-android/dist-android-21-arm64" +def tbbBuildArmv7 = "${rootDir}/third_party/openvdb-android/build-tbb-android-21-armv7" +def tbbInstallArmv7 = "${rootDir}/third_party/openvdb-android/dist-android-21-armv7" + +def occtSrc = "${rootDir}/third_party/occt" +def occtBuildArm64 = "${rootDir}/third_party/occt/build-android-arm64-v8a" +def occtDistArm64 = "${rootDir}/third_party/occt/dist/android-arm64-v8a" +def occtBuildArmv7 = "${rootDir}/third_party/occt/build-android-armeabi-v7a" +def occtDistArmv7 = "${rootDir}/third_party/occt/dist/android-armeabi-v7a" + +def boostDir = "${rootDir}/third_party/Boost-for-Android" +def boostOutArm64 = "${boostDir}/build/out/arm64-v8a" +def boostOutArmv7 = "${boostDir}/build/out/armeabi-v7a" + +tasks.register("ensureThirdParty") { + doLast { + def thirdPartyDir = file("${rootDir}/third_party") + if (!thirdPartyDir.exists()) { + thirdPartyDir.mkdirs() + } + def repos = [ + [path: "${rootDir}/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: "${rootDir}/third_party/occt", url: "https://github.com/Open-Cascade-SAS/OCCT.git"] + ] + repos.each { repo -> + if (!file(repo.path).exists()) { + exec { + workingDir rootDir + commandLine "git", "clone", "--depth", "1", repo.url, repo.path + } + } + } + def vdbRoot = file("${rootDir}/third_party/openvdb-android") + if (file("${vdbRoot}/.gitmodules").exists() && !file("${vdbRoot}/tbb-aarch64/CMakeLists.txt").exists()) { + exec { + workingDir vdbRoot + commandLine "git", "submodule", "update", "--init", "--recursive" + } + } + } +} + +tasks.register("patchBoostForAndroid") { + dependsOn("ensureThirdParty") + doLast { + def scriptFile = file("${boostDir}/build-android.sh") + if (scriptFile.exists()) { + def scriptText = scriptFile.getText("UTF-8") + def changed = false + + if (!scriptText.contains("FORCE_PLATFORM_OS")) { + def marker = "# Check platform patch" + def markerIdx = scriptText.indexOf(marker) + if (markerIdx >= 0) { + def esacIdx = scriptText.indexOf("esac", markerIdx) + if (esacIdx >= 0) { + def insertPos = scriptText.indexOf("\n", esacIdx) + if (insertPos >= 0) { + insertPos += 1 + def insert = 'if [ -n "${FORCE_PLATFORM_OS}" ]; then\n' + + ' PlatformOS="${FORCE_PLATFORM_OS}"\n' + + 'fi\n\n' + scriptText = scriptText.substring(0, insertPos) + insert + scriptText.substring(insertPos) + changed = true + } + } + } + } + + if (!scriptText.contains("CXXPATH.exe")) { + def marker = 'if [ -n "${AndroidSourcesDetected}"' + if (scriptText.contains(marker)) { + def insert = 'if [ ! -f "$CXXPATH" ] && [ -f "$CXXPATH.exe" ]; then\n' + + ' CXXPATH="$CXXPATH.exe"\n' + + 'fi\n\n' + scriptText = scriptText.replace(marker, insert + marker) + changed = true + } + } + + if (changed) { + scriptFile.write(scriptText, "UTF-8") + } + } + + def commonFile = file("${boostDir}/configs/user-config-ndk23-1_85_0-common.jam") + if (commonFile.exists()) { + def commonText = commonFile.getText("UTF-8") + def commonChanged = false + if (!commonText.contains("AndroidToolSuffix")) { + def header = 'import os ;\n' + + 'local AndroidToolSuffix = [ os.environ AndroidToolSuffix ] ;\n' + + 'if ! $(AndroidToolSuffix) { AndroidToolSuffix = "" ; }\n\n' + commonText = header + commonText.trim() + "\n" + commonChanged = true + } + if (!commonText.contains('llvm-ar$(AndroidToolSuffix)')) { + commonText = commonText.replace('$(AndroidBinariesPath)/llvm-ar', '$(AndroidBinariesPath)/llvm-ar$(AndroidToolSuffix)') + commonChanged = true + } + if (!commonText.contains('llvm-ranlib$(AndroidToolSuffix)')) { + commonText = commonText.replace('$(AndroidBinariesPath)/llvm-ranlib', '$(AndroidBinariesPath)/llvm-ranlib$(AndroidToolSuffix)') + commonChanged = true + } + if (commonChanged) { + commonFile.write(commonText, "UTF-8") + } + } + + def arm64File = file("${boostDir}/configs/user-config-ndk23-1_85_0-arm64-v8a.jam") + if (arm64File.exists()) { + def text = arm64File.getText("UTF-8") + if (!text.contains("")) { + text = "arm\n64\nelf\naapcs\n" + text + arm64File.write(text, "UTF-8") + } + } + + def armv7File = file("${boostDir}/configs/user-config-ndk23-1_85_0-armeabi-v7a.jam") + if (armv7File.exists()) { + def text = armv7File.getText("UTF-8") + if (!text.contains("")) { + text = "arm\n32\nelf\naapcs\n" + text + armv7File.write(text, "UTF-8") + } + } + } +} + +tasks.register("buildTbbArm64") { + dependsOn("ensureThirdParty") + onlyIf { + !file("${projectDir}/src/main/jniImports/oneTBB/lib/arm64-v8a/libtbb.a").exists() || + !file("${projectDir}/src/main/jniImports/oneTBB/lib/arm64-v8a/libtbbmalloc.a").exists() || + !file("${projectDir}/src/main/jniLibs/arm64-v8a/libtbb.so").exists() || + !file("${projectDir}/src/main/jniLibs/arm64-v8a/libtbbmalloc.so").exists() + } + doLast { + exec { + commandLine cmakeExe, "-G", "Ninja", + "-S", tbbSrc, + "-B", tbbBuildArm64, + "-DCMAKE_MAKE_PROGRAM=${ninjaExe}", + "-DCMAKE_TOOLCHAIN_FILE=${toolchainFile}", + "-DANDROID_ABI=arm64-v8a", + "-DANDROID_PLATFORM=android-21", + "-DANDROID_STL=c++_shared", + "-DCMAKE_BUILD_TYPE=Release", + "-DCMAKE_INSTALL_PREFIX=${tbbInstallArm64}", + "-DTBB_BUILD_TESTS=Off" + } + exec { + commandLine cmakeExe, "--build", tbbBuildArm64, "--target", "install" + } + } +} + +tasks.register("buildTbbArmv7") { + dependsOn("ensureThirdParty") + onlyIf { + !file("${projectDir}/src/main/jniImports/oneTBB/lib/armeabi-v7a/libtbb.a").exists() || + !file("${projectDir}/src/main/jniImports/oneTBB/lib/armeabi-v7a/libtbbmalloc.a").exists() || + !file("${projectDir}/src/main/jniLibs/armeabi-v7a/libtbb.so").exists() || + !file("${projectDir}/src/main/jniLibs/armeabi-v7a/libtbbmalloc.so").exists() + } + doLast { + exec { + commandLine cmakeExe, "-G", "Ninja", + "-S", tbbSrc, + "-B", tbbBuildArmv7, + "-DCMAKE_MAKE_PROGRAM=${ninjaExe}", + "-DCMAKE_TOOLCHAIN_FILE=${toolchainFile}", + "-DANDROID_ABI=armeabi-v7a", + "-DANDROID_PLATFORM=android-21", + "-DANDROID_STL=c++_shared", + "-DCMAKE_BUILD_TYPE=Release", + "-DCMAKE_INSTALL_PREFIX=${tbbInstallArmv7}", + "-DTBB_BUILD_TESTS=Off" + } + exec { + commandLine cmakeExe, "--build", tbbBuildArmv7, "--target", "install" + } + } +} + +tasks.register("copyTbbArm64", Copy) { + dependsOn("buildTbbArm64") + onlyIf { + !file("${projectDir}/src/main/jniImports/oneTBB/lib/arm64-v8a/libtbb.a").exists() || + !file("${projectDir}/src/main/jniImports/oneTBB/lib/arm64-v8a/libtbbmalloc.a").exists() || + !file("${projectDir}/src/main/jniLibs/arm64-v8a/libtbb.so").exists() || + !file("${projectDir}/src/main/jniLibs/arm64-v8a/libtbbmalloc.so").exists() + } + from("${tbbInstallArm64}/lib") { + include "libtbb_static.a" + include "libtbbmalloc_static.a" + include "libtbb.so" + include "libtbbmalloc.so" + } + into("${projectDir}/src/main/jniImports/oneTBB/tmp-arm64") + doLast { + copy { + from "${projectDir}/src/main/jniImports/oneTBB/tmp-arm64/libtbb_static.a" + into "${projectDir}/src/main/jniImports/oneTBB/lib/arm64-v8a" + rename { "libtbb.a" } + } + copy { + from "${projectDir}/src/main/jniImports/oneTBB/tmp-arm64/libtbbmalloc_static.a" + into "${projectDir}/src/main/jniImports/oneTBB/lib/arm64-v8a" + rename { "libtbbmalloc.a" } + } + copy { + from "${projectDir}/src/main/jniImports/oneTBB/tmp-arm64/libtbb.so" + into "${projectDir}/src/main/jniLibs/arm64-v8a" + } + copy { + from "${projectDir}/src/main/jniImports/oneTBB/tmp-arm64/libtbbmalloc.so" + into "${projectDir}/src/main/jniLibs/arm64-v8a" + } + delete("${projectDir}/src/main/jniImports/oneTBB/tmp-arm64") + } +} + +tasks.register("copyTbbArmv7", Copy) { + dependsOn("buildTbbArmv7") + onlyIf { + !file("${projectDir}/src/main/jniImports/oneTBB/lib/armeabi-v7a/libtbb.a").exists() || + !file("${projectDir}/src/main/jniImports/oneTBB/lib/armeabi-v7a/libtbbmalloc.a").exists() || + !file("${projectDir}/src/main/jniLibs/armeabi-v7a/libtbb.so").exists() || + !file("${projectDir}/src/main/jniLibs/armeabi-v7a/libtbbmalloc.so").exists() + } + from("${tbbInstallArmv7}/lib") { + include "libtbb_static.a" + include "libtbbmalloc_static.a" + include "libtbb.so" + include "libtbbmalloc.so" + } + into("${projectDir}/src/main/jniImports/oneTBB/tmp-armv7") + doLast { + copy { + from "${projectDir}/src/main/jniImports/oneTBB/tmp-armv7/libtbb_static.a" + into "${projectDir}/src/main/jniImports/oneTBB/lib/armeabi-v7a" + rename { "libtbb.a" } + } + copy { + from "${projectDir}/src/main/jniImports/oneTBB/tmp-armv7/libtbbmalloc_static.a" + into "${projectDir}/src/main/jniImports/oneTBB/lib/armeabi-v7a" + rename { "libtbbmalloc.a" } + } + copy { + from "${projectDir}/src/main/jniImports/oneTBB/tmp-armv7/libtbb.so" + into "${projectDir}/src/main/jniLibs/armeabi-v7a" + } + copy { + from "${projectDir}/src/main/jniImports/oneTBB/tmp-armv7/libtbbmalloc.so" + into "${projectDir}/src/main/jniLibs/armeabi-v7a" + } + delete("${projectDir}/src/main/jniImports/oneTBB/tmp-armv7") + } +} + +tasks.register("copyTbbHeaders") { + dependsOn("buildTbbArm64") + onlyIf { !file("${projectDir}/src/main/jniImports/oneTBB/include/tbb/tbb.h").exists() } + doLast { + copy { + from "${tbbInstallArm64}/include/tbb" + into "${projectDir}/src/main/jniImports/oneTBB/include/tbb" + } + copy { + from "${projectDir}/src/main/jniImports/oneTBB/include/tbb" + into "${projectDir}/src/main/jniImports/oneTBB/include/oneapi/tbb" + } + } +} + +tasks.register("buildBoostArm64") { + dependsOn("patchBoostForAndroid") + onlyIf { !file("${projectDir}/src/main/jniImports/boost/lib/arm64-v8a/lib/libboost_atomic-clang-mt-a64-1_85.a").exists() } + doLast { + if (!file(wslExe).exists()) { + throw new GradleException("WSL is required to build Boost. Install WSL or provide prebuilt Boost libs.") + } + def ndkWsl = toWslPath(ndkDir) + def boostWsl = toWslPath(boostDir) + def binWsl = toWslPath("${ndkDir}/toolchains/llvm/prebuilt/windows-x86_64/bin") + exec { + 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" + } + } +} + +tasks.register("buildBoostArmv7") { + dependsOn("patchBoostForAndroid") + onlyIf { !file("${projectDir}/src/main/jniImports/boost/lib/armeabi-v7a/lib/libboost_atomic-clang-mt-a32-1_85.a").exists() } + doLast { + if (!file(wslExe).exists()) { + throw new GradleException("WSL is required to build Boost. Install WSL or provide prebuilt Boost libs.") + } + def ndkWsl = toWslPath(ndkDir) + def boostWsl = toWslPath(boostDir) + def binWsl = toWslPath("${ndkDir}/toolchains/llvm/prebuilt/windows-x86_64/bin") + exec { + 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" + } + } +} + +tasks.register("copyBoostArm64", Copy) { + dependsOn("buildBoostArm64") + onlyIf { !file("${projectDir}/src/main/jniImports/boost/lib/arm64-v8a/lib/libboost_atomic-clang-mt-a64-1_85.a").exists() } + from("${boostOutArm64}/lib") { + include "libboost_*.a" + } + into("${projectDir}/src/main/jniImports/boost/lib/arm64-v8a/lib") +} + +tasks.register("copyBoostArmv7", Copy) { + dependsOn("buildBoostArmv7") + onlyIf { !file("${projectDir}/src/main/jniImports/boost/lib/armeabi-v7a/lib/libboost_atomic-clang-mt-a32-1_85.a").exists() } + from("${boostOutArmv7}/lib") { + include "libboost_*.a" + } + into("${projectDir}/src/main/jniImports/boost/lib/armeabi-v7a/lib") +} + +tasks.register("copyBoostHeaders", Copy) { + dependsOn("ensureThirdParty") + onlyIf { !file("${projectDir}/src/main/jniImports/boost/include/boost/variant.hpp").exists() } + from("${boostDir}/boost_1_85_0/boost") + into("${projectDir}/src/main/jniImports/boost/include/boost") +} + +tasks.register("buildOcctArm64") { + dependsOn("ensureThirdParty") + onlyIf { !file("${projectDir}/src/main/occt/jniLibs/arm64-v8a/libTKDESTEP.so").exists() } + doLast { + exec { + commandLine cmakeExe, "-G", "Ninja", + "-S", occtSrc, + "-B", occtBuildArm64, + "-DCMAKE_MAKE_PROGRAM=${ninjaExe}", + "-DCMAKE_TOOLCHAIN_FILE=${toolchainFile}", + "-DANDROID_ABI=arm64-v8a", + "-DANDROID_PLATFORM=android-21", + "-DCMAKE_BUILD_TYPE=Release", + "-DBUILD_LIBRARY_TYPE=Shared", + "-DINSTALL_DIR_LIB=libs/arm64-v8a", + "-DINSTALL_DIR_INCLUDE=inc", + "-DBUILD_DOC_Overview=OFF", + "-DBUILD_DOC_RefMan=OFF", + "-DUSE_FREETYPE=OFF", + "-DUSE_RAPIDJSON=OFF", + "-DUSE_DRACO=OFF", + "-DCMAKE_INSTALL_PREFIX=${occtDistArm64}" + } + exec { + commandLine cmakeExe, "--build", occtBuildArm64, "--target", "install", "--config", "Release", "--", "-j2" + } + } +} + +tasks.register("buildOcctArmv7") { + dependsOn("ensureThirdParty") + onlyIf { !file("${projectDir}/src/main/occt/jniLibs/armeabi-v7a/libTKDESTEP.so").exists() } + doLast { + exec { + commandLine cmakeExe, "-G", "Ninja", + "-S", occtSrc, + "-B", occtBuildArmv7, + "-DCMAKE_MAKE_PROGRAM=${ninjaExe}", + "-DCMAKE_TOOLCHAIN_FILE=${toolchainFile}", + "-DANDROID_ABI=armeabi-v7a", + "-DANDROID_PLATFORM=android-21", + "-DCMAKE_BUILD_TYPE=Release", + "-DBUILD_LIBRARY_TYPE=Shared", + "-DINSTALL_DIR_LIB=libs/armeabi-v7a", + "-DINSTALL_DIR_INCLUDE=inc", + "-DBUILD_DOC_Overview=OFF", + "-DBUILD_DOC_RefMan=OFF", + "-DUSE_FREETYPE=OFF", + "-DUSE_RAPIDJSON=OFF", + "-DUSE_DRACO=OFF", + "-DCMAKE_INSTALL_PREFIX=${occtDistArmv7}" + } + exec { + commandLine cmakeExe, "--build", occtBuildArmv7, "--target", "install", "--config", "Release", "--", "-j2" + } + } +} + +tasks.register("copyOcctArm64", Copy) { + dependsOn("buildOcctArm64") + onlyIf { !file("${projectDir}/src/main/occt/jniLibs/arm64-v8a/libTKDESTEP.so").exists() } + from("${occtDistArm64}/libs/arm64-v8a") { + include "*.so" + } + into("${projectDir}/src/main/occt/jniLibs/arm64-v8a") +} + +tasks.register("copyOcctArmv7", Copy) { + dependsOn("buildOcctArmv7") + onlyIf { !file("${projectDir}/src/main/occt/jniLibs/armeabi-v7a/libTKDESTEP.so").exists() } + from("${occtDistArmv7}/libs/armeabi-v7a") { + include "*.so" + } + into("${projectDir}/src/main/occt/jniLibs/armeabi-v7a") +} + +tasks.register("copyOcctHeadersArm64", Copy) { + dependsOn("buildOcctArm64") + onlyIf { !file("${projectDir}/src/main/occt/include/arm64-v8a/STEPCAFControl_Reader.hxx").exists() } + from("${occtDistArm64}/inc") + into("${projectDir}/src/main/occt/include/arm64-v8a") +} + +tasks.register("copyOcctHeadersArmv7", Copy) { + dependsOn("buildOcctArmv7") + onlyIf { !file("${projectDir}/src/main/occt/include/armeabi-v7a/STEPCAFControl_Reader.hxx").exists() } + from("${occtDistArmv7}/inc") + into("${projectDir}/src/main/occt/include/armeabi-v7a") +} + +tasks.register("prepareNativeDeps") { + dependsOn( + "copyTbbArm64", + "copyTbbArmv7", + "copyTbbHeaders", + "copyBoostArm64", + "copyBoostArmv7", + "copyBoostHeaders", + "copyOcctArm64", + "copyOcctArmv7", + "copyOcctHeadersArm64", + "copyOcctHeadersArmv7" + ) +} + +afterEvaluate { + tasks.matching { it.name.startsWith("buildCMake") }.configureEach { + dependsOn("prepareNativeDeps") + } +} diff --git a/app/src/main/jni/libslic3r/GCode.cpp b/app/src/main/jni/libslic3r/GCode.cpp index 493a756..9d541ac 100644 --- a/app/src/main/jni/libslic3r/GCode.cpp +++ b/app/src/main/jni/libslic3r/GCode.cpp @@ -1563,13 +1563,13 @@ void GCodeGenerator::process_layers( [&output_stream](std::string s) { output_stream.write(s); } ); - tbb::filter pipeline_to_layerresult = smooth_path_interpolator & generator; + auto pipeline_to_layerresult = smooth_path_interpolator & generator; if (m_spiral_vase) pipeline_to_layerresult = pipeline_to_layerresult & spiral_vase; if (m_pressure_equalizer) pipeline_to_layerresult = pipeline_to_layerresult & pressure_equalizer; - tbb::filter pipeline_to_string = cooling; + auto pipeline_to_string = cooling; if (m_find_replace) pipeline_to_string = pipeline_to_string & find_replace; @@ -1656,13 +1656,13 @@ void GCodeGenerator::process_layers( [&output_stream](std::string s) { output_stream.write(s); } ); - tbb::filter pipeline_to_layerresult = smooth_path_interpolator & generator; + auto pipeline_to_layerresult = smooth_path_interpolator & generator; if (m_spiral_vase) pipeline_to_layerresult = pipeline_to_layerresult & spiral_vase; if (m_pressure_equalizer) pipeline_to_layerresult = pipeline_to_layerresult & pressure_equalizer; - tbb::filter pipeline_to_string = cooling; + auto pipeline_to_string = cooling; if (m_find_replace) pipeline_to_string = pipeline_to_string & find_replace; @@ -3889,4 +3889,4 @@ Point GCodeGenerator::gcode_to_point(const Vec2d &point) const return scaled(pt); } -} // namespace Slic3r +} // namespace Slic3r \ No newline at end of file diff --git a/app/src/main/jni/occt_wrapper/OCCTWrapper.cpp b/app/src/main/jni/occt_wrapper/OCCTWrapper.cpp index e41d895..659cc0e 100644 --- a/app/src/main/jni/occt_wrapper/OCCTWrapper.cpp +++ b/app/src/main/jni/occt_wrapper/OCCTWrapper.cpp @@ -21,6 +21,9 @@ #include "BRepBuilderAPI_Transform.hxx" #include "TopExp_Explorer.hxx" #include "BRep_Tool.hxx" +#include "NCollection_Sequence.hxx" + +using TDF_LabelSequence = NCollection_Sequence; const double STEP_TRANS_CHORD_ERROR = 0.005; const double STEP_TRANS_ANGLE_RES = 1; @@ -198,4 +201,4 @@ try { return true; } -}; // namespace Slic3r +}; // namespace Slic3r \ No newline at end of file diff --git a/app/src/main/jni/slicebeam/beam_native.cpp b/app/src/main/jni/slicebeam/beam_native.cpp index 737b19d..aa1f325 100644 --- a/app/src/main/jni/slicebeam/beam_native.cpp +++ b/app/src/main/jni/slicebeam/beam_native.cpp @@ -1,6 +1,7 @@ #include #include +#include #include "libslic3r/libslic3r.h" #include "libslic3r/Config.hpp" #include "libslic3r/Model.hpp" diff --git a/build.gradle b/build.gradle index 3dbbccc..8bb264a 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.5.2' + classpath 'com.android.tools.build:gradle:8.13.2' } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index efad36f..85a9960 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Mon Aug 05 19:06:18 MSK 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index 882e7ba..f47516c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1,47 @@ +def localPropsFile = file("local.properties") +if (!localPropsFile.exists()) { + def sdkRoot = System.getenv("ANDROID_SDK_ROOT") ?: System.getenv("ANDROID_HOME") + if (!sdkRoot) { + def localAppData = System.getenv("LOCALAPPDATA") + if (localAppData) { + def defaultSdk = new File(localAppData, "Android\\Sdk") + if (defaultSdk.exists()) { + sdkRoot = defaultSdk.absolutePath + } + } + } + if (sdkRoot) { + localPropsFile.text = "sdk.dir=${sdkRoot.replace('\\', '\\\\')}\n" + } +} + +def hasSubmodules = file(".gitmodules").exists() +def submoduleRoots = [ + file("EventBus/eventbus"), + file("EventBus/eventbus_api"), + file("EventBus/eventbus_processor"), + file("SAPIL/sapil") +] +def missingSubmodule = submoduleRoots.any { !it.exists() } +if (hasSubmodules && missingSubmodule) { + try { + def proc = new ProcessBuilder("git", "submodule", "update", "--init", "--recursive") + .directory(rootDir) + .redirectErrorStream(true) + .start() + proc.inputStream.eachLine { println(it) } + if (proc.waitFor() != 0) { + println("Warning: git submodule update failed; run it manually if build fails.") + } + } catch (Exception e) { + println("Warning: unable to run git submodule update; run it manually if build fails.") + } +} + rootProject.name = "Slice Beam" include ':app', ':eventbus', ':eventbus_api', ':eventbus_processor', ':sapil' project(':eventbus').projectDir = file('EventBus/eventbus') project(':eventbus_api').projectDir = file('EventBus/eventbus_api') project(':eventbus_processor').projectDir = file('EventBus/eventbus_processor') -project(':sapil').projectDir = file('SAPIL/sapil') +project(':sapil').projectDir = file('SAPIL/sapil') \ No newline at end of file