Commit 3cf4cb5e authored by dsq's avatar dsq

用于临时测试-不合入master2

parent 3754154c
......@@ -39,44 +39,51 @@ kotlin {
}
ohosArm64 {
binaries.sharedLib {
// 配置OHOS(华为鸿蒙)多架构目标
listOf(
ohosArm64(), // 真机 arm64
ohosX64() // 模拟器/开发机 x64
).forEach { ohosTarget ->
ohosTarget.binaries.sharedLib {
baseName = "kn" // 共享库名称为kn
export(libs.compose.multiplatform.export) // 导出compose多平台库的接口
// 确保链接系统 zlib,使 libkn.so 的 NEEDED 包含 libz.so
linkerOpts("-lz")
// 避免 release 优化在模拟器上触发 SIGILL(非法指令)
optimized = false
}
// 禁用内联类可能有助于 NAPI
val main by compilations.getting
main.compilerOptions.configure {
// 渲染模式
// 背景:当 libkn.so 为旧编译产物时,其 DT_NEEDED 可能缺少以下库(正确构建时
// NativeTasksConfiguration.kt 已通过 -l 选项将它们写入 DT_NEEDED)。
// 在 build.gradle.kts 中统一补全,避免在 CMakeLists.txt 中硬编码。
val rendererBackend = rootProject.findProperty("rendererBackend")?.toString() ?: "fusion-renderer"
if (rendererBackend == "fusion-renderer") {
linkerOpts(
"-lnative_drawing", // OH_Drawing_*(字体、绘制)
"-limage_source", // OH_ImageSourceNative_*(图像解码)
"-lpixelmap", // OH_PixelMap_*
"-lpixelmap_ndk.z", // OH_PixelMapNdk_*
"-lnative_window", // OH_NativeWindow_*
"-lace_napi.z", // N-API
"-lhilog_ndk.z", // HiLog 日志
"-lhitrace_ndk.z", // HiTrace 性能追踪
"-luv", // libuv 事件循环
"-lunwind", // 栈展开
"-licu", // ICU 文本处理
)
}
}
ohosTarget.compilations.getByName("main") {
compilerOptions.configure {
freeCompilerArgs.add("-Xbinary=sanitizer=address")
}
val resource by main.cinterops.creating {
val resource by cinterops.creating {
defFile(file("src/ohosArm64Main/cinterop/resource.def"))
includeDirs(file("src/ohosArm64Main/cinterop/include"))
}
}
ohosX64 {
binaries.sharedLib {
baseName = "kn"
export(libs.compose.multiplatform.export)
linkerOpts("-lz")
// 避免 release 优化在模拟器上触发 SIGILL(非法指令)
optimized = false
}
val main by compilations.getting
main.compilerOptions.configure {
freeCompilerArgs.add("-Xbinary=sanitizer=address")
}
val resource by main.cinterops.creating {
defFile(file("src/ohosX64Main/cinterop/resource.def"))
includeDirs(file("src/ohosX64Main/cinterop/include"))
}
}
sourceSets {
androidMain.dependencies {
implementation(libs.androidx.activity.compose)
......@@ -154,13 +161,13 @@ dependencies {
debugImplementation(libs.compose.ui.tooling)
}
// OHOS 渲染模式二选一:自渲染(Skia)或统一渲染(ohrender)。切换时只保留其一,另一行注释掉。
compose {
ohos {
skia("0.9.22.2-0.2.0-05") // 自渲染:Compose 用 Skia 自绘
// ohrender("0.9.22.2-0.1.0") // 统一渲染:与 ArkUI 统一渲染管线;启用时注释上一行
}
}
//// OHOS 渲染模式二选一:自渲染(Skia)或统一渲染(ohrender)。切换时只保留其一,另一行注释掉。
//compose {
// ohos {
// skia("0.9.22.2-0.2.0-05") // 自渲染:Compose 用 Skia 自绘
// // ohrender("0.9.22.2-0.1.0") // 统一渲染:与 ArkUI 统一渲染管线;启用时注释上一行
// }
//}
// 为 ohosArm64 目标配置依赖处理
......
......@@ -19,13 +19,13 @@ androidx-testExt = "1.3.0"
# Compose
compose = "1.9.4"
compose-material3 = "1.4.0"
composeMultiplatform = "1.9.2-0.2.0-04"
composeMultiplatform = "1.9.2-0.2.0"
# Kotlin & testing
junit = "4.13.2"
kotlin = "2.2.21-0.2.0-12"
kotlinx-coroutines = "1.10.2-0.2.0-02"
atomicFu = "0.31.0-0.2.0-03"
kotlin = "2.2.21-0.2.0"
kotlinx-coroutines = "1.10.2-0.2.0"
atomicFu = "0.31.0-0.2.0"
[libraries]
# ----- Testing -----
......
......@@ -29,13 +29,13 @@
"name": "default",
"type": "HarmonyOS",
"material": {
"certpath": "/Users/dongsq/.ohos/config/default_harmonyApp_GthGxfoFAEmCFfCK6Yj5azdigDZk5Ro7gO2DpXptcpU=.cer",
"certpath": "/Users/dongsq/.ohos/config/default_harmonyApp_TPu8W6SZxLH-ctQGCONYIzHc-MUeWvxKo2tZExBJTas=.cer",
"keyAlias": "debugKey",
"keyPassword": "0000001BA8394766FB6938245FCF0B425C82CB0EB0B88650F52B26CCA027C3A0D90A39D41696DF08A3950D",
"profile": "/Users/dongsq/.ohos/config/default_harmonyApp_GthGxfoFAEmCFfCK6Yj5azdigDZk5Ro7gO2DpXptcpU=.p7b",
"keyPassword": "0000001B67A8D9252F44B74E3A1165F87678833FA18CE19E56290E423936CD12DFFFE08E80B075DF0DFC7F",
"profile": "/Users/dongsq/.ohos/config/default_harmonyApp_TPu8W6SZxLH-ctQGCONYIzHc-MUeWvxKo2tZExBJTas=.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "/Users/dongsq/.ohos/config/default_harmonyApp_GthGxfoFAEmCFfCK6Yj5azdigDZk5Ro7gO2DpXptcpU=.p12",
"storePassword": "0000001B9FB9FACFD67106949BAB6E7930858A89437B4C903F5E512C4068CFA080F2FA2237FA273323D288"
"storeFile": "/Users/dongsq/.ohos/config/default_harmonyApp_TPu8W6SZxLH-ctQGCONYIzHc-MUeWvxKo2tZExBJTas=.p12",
"storePassword": "0000001BBEF00FB080FD26FEF283282873CB5CA9D1319D795570C141C1DFE74C29141308EECFED7ED2F348"
}
}
]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment