diff --git a/.gn b/.gn new file mode 100644 index 0000000000000000000000000000000000000000..10d86795bea852279c227ea3a02a8c8f586bb48b --- /dev/null +++ b/.gn @@ -0,0 +1 @@ +buildconfig = "//build/BUILDCONFIG.gn" diff --git a/BUILD.gn b/BUILD.gn new file mode 120000 index 0000000000000000000000000000000000000000..8bdffaafd2ea295859b3fe759632df545d0f5987 --- /dev/null +++ b/BUILD.gn @@ -0,0 +1 @@ +build/gn/BUILD.gn \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 120000 index 0000000000000000000000000000000000000000..1698326c584e733cf45d47a12b25b6238958f3e1 --- /dev/null +++ b/build.sh @@ -0,0 +1 @@ +build/build.sh \ No newline at end of file diff --git a/build/build.sh b/build/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..48c0777a563e1cc82dfe2c98123b6b0d914b1106 --- /dev/null +++ b/build/build.sh @@ -0,0 +1,46 @@ +# Copyright (c) 2023 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. + +set +e + +# Get project dir +SCRIPT_DIR=$(cd $(dirname $0); pwd) +SCRIPT_BASE_DIR=$(basename "$SCRIPT_DIR") + +if [[ $SCRIPT_BASE_DIR == "build" ]]; then + echo -e "\033[31m[!] Please exec \"build.sh\" at project root dir.\033[0m" + exit 1 +else + PROJECT_DIR=$SCRIPT_DIR + while [[ ! -f "${SCRIPT_DIR}/.gn" ]]; do + SCRIPT_DIR="$(dirname "${SCRIPT_DIR}")" + if [[ "${SCRIPT_DIR}" == "/" ]]; then + echo -e "\033[31m[!] Cannot find project root dir from $(pwd)\033[0m" + exit 1 + fi + done +fi + +if [[ "${PROJECT_DIR}x" == "x" ]]; then + echo "\033[31m[!] project root dir cannot be empty.\033[0m" + exit 1 +fi + +# Exec builder + +# Check builder result +if [[ "$?" -ne 0 ]]; then + echo -e "\033[31m[!] Build failed.\033[0m" + exit 1 +fi +echo -e "\033[0;32m[-] Build done.\033[0m" diff --git a/build/gn/BUILD.gn b/build/gn/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c6e020f8fdde0fdda1fde9f09261a13af0005e75 --- /dev/null +++ b/build/gn/BUILD.gn @@ -0,0 +1,15 @@ +# Copyright (c) 2023 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. + +group("ft_engine") { +} diff --git a/build/gn/BUILDCONFIG.gn b/build/gn/BUILDCONFIG.gn new file mode 100644 index 0000000000000000000000000000000000000000..268a845a901f60c7e86161c0059b00d4625ba568 --- /dev/null +++ b/build/gn/BUILDCONFIG.gn @@ -0,0 +1,147 @@ +# Copyright (c) 2023 Huawei Technologies Co., Ltd. All rights reserved. +# 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 + +print("[GN INFO] host_os :", host_os) +print("[GN INFO] host_cpu :", host_cpu) + +if (target_os == "") { + target_os = host_os +} else { + print("[GN INFO] target_os :", target_os) +} + +if (host_os != "linux" || target_os != "linux") { + assert(false, "[GN ERROR] current only supported linux os") +} + +if (target_cpu == "") { + target_cpu = host_cpu +} else { + print("[GN INFO] target_cpu :", target_cpu) +} + +if (current_os == "") { + current_os = target_os +} else { + print("[GN INFO] current_os :", current_os) +} + +if (current_cpu == "") { + current_cpu = target_cpu +} else { + print("[GN INFO] current_cpu :", current_cpu) +} + +declare_args() { + # We add this parameter to speed up link process, enable_lto_O0 default is false. + enable_lto_O0 = false + + # Set to true when compiling with the Clang compiler + is_clang = true + + # Allows the path to a custom target toolchain to be injected as a single + # argument, and set as the default toolchain. + custom_toolchain = "" + + # This should not normally be set as a build argument. It's here so that + # every toolchain can pass through the "global" value via toolchain_args(). + host_toolchain = "" + + use_musl = false + use_musl_oh = false + + # Debug build. Enabling official builds automatically sets is_debug to false. + is_debug = true + ft_full_debug = true + + project_root_dir = "" + + is_ft_build = current_os == "linux" +} + +if (use_musl_oh == true) { + assert(use_musl, "[GN ERROR] use_musl_oh = true, but use_musl = false") +} + +# TOOLCHAIN SETUP +if (host_toolchain == "") { + if (is_clang) { + host_toolchain = "//build/gn/toolchain/linux:clang_$host_cpu" + } else { + host_toolchain = "//build/gn/toolchain/linux:$host_cpu" + } +} + +if (is_clang) { + _default_toolchain = "//build/gn/toolchain/linux:clang_$target_cpu" +} else { + assert(false, + "[GN ERROR] Unsupported all compilers except clang currently.") + # _default_toolchain = "//build/gn/toolchain/linux:gcc_$target_cpu" +} + +if (_default_toolchain != "") { + set_default_toolchain(_default_toolchain) +} + +# TARGET DEFAULTS CONFIGS +default_compiler_configs = [ + "//build/gn/configs/compiler:compiler", + "//build/gn/configs/compiler:runtime_library", + # Default Optimization level + "//build/gn/configs/compiler:default_optimization", + "//build/gn/configs/compiler:default_stack_frames", + # Default Symbol level + "//build/gn/configs/compiler:default_symbols", + "//build/gn/configs/compiler:no_common", + # Other + "//build/gn/configs/compiler:export_dynamic", + "//build/gn/configs/compiler:no_exceptions", + "//build/gn/configs/compiler:no_rtti", + "//build/gn/configs/compiler:thin_archive", +] + +# Debug/release-related defines. +if (is_debug) { + default_compiler_configs += [ "//build/gn/configs:debug" ] +} else { + default_compiler_configs += [ "//build/gn/configs:release" ] +} + +# Static libraries and source sets use only the compiler ones. +set_defaults("static_library") { + configs = default_compiler_configs +} +set_defaults("source_set") { + configs = default_compiler_configs +} + +# Executable defaults. +default_executable_configs = default_compiler_configs + [ + "//build/gn/configs:default_libs", + "//build/gn/configs:executable_config" +] + +set_defaults("executable") { + configs = default_executable_configs +} + +# Shared library and loadable module defaults (also for components in component mode). +default_shared_library_configs = default_compiler_configs + [ + "//build/gn/configs:default_libs", + "//build/gn/configs:shared_library_config" +] + +set_defaults("shared_library") { + configs = default_shared_library_configs +} diff --git a/display_server/README.md b/display_server/README.md new file mode 100644 index 0000000000000000000000000000000000000000..bca95bfeef1ef05f086c6d413652af9b67f00cfe --- /dev/null +++ b/display_server/README.md @@ -0,0 +1,4 @@ +# display_server + +#### 介绍 +display server目录是 ft engine 的显示服务部分。 diff --git a/window_manager/README.md b/window_manager/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d3f1e226fcef590fa53cecc6f7991b975447a856 --- /dev/null +++ b/window_manager/README.md @@ -0,0 +1,4 @@ +# window_manager + +#### 介绍 +window_manager目录是 ft engine 的窗口管理部分。