Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TestToolChainDemo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
dsq
TestToolChainDemo
Commits
c999cf36
Commit
c999cf36
authored
May 19, 2026
by
dsq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
适配arm64、x64的header
parent
3cf4cb5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
14 deletions
+25
-14
build.gradle.kts
composeApp/build.gradle.kts
+5
-5
CMakeLists.txt
harmonyApp/entry/src/main/cpp/CMakeLists.txt
+20
-9
No files found.
composeApp/build.gradle.kts
View file @
c999cf36
...
...
@@ -216,14 +216,14 @@ arrayOf("debug", "release").forEach { type ->
dependsOn
(
"link${type.capitalizeUS()}SharedOhosArm64"
,
"link${type.capitalizeUS()}SharedOhosX64"
)
duplicatesStrategy
=
DuplicatesStrategy
.
INCLUDE
into
(
rootProject
.
file
(
"harmonyApp"
))
from
(
"build/bin/ohosArm64/${type}Shared/libkn_api.h"
)
{
into
(
"entry/src/main/cpp/include/
"
)
from
(
"build/bin/ohosArm64/${type}Shared/libkn_api.h"
)
{
// 复制头文件
into
(
"entry/src/main/cpp/include/
arm64-v8a/"
)
// 指定目录
}
from
(
project
.
file
(
"build/bin/ohosArm64/${type}Shared/libkn.so"
))
{
into
(
"
entry/libs/arm64-v8a/"
)
from
(
project
.
file
(
"build/bin/ohosArm64/${type}Shared/libkn.so"
))
{
// 复制共享库文件
into
(
"
/entry/libs/arm64-v8a/"
)
// 指定目标目录
}
from
(
"build/bin/ohosX64/${type}Shared/libkn_api.h"
)
{
into
(
"entry/src/main/cpp/include/"
)
into
(
"entry/src/main/cpp/include/
x86_64/
"
)
}
from
(
project
.
file
(
"build/bin/ohosX64/${type}Shared/libkn.so"
))
{
into
(
"entry/libs/x86_64/"
)
...
...
harmonyApp/entry/src/main/cpp/CMakeLists.txt
View file @
c999cf36
...
...
@@ -8,11 +8,20 @@ if(DEFINED PACKAGE_FIND_FILE)
include
(
${
PACKAGE_FIND_FILE
}
)
endif
()
# 按 ABI 选 libkn.so / libkn_api.h(须与 libs/<abi>/libkn.so 来自同一次 K/N link)
if
(
CMAKE_OHOS_ARCH_ABI STREQUAL
"x86_64"
OR OHOS_ARCH STREQUAL
"x86_64"
)
set
(
LIBKN_ABI_DIR
"x86_64"
)
else
()
set
(
LIBKN_ABI_DIR
"arm64-v8a"
)
endif
()
include_directories
(
${
NATIVERENDER_ROOT_PATH
}
${
NATIVERENDER_ROOT_PATH
}
/include
)
${
NATIVERENDER_ROOT_PATH
}
/include
${
NATIVERENDER_ROOT_PATH
}
/include/
${
LIBKN_ABI_DIR
}
)
# 从skikobridge 换成了 compose
find_package
(
compose
)
find_package
(
skikobridge
)
add_library
(
entry SHARED napi_init.cpp
)
# Link against ComposeApp shared library to resolve exported symbols
...
...
@@ -22,16 +31,18 @@ target_link_libraries(entry PUBLIC libhilog_ndk.z.so)
target_link_libraries
(
entry PUBLIC libdeviceinfo_ndk.z.so
)
target_link_libraries
(
entry PUBLIC librawfile.z.so
)
#target_link_libraries(entry PUBLIC libicu.so)
# 按 ABI 选 libkn.so 路径(当前 abiFilters 仅 x86_64 时只构建模拟器)
if
(
CMAKE_OHOS_ARCH_ABI STREQUAL
"x86_64"
OR OHOS_ARCH STREQUAL
"x86_64"
)
set
(
LIBKN_ABI_DIR
"x86_64"
)
else
()
set
(
LIBKN_ABI_DIR
"arm64-v8a"
)
endif
()
set_target_properties
(
ComposeApp PROPERTIES
IMPORTED_LOCATION
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../libs/
${
LIBKN_ABI_DIR
}
/libkn.so"
)
target_link_libraries
(
entry PUBLIC ComposeApp
)
# 先链接 libkn.so,再链接 compose里面的skikobridge
target_link_libraries
(
entry PUBLIC compose::skikobridge
)
target_link_libraries
(
entry PUBLIC
${
EGL-lib
}
${
GLES-lib
}
${
hilog-lib
}
${
libace-lib
}
${
libnapi-lib
}
${
libuv-lib
}
libc++_shared.so
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment