提交 6c4f9c04 编写于 作者: O openharmony_ci 提交者: Gitee

!96 IssueNo:#I3N15H 编译构建支持使用clang编译基于linux内核的系统组件

Merge pull request !96 from yangming_ha/linux
...@@ -43,7 +43,10 @@ config("kernel_macros") { ...@@ -43,7 +43,10 @@ config("kernel_macros") {
"__LITEOS_M__", "__LITEOS_M__",
] ]
} else if (ohos_kernel_type == "linux") { } else if (ohos_kernel_type == "linux") {
defines = [ "__LINUX__" ] defines = [
"__linux__",
"__LINUX__",
]
} }
} }
...@@ -114,22 +117,31 @@ config("ohos_clang") { ...@@ -114,22 +117,31 @@ config("ohos_clang") {
if (ohos_build_compiler_dir != "") { if (ohos_build_compiler_dir != "") {
clang_dir = rebase_path("${ohos_build_compiler_dir}") clang_dir = rebase_path("${ohos_build_compiler_dir}")
} }
target_kernel = ""
if (ohos_kernel_type == "liteos_a") {
target_kernel = "arm-liteos"
} else if (ohos_kernel_type == "linux") {
target_kernel = "arm-linux-musl"
defines = [ "_LIBCPP_HAS_MUSL_LIBC" ]
}
include_dirs = [ include_dirs = [
"${clang_dir}/include/c++/v1", "${clang_dir}/include/c++/v1",
"//prebuilts/lite/sysroot/usr/include/arm-liteos", "//prebuilts/lite/sysroot/usr/include/${target_kernel}",
] ]
cflags = [ cflags = [
"--target=arm-liteos", "--target=${target_kernel}",
"--sysroot=${ohos_root_path}prebuilts/lite/sysroot", "--sysroot=${ohos_root_path}prebuilts/lite/sysroot",
] ]
cflags_cc = cflags cflags_cc = cflags
ldflags = cflags ldflags = cflags
ldflags += [ ldflags += [
"-L${clang_dir}/lib/arm-liteos/c++", "-L${clang_dir}/lib/${target_kernel}/c++",
"-L${ohos_root_path}prebuilts/lite/sysroot/usr/lib/arm-liteos", "-L${ohos_root_path}prebuilts/lite/sysroot/usr/lib/${target_kernel}",
"-L${clang_dir}/lib/clang/9.0.0/lib/arm-liteos", "-L${clang_dir}/lib/clang/9.0.0/lib/${target_kernel}",
"-lclang_rt.builtins", "-lclang_rt.builtins",
"-lc", "-lc",
"-lc++", "-lc++",
...@@ -192,4 +204,4 @@ config("board_exe_ld_flags") { ...@@ -192,4 +204,4 @@ config("board_exe_ld_flags") {
if (defined(board_exe_ld_flags)) { if (defined(board_exe_ld_flags)) {
ldflags += board_exe_ld_flags ldflags += board_exe_ld_flags
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册