Commit 3cf4cb5e authored by dsq's avatar dsq

用于临时测试-不合入master2

parent 3754154c
...@@ -39,44 +39,51 @@ kotlin { ...@@ -39,44 +39,51 @@ kotlin {
} }
ohosArm64 { // 配置OHOS(华为鸿蒙)多架构目标
binaries.sharedLib { listOf(
ohosArm64(), // 真机 arm64
ohosX64() // 模拟器/开发机 x64
).forEach { ohosTarget ->
ohosTarget.binaries.sharedLib {
baseName = "kn" // 共享库名称为kn baseName = "kn" // 共享库名称为kn
export(libs.compose.multiplatform.export) // 导出compose多平台库的接口 export(libs.compose.multiplatform.export) // 导出compose多平台库的接口
// 确保链接系统 zlib,使 libkn.so 的 NEEDED 包含 libz.so // 确保链接系统 zlib,使 libkn.so 的 NEEDED 包含 libz.so
linkerOpts("-lz") linkerOpts("-lz")
// 避免 release 优化在模拟器上触发 SIGILL(非法指令) // 避免 release 优化在模拟器上触发 SIGILL(非法指令)
optimized = false optimized = false
} // 渲染模式
// 禁用内联类可能有助于 NAPI // 背景:当 libkn.so 为旧编译产物时,其 DT_NEEDED 可能缺少以下库(正确构建时
val main by compilations.getting // NativeTasksConfiguration.kt 已通过 -l 选项将它们写入 DT_NEEDED)。
main.compilerOptions.configure { // 在 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") freeCompilerArgs.add("-Xbinary=sanitizer=address")
} }
val resource by main.cinterops.creating { val resource by cinterops.creating {
defFile(file("src/ohosArm64Main/cinterop/resource.def")) defFile(file("src/ohosArm64Main/cinterop/resource.def"))
includeDirs(file("src/ohosArm64Main/cinterop/include")) 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 { sourceSets {
androidMain.dependencies { androidMain.dependencies {
implementation(libs.androidx.activity.compose) implementation(libs.androidx.activity.compose)
...@@ -154,13 +161,13 @@ dependencies { ...@@ -154,13 +161,13 @@ dependencies {
debugImplementation(libs.compose.ui.tooling) debugImplementation(libs.compose.ui.tooling)
} }
// OHOS 渲染模式二选一:自渲染(Skia)或统一渲染(ohrender)。切换时只保留其一,另一行注释掉。 //// OHOS 渲染模式二选一:自渲染(Skia)或统一渲染(ohrender)。切换时只保留其一,另一行注释掉。
compose { //compose {
ohos { // ohos {
skia("0.9.22.2-0.2.0-05") // 自渲染:Compose 用 Skia 自绘 // skia("0.9.22.2-0.2.0-05") // 自渲染:Compose 用 Skia 自绘
// ohrender("0.9.22.2-0.1.0") // 统一渲染:与 ArkUI 统一渲染管线;启用时注释上一行 // // ohrender("0.9.22.2-0.1.0") // 统一渲染:与 ArkUI 统一渲染管线;启用时注释上一行
} // }
} //}
// 为 ohosArm64 目标配置依赖处理 // 为 ohosArm64 目标配置依赖处理
......
...@@ -19,13 +19,13 @@ androidx-testExt = "1.3.0" ...@@ -19,13 +19,13 @@ androidx-testExt = "1.3.0"
# Compose # Compose
compose = "1.9.4" compose = "1.9.4"
compose-material3 = "1.4.0" compose-material3 = "1.4.0"
composeMultiplatform = "1.9.2-0.2.0-04" composeMultiplatform = "1.9.2-0.2.0"
# Kotlin & testing # Kotlin & testing
junit = "4.13.2" junit = "4.13.2"
kotlin = "2.2.21-0.2.0-12" kotlin = "2.2.21-0.2.0"
kotlinx-coroutines = "1.10.2-0.2.0-02" kotlinx-coroutines = "1.10.2-0.2.0"
atomicFu = "0.31.0-0.2.0-03" atomicFu = "0.31.0-0.2.0"
[libraries] [libraries]
# ----- Testing ----- # ----- Testing -----
......
...@@ -29,13 +29,13 @@ ...@@ -29,13 +29,13 @@
"name": "default", "name": "default",
"type": "HarmonyOS", "type": "HarmonyOS",
"material": { "material": {
"certpath": "/Users/dongsq/.ohos/config/default_harmonyApp_GthGxfoFAEmCFfCK6Yj5azdigDZk5Ro7gO2DpXptcpU=.cer", "certpath": "/Users/dongsq/.ohos/config/default_harmonyApp_TPu8W6SZxLH-ctQGCONYIzHc-MUeWvxKo2tZExBJTas=.cer",
"keyAlias": "debugKey", "keyAlias": "debugKey",
"keyPassword": "0000001BA8394766FB6938245FCF0B425C82CB0EB0B88650F52B26CCA027C3A0D90A39D41696DF08A3950D", "keyPassword": "0000001B67A8D9252F44B74E3A1165F87678833FA18CE19E56290E423936CD12DFFFE08E80B075DF0DFC7F",
"profile": "/Users/dongsq/.ohos/config/default_harmonyApp_GthGxfoFAEmCFfCK6Yj5azdigDZk5Ro7gO2DpXptcpU=.p7b", "profile": "/Users/dongsq/.ohos/config/default_harmonyApp_TPu8W6SZxLH-ctQGCONYIzHc-MUeWvxKo2tZExBJTas=.p7b",
"signAlg": "SHA256withECDSA", "signAlg": "SHA256withECDSA",
"storeFile": "/Users/dongsq/.ohos/config/default_harmonyApp_GthGxfoFAEmCFfCK6Yj5azdigDZk5Ro7gO2DpXptcpU=.p12", "storeFile": "/Users/dongsq/.ohos/config/default_harmonyApp_TPu8W6SZxLH-ctQGCONYIzHc-MUeWvxKo2tZExBJTas=.p12",
"storePassword": "0000001B9FB9FACFD67106949BAB6E7930858A89437B4C903F5E512C4068CFA080F2FA2237FA273323D288" "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