From bf23f1daf94b73f0f4091a25e6dba09352ca5911 Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki <zygmunt.krynicki@huawei.com> Date: Wed, 3 Feb 2021 17:44:10 +0100 Subject: [PATCH] ohos-googletest: Integrate OHOS snapshot ohos-googoletest is a fork of googletest with OHOS-specific extensions. Build with make instead of OHOS specific and unusable BUILD.gn file. Unlike the BUILD.gn file, build shared libraries for gtest and gtest_main. The remaining gmock library is not yet needed by any test so it is not built. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@huawei.com> --- .../0001-Add-makefile-based-on-zmk.patch | 140 ++++++++++++++++++ .../ohos-googletest/ohos-googletest_git.bb | 25 ++++ 2 files changed, 165 insertions(+) create mode 100644 meta-ohos-acts/recipes-ohos-googletest/ohos-googletest/ohos-googletest/0001-Add-makefile-based-on-zmk.patch create mode 100644 meta-ohos-acts/recipes-ohos-googletest/ohos-googletest/ohos-googletest_git.bb diff --git a/meta-ohos-acts/recipes-ohos-googletest/ohos-googletest/ohos-googletest/0001-Add-makefile-based-on-zmk.patch b/meta-ohos-acts/recipes-ohos-googletest/ohos-googletest/ohos-googletest/0001-Add-makefile-based-on-zmk.patch new file mode 100644 index 00000000..6c125a59 --- /dev/null +++ b/meta-ohos-acts/recipes-ohos-googletest/ohos-googletest/ohos-googletest/0001-Add-makefile-based-on-zmk.patch @@ -0,0 +1,140 @@ +From c0a201576f9ed2bf8fe009722d63bea487493765 Mon Sep 17 00:00:00 2001 +From: Zygmunt Krynicki <zygmunt.krynicki@huawei.com> +Date: Thu, 28 Jan 2021 09:17:22 +0100 +Subject: [PATCH] Add makefile based on zmk + +The makefile defines libgtest.so, libgtest_main.so and several classes of +header files. + +Not all header files are installed yet, only those that were necessary by the +initial specific ACTS test that was compiled. + +Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@huawei.com> +--- + GNUmakefile | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 117 insertions(+) + create mode 100644 GNUmakefile + +diff --git a/GNUmakefile b/GNUmakefile +new file mode 100644 +index 0000000..dc28364 +--- /dev/null ++++ b/GNUmakefile +@@ -0,0 +1,117 @@ ++# SPDX-License-Identifier: Apache-2.0 ++# ++# Copyright 2021 Huawei Inc. ++# ++# Licensed under the Apache License, Version 2.0 (the "License"); ++# you may not use this file except in compliance with the License. ++# You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS IS" BASIS, ++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++# See the License for the specific language governing permissions and ++# limitations under the License. ++ ++include z.mk ++ ++Project.Name=ohos-googletest ++Project.Version=1 ++ ++libgtest.so: CPPFLAGS += -iquote $(ZMK.OutOfTreeSourcePath)googletest ++libgtest.so: CPPFLAGS += -iquote $(ZMK.OutOfTreeSourcePath)googletest/include ++libgtest.so.Sources = \ ++ googletest/include/gtest/gtest-death-test.h \ ++ googletest/include/gtest/gtest-message.h \ ++ googletest/include/gtest/gtest-param-test.h \ ++ googletest/include/gtest/gtest-printers.h \ ++ googletest/include/gtest/gtest-test-part.h \ ++ googletest/include/gtest/gtest-typed-test.h \ ++ googletest/include/gtest/gtest_pred_impl.h \ ++ googletest/include/gtest/gtest_prod.h \ ++ googletest/include/gtest/internal/custom/gtest-port.h \ ++ googletest/include/gtest/internal/custom/gtest-printers.h \ ++ googletest/include/gtest/internal/custom/gtest.h \ ++ googletest/include/gtest/internal/gtest-death-test-internal.h \ ++ googletest/include/gtest/internal/gtest-filepath.h \ ++ googletest/include/gtest/internal/gtest-internal.h \ ++ googletest/include/gtest/internal/gtest-linked_ptr.h \ ++ googletest/include/gtest/internal/gtest-param-util-generated.h \ ++ googletest/include/gtest/internal/gtest-param-util.h \ ++ googletest/include/gtest/internal/gtest-port-arch.h \ ++ googletest/include/gtest/internal/gtest-port.h \ ++ googletest/include/gtest/internal/gtest-string.h \ ++ googletest/include/gtest/internal/gtest-tuple.h \ ++ googletest/include/gtest/internal/gtest-type-util.h \ ++ googletest/include/gtest/hwext/gtest-ext.h \ ++ googletest/include/gtest/hwext/gtest-filter.h \ ++ googletest/include/gtest/hwext/gtest-tag.h \ ++ googletest/include/gtest/hwext/utils.h \ ++ googletest/src/gtest-all.cc \ ++ googletest/src/gtest-death-test.cc \ ++ googletest/src/gtest-filepath.cc \ ++ googletest/src/gtest-internal-inl.h \ ++ googletest/src/gtest-port.cc \ ++ googletest/src/gtest-printers.cc \ ++ googletest/src/gtest-test-part.cc \ ++ googletest/src/gtest-typed-test.cc \ ++ googletest/src/gtest.cc \ ++ googletest/src/hwext/gtest-ext.cc \ ++ googletest/src/hwext/gtest-filter.cc \ ++ googletest/src/hwext/gtest-tag.cc \ ++ googletest/src/hwext/gtest-utils.cc ++libgtest.so.Sources := $(filter-out googletest/src/gtest-all.cc,$(libgtest.so.Sources)) ++$(eval $(call ZMK.Expand,Library.So,libgtest.so)) ++ ++libgtest_main.so: CPPFLAGS += -iquote $(ZMK.OutOfTreeSourcePath)googletest ++libgtest_main.so: CPPFLAGS += -iquote $(ZMK.OutOfTreeSourcePath)googletest/include ++libgtest_main.so.Sources = \ ++ googletest/src/gtest_main.cc ++$(eval $(call ZMK.Expand,Library.So,libgtest_main.so)) ++ ++# Public header files ++gtest-headers-public.InstallDir = $(includedir)/gtest ++gtest-headers-public.Headers = \ ++ googletest/include/gtest/gtest-death-test.h \ ++ googletest/include/gtest/gtest-message.h \ ++ googletest/include/gtest/gtest-param-test.h \ ++ googletest/include/gtest/gtest-printers.h \ ++ googletest/include/gtest/gtest-spi.h \ ++ googletest/include/gtest/gtest-test-part.h \ ++ googletest/include/gtest/gtest-typed-test.h \ ++ googletest/include/gtest/gtest.h \ ++ googletest/include/gtest/gtest_pred_impl.h \ ++ googletest/include/gtest/gtest_prod.h ++$(eval $(call ZMK.Expand,HeaderGroup,gtest-headers-public)) ++ ++# Internal headers required by ACTS ++gtest-headers-internal.InstallDir = $(includedir)/gtest/internal ++gtest-headers-internal.Headers = \ ++ googletest/include/gtest/internal/gtest-death-test-internal.h \ ++ googletest/include/gtest/internal/gtest-filepath.h \ ++ googletest/include/gtest/internal/gtest-internal.h \ ++ googletest/include/gtest/internal/gtest-linked_ptr.h \ ++ googletest/include/gtest/internal/gtest-param-util-generated.h \ ++ googletest/include/gtest/internal/gtest-param-util.h \ ++ googletest/include/gtest/internal/gtest-port-arch.h \ ++ googletest/include/gtest/internal/gtest-port.h \ ++ googletest/include/gtest/internal/gtest-string.h \ ++ googletest/include/gtest/internal/gtest-type-util.h ++$(eval $(call ZMK.Expand,HeaderGroup,gtest-headers-internal)) ++ ++# Internal custom headers required by ACTS ++gtest-headers-internal-custom.InstallDir = $(includedir)/gtest/internal/custom ++gtest-headers-internal-custom.Headers = \ ++ googletest/include/gtest/internal/custom/gtest-port.h \ ++ googletest/include/gtest/internal/custom/gtest-printers.h ++$(eval $(call ZMK.Expand,HeaderGroup,gtest-headers-internal-custom)) ++ ++# Harmony-specific extensions ++gtest-headers-hwext.InstallDir = $(includedir)/gtest/hwext ++gtest-headers-hwext.Headers = \ ++ googletest/include/gtest/hwext/gtest-ext.h \ ++ googletest/include/gtest/hwext/gtest-filter.h \ ++ googletest/include/gtest/hwext/gtest-tag.h ++$(eval $(call ZMK.Expand,HeaderGroup,gtest-headers-hwext)) ++ diff --git a/meta-ohos-acts/recipes-ohos-googletest/ohos-googletest/ohos-googletest_git.bb b/meta-ohos-acts/recipes-ohos-googletest/ohos-googletest/ohos-googletest_git.bb new file mode 100644 index 00000000..50c5ab80 --- /dev/null +++ b/meta-ohos-acts/recipes-ohos-googletest/ohos-googletest/ohos-googletest_git.bb @@ -0,0 +1,25 @@ +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=cbbd27594afd089daa160d3a16dd515a \ + file://googlemock/LICENSE;md5=cbbd27594afd089daa160d3a16dd515a \ + file://googlemock/scripts/generator/LICENSE;md5=2c0b90db7465231447cf2dd2e8163333 \ + file://googletest/LICENSE;md5=cbbd27594afd089daa160d3a16dd515a" + +SRC_URI = "git://git.ostc-eu.org/OSTC/OHOS/components/staging/third_party_googletest.git;protocol=https \ + file://0001-Add-makefile-based-on-zmk.patch \ + " +SRCREV = "f99de7cafdc7cd5374c1c7ef5252252a57aff04d" +S = "${WORKDIR}/git" +PV = "0.0+git${SRCPV}" + +# The OHOS fork of googletest is not versioned properly. +# Move the naked .so files to the primary package. +SOLIBS = ".so" +FILES_SOLIBSDEV = "" + +inherit zmk + +do_configure_prepend() { + # Remove upstream autotools. Those are unmaintained in the OHOS fork. + # They cause bitbake to be confused and run the wrong build system. + rm -f ${S}/Makefile.am ${S}/configure.ac ${S}/configure +} -- GitLab