From 280f52aba5f2ea30dcd844ecef1f1f7f0cde51b2 Mon Sep 17 00:00:00 2001 From: jialChen Date: Wed, 28 Aug 2024 12:00:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?toolchain=E4=B8=AD=E4=B8=BB=E8=A6=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E4=B8=A4=E4=B8=AAgni=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E5=8F=AF=E4=BB=A5=E8=B7=91=E9=80=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I574b255ab723989b17e48652c8c89eefeb399ec8 Signed-off-by: jialChen --- build/test.gni | 23 +++++++++++++++++++++-- build/third_party_gn/googletest/BUILD.gn | 19 ++++++++++++++++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/build/test.gni b/build/test.gni index 499f070a..09466f95 100644 --- a/build/test.gni +++ b/build/test.gni @@ -75,7 +75,26 @@ template("ohos_unittest") { deps += invoker.deps } - deps += - [ "//arkcompiler/toolchain/build/third_party_gn/googletest:gtest_main" ] + ans = false + if(defined(invoker.invoker)){ + ans=invoker.invoker + # print(defined(ans._compile_flag_rtti_)) + if(defined(ans._compile_flag_rtti_) ){#panduan true + deps +=[ "//arkcompiler/toolchain/build/third_party_gn/googletest:gtest_rtti_main", + # "//arkcompiler/toolchain/build/third_party_gn/googletest:gmock_rtti", + ] + } + else{ + deps +=[ "//arkcompiler/toolchain/build/third_party_gn/googletest:gtest_main" , + # "//arkcompiler/toolchain/build/third_party_gn/googletest:gmock_main" , + ] + } + } + else{ + deps +=[ "//arkcompiler/toolchain/build/third_party_gn/googletest:gtest_main" , + # "//arkcompiler/toolchain/build/third_party_gn/googletest:gmock_main" , + ] + } + } } diff --git a/build/third_party_gn/googletest/BUILD.gn b/build/third_party_gn/googletest/BUILD.gn index 04449d71..c3ec1de7 100644 --- a/build/third_party_gn/googletest/BUILD.gn +++ b/build/third_party_gn/googletest/BUILD.gn @@ -21,7 +21,8 @@ config("gtest_private_config") { config("gtest_private_config_rtti") { visibility = [ ":*" ] - include_dirs = [ "googletest" ] + # include_dirs = [ "googletest" ] + include_dirs = [ "$googletest_dir" ] cflags = [ "-frtti" ] cflags_objcc = [ "-frtti" ] cflags_cc = [ "-frtti" ] @@ -111,6 +112,13 @@ static_library("gtest_rtti") { configs += [ ":gtest_private_config_rtti" ] } +static_library("gtest_rtti_main") {#ADD + testonly = true + sources = [ "$googletest_dir/src/gtest_main.cc" ] + public_deps = [ ":gtest_rtti" ] +} + + static_library("gtest_main") { testonly = true sources = [ "$googletest_dir/src/gtest_main.cc" ] @@ -122,9 +130,14 @@ config("gmock_private_config") { include_dirs = [ "$googlemock_dir" ] } -config("gmock_private_config_rtti") { +config("gmock_private_config_rtti") {#chenjialiang + # visibility = [ ":*" ] + # include_dirs = [ "googlemock_dir/include" ] + # cflags = [ "-frtti" ] + # cflags_objcc = [ "-frtti" ] + # cflags_cc = [ "-frtti" ] visibility = [ ":*" ] - include_dirs = [ "googlemock_dir/include" ] + include_dirs = [ "$googlemock_dir" ] cflags = [ "-frtti" ] cflags_objcc = [ "-frtti" ] cflags_cc = [ "-frtti" ] -- Gitee From 6a9bb96e142d0e8b80f47b518ee222f6129b8426 Mon Sep 17 00:00:00 2001 From: jialChen Date: Thu, 29 Aug 2024 11:09:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?test.gni=E6=96=87=E4=BB=B6=E4=B8=BB?= =?UTF-8?q?=E8=A6=81=E6=98=AF=E6=A0=BC=E5=BC=8F=E5=8C=96=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8=E5=B7=A5=E5=85=B7=E5=AF=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=96=87=E6=A1=A3=E8=BF=9B=E8=A1=8C=E4=BA=86format?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=200829=20Signed-off-by:=20jialChen=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Icde0041f46f14a9463b34e0642092decf2864464 --- build/test.gni | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/build/test.gni b/build/test.gni index 09466f95..f09aaf5f 100644 --- a/build/test.gni +++ b/build/test.gni @@ -76,25 +76,27 @@ template("ohos_unittest") { } ans = false - if(defined(invoker.invoker)){ - ans=invoker.invoker + if (defined(invoker.invoker)) { + ans = invoker.invoker + # print(defined(ans._compile_flag_rtti_)) - if(defined(ans._compile_flag_rtti_) ){#panduan true - deps +=[ "//arkcompiler/toolchain/build/third_party_gn/googletest:gtest_rtti_main", - # "//arkcompiler/toolchain/build/third_party_gn/googletest:gmock_rtti", - ] - } - else{ - deps +=[ "//arkcompiler/toolchain/build/third_party_gn/googletest:gtest_main" , - # "//arkcompiler/toolchain/build/third_party_gn/googletest:gmock_main" , - ] + if (defined(ans._compile_flag_rtti_) && + ans._compile_flag_rtti_) { #panduan true + deps += [ + "//arkcompiler/toolchain/build/third_party_gn/googletest:gtest_rtti_main", + # "//arkcompiler/toolchain/build/third_party_gn/googletest:gmock_rtti", + ] + } else { + deps += [ + "//arkcompiler/toolchain/build/third_party_gn/googletest:gtest_main", + # "//arkcompiler/toolchain/build/third_party_gn/googletest:gmock_main" , + ] } - } - else{ - deps +=[ "//arkcompiler/toolchain/build/third_party_gn/googletest:gtest_main" , - # "//arkcompiler/toolchain/build/third_party_gn/googletest:gmock_main" , + } else { + deps += [ + "//arkcompiler/toolchain/build/third_party_gn/googletest:gtest_main", + # "//arkcompiler/toolchain/build/third_party_gn/googletest:gmock_main" , ] } - } } -- Gitee