From 7b44be40faa35b8e2f58f1030939720138b649a5 Mon Sep 17 00:00:00 2001 From: yanansong Date: Wed, 7 Jun 2023 18:13:50 +0800 Subject: [PATCH 1/3] use prebuild library and include to build socketpair --- build/gn/BUILD.gn | 1 + build/gn/fangtian.gni | 1 + build/prebuild.sh | 27 +++++++++- .../utils/scoped_bytrace/ft_build/BUILD.gn | 44 ++++++++++++++++ .../utils/socketpair/ft_build/BUILD.gn | 52 +++++++++++++++++++ 5 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 display_server/utils/scoped_bytrace/ft_build/BUILD.gn create mode 100644 display_server/utils/socketpair/ft_build/BUILD.gn diff --git a/build/gn/BUILD.gn b/build/gn/BUILD.gn index 4056c61..0301823 100644 --- a/build/gn/BUILD.gn +++ b/build/gn/BUILD.gn @@ -13,5 +13,6 @@ group("ft_engine") { deps = [ + "//display_server/utils/socketpair/ft_build:socketpair", ] } diff --git a/build/gn/fangtian.gni b/build/gn/fangtian.gni index f4b75d5..a345c67 100755 --- a/build/gn/fangtian.gni +++ b/build/gn/fangtian.gni @@ -18,3 +18,4 @@ declare_args() { } +sys_inc = "/usr/include" diff --git a/build/prebuild.sh b/build/prebuild.sh index 9b6d36c..91e0b3c 100755 --- a/build/prebuild.sh +++ b/build/prebuild.sh @@ -36,7 +36,7 @@ fi PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}') # Compare the versions -if [ "$(printf '%s\n' "$PYTHON_REQUIRED_VERSION" "$PYTHON_VERSION" | sort -V | head -n1)" = "$PYTHON_REQUIRED_VERSION" ]; then +if [ "$(printf '%s\n' "$PYTHON_REQUIRED_VERSION" "$PYTHON_VERSION" | sort -V | head -n1)" = "$PYTHON_REQUIRED_VERSION" ]; then echo "The python3 version is $PYTHON_VERSION" else echo "The python3 version is less than $PYTHON_REQUIRED_VERSION" @@ -59,4 +59,27 @@ echo -e "\e[36m[-] Prepare system packages...\e[0m" # Check & Install required system packages python3 ${PROJECT_DIR}/build/builder.py check --install-packages $* -echo -e "\033[32m[*] Pre-build Done. You can exec 'build.sh' now.\033[0m" +# install prebuild library +if [ ! -d ${PROJECT_DIR}/prebuilts/libs ]; then +git clone https://gitee.com/yanansong/ft_engine_prebuild.git ${PROJECT_DIR}/prebuilts/libs +fi + +# copy prebuild library to /usr/lib64 +ARCHNAME=`uname -m` +cd ${PROJECT_DIR}/prebuilts/libs/library/${ARCHNAME} +sudo cp -fr *.so /usr/lib64 +cd ${PROJECT_DIR} +rm -fr ${PROJECT_DIR}/prebuilts/libs + +# install prebuild include. delete download files +if [ ! -d ${PROJECT_DIR}/prebuilts/inc ]; then +git clone https://gitee.com/yanansong/devel_inc.git ${PROJECT_DIR}/prebuilts/inc +fi + +# copy include files to /usr/include. delete download files +cd ${PROJECT_DIR}/prebuilts/inc +sudo cp -fr * /usr/include +cd ${PROJECT_DIR} +rm -fr ${PROJECT_DIR}/prebuilts/inc + +echo -e "\033[32m[*] Pre-build Done. You need exec 'build.sh'.\033[0m" diff --git a/display_server/utils/scoped_bytrace/ft_build/BUILD.gn b/display_server/utils/scoped_bytrace/ft_build/BUILD.gn new file mode 100644 index 0000000..9508cd8 --- /dev/null +++ b/display_server/utils/scoped_bytrace/ft_build/BUILD.gn @@ -0,0 +1,44 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# 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. + +import("//build/gn/fangtian.gni") + +config("scoped_bytrace_config") { + visibility = [ ":*" ] + + cflags = [ + "-Wall", + "-Werror", + "-g3", + ] +} + +config("scoped_bytrace_public_config") { + include_dirs = [ "../export" ] + include_dirs += [ + "${sys_inc}/hitrace_meter", + "${sys_inc}/hilog", + ] + libs = ["hilog", "hitrace_meter"] +} + +ft_static_library("scoped_bytrace") { + sources = [ "../src/scoped_bytrace.cpp" ] + + configs = [ ":scoped_bytrace_config" ] + + public_configs = [ ":scoped_bytrace_public_config" ] + + subsystem_name = "graphic" + part_name = "graphic_standard" +} diff --git a/display_server/utils/socketpair/ft_build/BUILD.gn b/display_server/utils/socketpair/ft_build/BUILD.gn new file mode 100644 index 0000000..4d64f3a --- /dev/null +++ b/display_server/utils/socketpair/ft_build/BUILD.gn @@ -0,0 +1,52 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# 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. + +import("//build/gn/fangtian.gni") + +config("socketpair_config") { + visibility = [ ":socketpair" ] + + cflags = [ + "-Wall", + "-Werror", + "-g3", + ] +} + +config("socketpair_public_config") { + include_dirs = [ + "${sys_inc}/c_utils", + "${sys_inc}/ipc_core", + "${sys_inc}/hilog", + ] + libs = ["hilog", "ipc_core", "utils"] +} + +config("socketpair_all_dependent_config") { + include_dirs = [ "../export" ] +} + +ft_shared_library("socketpair") { + sources = [ "../src/local_socketpair.cpp" ] + + configs = [ ":socketpair_config" ] + + public_configs = [ ":socketpair_public_config" ] + all_dependent_configs = [ ":socketpair_all_dependent_config" ] + + deps = [ "//display_server/utils/scoped_bytrace/ft_build:scoped_bytrace" ] + + part_name = "graphic_standard" + subsystem_name = "graphic" +} + -- Gitee From cbac5d6c74c8e68f055c93bcd990c797bb96a982 Mon Sep 17 00:00:00 2001 From: yanansong Date: Thu, 8 Jun 2023 14:36:53 +0800 Subject: [PATCH 2/3] gn code style: config --- .../utils/scoped_bytrace/ft_build/BUILD.gn | 14 +++++--------- display_server/utils/socketpair/ft_build/BUILD.gn | 15 +-------------- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/display_server/utils/scoped_bytrace/ft_build/BUILD.gn b/display_server/utils/scoped_bytrace/ft_build/BUILD.gn index 9508cd8..76a1bd3 100644 --- a/display_server/utils/scoped_bytrace/ft_build/BUILD.gn +++ b/display_server/utils/scoped_bytrace/ft_build/BUILD.gn @@ -15,30 +15,26 @@ import("//build/gn/fangtian.gni") config("scoped_bytrace_config") { visibility = [ ":*" ] - cflags = [ "-Wall", "-Werror", "-g3", ] -} - -config("scoped_bytrace_public_config") { - include_dirs = [ "../export" ] - include_dirs += [ + include_dirs = [ "${sys_inc}/hitrace_meter", "${sys_inc}/hilog", ] libs = ["hilog", "hitrace_meter"] } +config("scoped_bytrace_public_config") { + include_dirs = [ "../export" ] +} + ft_static_library("scoped_bytrace") { sources = [ "../src/scoped_bytrace.cpp" ] - configs = [ ":scoped_bytrace_config" ] - public_configs = [ ":scoped_bytrace_public_config" ] - subsystem_name = "graphic" part_name = "graphic_standard" } diff --git a/display_server/utils/socketpair/ft_build/BUILD.gn b/display_server/utils/socketpair/ft_build/BUILD.gn index 4d64f3a..8a7300b 100644 --- a/display_server/utils/socketpair/ft_build/BUILD.gn +++ b/display_server/utils/socketpair/ft_build/BUILD.gn @@ -15,16 +15,13 @@ import("//build/gn/fangtian.gni") config("socketpair_config") { visibility = [ ":socketpair" ] - cflags = [ "-Wall", "-Werror", "-g3", ] -} - -config("socketpair_public_config") { include_dirs = [ + "../export", "${sys_inc}/c_utils", "${sys_inc}/ipc_core", "${sys_inc}/hilog", @@ -32,20 +29,10 @@ config("socketpair_public_config") { libs = ["hilog", "ipc_core", "utils"] } -config("socketpair_all_dependent_config") { - include_dirs = [ "../export" ] -} - ft_shared_library("socketpair") { sources = [ "../src/local_socketpair.cpp" ] - configs = [ ":socketpair_config" ] - - public_configs = [ ":socketpair_public_config" ] - all_dependent_configs = [ ":socketpair_all_dependent_config" ] - deps = [ "//display_server/utils/scoped_bytrace/ft_build:scoped_bytrace" ] - part_name = "graphic_standard" subsystem_name = "graphic" } -- Gitee From 2e3b85acba4bd3f51d6a3deca88d0d01482cc8e5 Mon Sep 17 00:00:00 2001 From: yanansong Date: Thu, 8 Jun 2023 15:34:30 +0800 Subject: [PATCH 3/3] change copyright. del blank --- display_server/utils/scoped_bytrace/ft_build/BUILD.gn | 4 ++-- display_server/utils/socketpair/ft_build/BUILD.gn | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/display_server/utils/scoped_bytrace/ft_build/BUILD.gn b/display_server/utils/scoped_bytrace/ft_build/BUILD.gn index 76a1bd3..66f7f5b 100644 --- a/display_server/utils/scoped_bytrace/ft_build/BUILD.gn +++ b/display_server/utils/scoped_bytrace/ft_build/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2023 Huawei Technologies Co., Ltd. # 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 @@ -37,4 +37,4 @@ ft_static_library("scoped_bytrace") { public_configs = [ ":scoped_bytrace_public_config" ] subsystem_name = "graphic" part_name = "graphic_standard" -} +} \ No newline at end of file diff --git a/display_server/utils/socketpair/ft_build/BUILD.gn b/display_server/utils/socketpair/ft_build/BUILD.gn index 8a7300b..ba8de72 100644 --- a/display_server/utils/socketpair/ft_build/BUILD.gn +++ b/display_server/utils/socketpair/ft_build/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2023 Huawei Technologies Co., Ltd. # 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 @@ -35,5 +35,4 @@ ft_shared_library("socketpair") { deps = [ "//display_server/utils/scoped_bytrace/ft_build:scoped_bytrace" ] part_name = "graphic_standard" subsystem_name = "graphic" -} - +} \ No newline at end of file -- Gitee