From 47e1ddab65efdf6d8bd2649c96077c28b0340a66 Mon Sep 17 00:00:00 2001 From: syn Date: Wed, 7 Jun 2023 16:37:18 +0800 Subject: [PATCH 1/3] add prebuild library/inc to system. build socketpair ok --- build/gn/BUILD.gn | 1 + build/gn/fangtian.gni | 1 + build/prebuild.sh | 32 ++++++++++++++++++-- display_server/utils/scoped_bytrace/BUILD.gn | 13 ++++---- display_server/utils/socketpair/BUILD.gn | 24 +++++---------- 5 files changed, 47 insertions(+), 24 deletions(-) diff --git a/build/gn/BUILD.gn b/build/gn/BUILD.gn index 4056c61..75b0068 100644 --- a/build/gn/BUILD.gn +++ b/build/gn/BUILD.gn @@ -13,5 +13,6 @@ group("ft_engine") { deps = [ + "//display_server/utils/socketpair: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..a022aad 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,32 @@ 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 +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 +cd ${PROJECT_DIR}/prebuilts/inc +sudo cp -fr * /usr/include +cd ${PROJECT_DIR} +rm -fr ${PROJECT_DIR}/prebuilts/inc + +#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${PROJECT_DIR}/ft_engine_prebuild + +#source ${PROJECT_DIR}/build/setenv.sh + +echo -e "\033[32m[*] Pre-build Done. You need exec 'source build/setenv.sh' before build.\033[0m" diff --git a/display_server/utils/scoped_bytrace/BUILD.gn b/display_server/utils/scoped_bytrace/BUILD.gn index 27fa18d..08ed2e4 100644 --- a/display_server/utils/scoped_bytrace/BUILD.gn +++ b/display_server/utils/scoped_bytrace/BUILD.gn @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/ohos.gni") +import("//build/gn/fangtian.gni") ## Build scoped_bytrace.a {{{ config("scoped_bytrace_config") { @@ -26,19 +26,20 @@ config("scoped_bytrace_config") { config("scoped_bytrace_public_config") { include_dirs = [ "export" ] + include_dirs += [ + "${sys_inc}/hitrace_meter", + "${sys_inc}/hilog", + ] + libs = ["hilog", "hitrace_meter"] } -ohos_static_library("scoped_bytrace") { +ft_static_library("scoped_bytrace") { sources = [ "src/scoped_bytrace.cpp" ] configs = [ ":scoped_bytrace_config" ] public_configs = [ ":scoped_bytrace_public_config" ] - deps = [ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog" ] - - external_deps = [ "hitrace_native:hitrace_meter" ] - subsystem_name = "graphic" part_name = "graphic_standard" } diff --git a/display_server/utils/socketpair/BUILD.gn b/display_server/utils/socketpair/BUILD.gn index c130895..d5c0ed4 100644 --- a/display_server/utils/socketpair/BUILD.gn +++ b/display_server/utils/socketpair/BUILD.gn @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/ohos.gni") +import("//build/gn/fangtian.gni") ## Build socketpair.so {{{ config("socketpair_config") { @@ -26,17 +26,18 @@ config("socketpair_config") { config("socketpair_public_config") { include_dirs = [ - "//commonlibrary/c_utils/base/include", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include/message_parcel.h", - "//base/hiviewdfx/hilog/interfaces/native/innerkits", + "${sys_inc}/c_utils", + "${sys_inc}/ipc_core", + "${sys_inc}/hilog", ] + libs = ["hilog", "ipc_core", "utils"] } config("socketpair_all_dependent_config") { include_dirs = [ "export" ] } -ohos_shared_library("socketpair") { +ft_shared_library("socketpair") { sources = [ "src/local_socketpair.cpp" ] configs = [ ":socketpair_config" ] @@ -44,20 +45,11 @@ ohos_shared_library("socketpair") { public_configs = [ ":socketpair_public_config" ] all_dependent_configs = [ ":socketpair_all_dependent_config" ] - deps = [ "//foundation/graphic/graphic_2d/utils:scoped_bytrace" ] - - public_deps = [ - "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", - "//commonlibrary/c_utils/base:utils", - "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", - ] + deps = [ "//display_server/utils/scoped_bytrace:scoped_bytrace" ] part_name = "graphic_standard" subsystem_name = "graphic" } -group("test") { - testonly = true - deps = [ "test:test" ] -} ## Build socketpair.so }}} + -- Gitee From af52c789151fbde7119e2b678bf6d2e85f5c6e02 Mon Sep 17 00:00:00 2001 From: syn Date: Wed, 7 Jun 2023 17:30:29 +0800 Subject: [PATCH 2/3] change build dir --- build/gn/BUILD.gn | 2 +- build/prebuild.sh | 6 +-- display_server/utils/scoped_bytrace/BUILD.gn | 13 +++-- .../utils/scoped_bytrace/ft_build/BUILD.gn | 44 ++++++++++++++++ display_server/utils/socketpair/BUILD.gn | 24 ++++++--- .../utils/socketpair/ft_build/BUILD.gn | 52 +++++++++++++++++++ 6 files changed, 120 insertions(+), 21 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 75b0068..0301823 100644 --- a/build/gn/BUILD.gn +++ b/build/gn/BUILD.gn @@ -13,6 +13,6 @@ group("ft_engine") { deps = [ - "//display_server/utils/socketpair:socketpair", + "//display_server/utils/socketpair/ft_build:socketpair", ] } diff --git a/build/prebuild.sh b/build/prebuild.sh index a022aad..988e704 100755 --- a/build/prebuild.sh +++ b/build/prebuild.sh @@ -83,8 +83,4 @@ sudo cp -fr * /usr/include cd ${PROJECT_DIR} rm -fr ${PROJECT_DIR}/prebuilts/inc -#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${PROJECT_DIR}/ft_engine_prebuild - -#source ${PROJECT_DIR}/build/setenv.sh - -echo -e "\033[32m[*] Pre-build Done. You need exec 'source build/setenv.sh' before build.\033[0m" +echo -e "\033[32m[*] Pre-build Done. You need exec 'build.sh'.\033[0m" diff --git a/display_server/utils/scoped_bytrace/BUILD.gn b/display_server/utils/scoped_bytrace/BUILD.gn index 08ed2e4..27fa18d 100644 --- a/display_server/utils/scoped_bytrace/BUILD.gn +++ b/display_server/utils/scoped_bytrace/BUILD.gn @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/gn/fangtian.gni") +import("//build/ohos.gni") ## Build scoped_bytrace.a {{{ config("scoped_bytrace_config") { @@ -26,20 +26,19 @@ config("scoped_bytrace_config") { 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") { +ohos_static_library("scoped_bytrace") { sources = [ "src/scoped_bytrace.cpp" ] configs = [ ":scoped_bytrace_config" ] public_configs = [ ":scoped_bytrace_public_config" ] + deps = [ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog" ] + + external_deps = [ "hitrace_native:hitrace_meter" ] + subsystem_name = "graphic" part_name = "graphic_standard" } 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/BUILD.gn b/display_server/utils/socketpair/BUILD.gn index d5c0ed4..c130895 100644 --- a/display_server/utils/socketpair/BUILD.gn +++ b/display_server/utils/socketpair/BUILD.gn @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/gn/fangtian.gni") +import("//build/ohos.gni") ## Build socketpair.so {{{ config("socketpair_config") { @@ -26,18 +26,17 @@ config("socketpair_config") { config("socketpair_public_config") { include_dirs = [ - "${sys_inc}/c_utils", - "${sys_inc}/ipc_core", - "${sys_inc}/hilog", + "//commonlibrary/c_utils/base/include", + "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include/message_parcel.h", + "//base/hiviewdfx/hilog/interfaces/native/innerkits", ] - libs = ["hilog", "ipc_core", "utils"] } config("socketpair_all_dependent_config") { include_dirs = [ "export" ] } -ft_shared_library("socketpair") { +ohos_shared_library("socketpair") { sources = [ "src/local_socketpair.cpp" ] configs = [ ":socketpair_config" ] @@ -45,11 +44,20 @@ ft_shared_library("socketpair") { public_configs = [ ":socketpair_public_config" ] all_dependent_configs = [ ":socketpair_all_dependent_config" ] - deps = [ "//display_server/utils/scoped_bytrace:scoped_bytrace" ] + deps = [ "//foundation/graphic/graphic_2d/utils:scoped_bytrace" ] + + public_deps = [ + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + "//commonlibrary/c_utils/base:utils", + "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", + ] part_name = "graphic_standard" subsystem_name = "graphic" } +group("test") { + testonly = true + deps = [ "test:test" ] +} ## Build socketpair.so }}} - 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 0a0bb48d2170ac277e992ab98743ca64b179ae8c Mon Sep 17 00:00:00 2001 From: yanansong Date: Wed, 7 Jun 2023 17:59:40 +0800 Subject: [PATCH 3/3] fix email and comment --- build/prebuild.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build/prebuild.sh b/build/prebuild.sh index 988e704..91e0b3c 100755 --- a/build/prebuild.sh +++ b/build/prebuild.sh @@ -60,7 +60,6 @@ echo -e "\e[36m[-] Prepare system packages...\e[0m" python3 ${PROJECT_DIR}/build/builder.py check --install-packages $* # 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 @@ -72,12 +71,12 @@ sudo cp -fr *.so /usr/lib64 cd ${PROJECT_DIR} rm -fr ${PROJECT_DIR}/prebuilts/libs -# install prebuild include +# 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 +# copy include files to /usr/include. delete download files cd ${PROJECT_DIR}/prebuilts/inc sudo cp -fr * /usr/include cd ${PROJECT_DIR} -- Gitee