From 57676bca594ce8f36780e14d1f167eaa3df958bb Mon Sep 17 00:00:00 2001 From: yangming_ha Date: Tue, 20 Apr 2021 01:58:09 -0700 Subject: [PATCH] =?UTF-8?q?IssueNo:#I3N15H=20=E7=BC=96=E8=AF=91=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E6=94=AF=E6=8C=81=E4=BD=BF=E7=94=A8clang=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E5=9F=BA=E4=BA=8Elinux=E5=86=85=E6=A0=B8=E7=9A=84?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/BUILD.gn | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/config/BUILD.gn b/config/BUILD.gn index 7b55cee..a99420d 100755 --- a/config/BUILD.gn +++ b/config/BUILD.gn @@ -43,7 +43,10 @@ config("kernel_macros") { "__LITEOS_M__", ] } else if (ohos_kernel_type == "linux") { - defines = [ "__LINUX__" ] + defines = [ + "__linux__", + "__LINUX__", + ] } } @@ -114,22 +117,31 @@ config("ohos_clang") { if (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 = [ "${clang_dir}/include/c++/v1", - "//prebuilts/lite/sysroot/usr/include/arm-liteos", + "//prebuilts/lite/sysroot/usr/include/${target_kernel}", ] cflags = [ - "--target=arm-liteos", + "--target=${target_kernel}", "--sysroot=${ohos_root_path}prebuilts/lite/sysroot", ] cflags_cc = cflags ldflags = cflags ldflags += [ - "-L${clang_dir}/lib/arm-liteos/c++", - "-L${ohos_root_path}prebuilts/lite/sysroot/usr/lib/arm-liteos", - "-L${clang_dir}/lib/clang/9.0.0/lib/arm-liteos", + "-L${clang_dir}/lib/${target_kernel}/c++", + "-L${ohos_root_path}prebuilts/lite/sysroot/usr/lib/${target_kernel}", + "-L${clang_dir}/lib/clang/9.0.0/lib/${target_kernel}", "-lclang_rt.builtins", "-lc", "-lc++", @@ -192,4 +204,4 @@ config("board_exe_ld_flags") { if (defined(board_exe_ld_flags)) { ldflags += board_exe_ld_flags } -} \ No newline at end of file +} -- GitLab