!267 chore(build): optimize build scripts

Merge pull request !267 from Caoruihong/support_gcc
This commit is contained in:
openharmony_ci
2021-12-08 07:20:41 +00:00
committed by Gitee
9 changed files with 223 additions and 85 deletions
+13 -74
View File
@@ -74,70 +74,6 @@ hdf_driver(module_name) {
"$HDF_FRAMEWORKS_PATH/utils/src/hdf_sbuf_impl_raw.c",
"$HDF_FRAMEWORKS_PATH/utils/src/hdf_slist.c",
"$HDF_FRAMEWORKS_PATH/utils/src/hdf_sref.c",
"manager/src/devmgr_pm_reg.c",
"osal/src/osal_cdev.c",
"osal/src/osal_file.c",
"osal/src/osal_firmware.c",
"osal/src/osal_irq.c",
"osal/src/osal_mem.c",
"osal/src/osal_mutex.c",
"osal/src/osal_sem.c",
"osal/src/osal_spinlock.c",
"osal/src/osal_thread.c",
"osal/src/osal_time.c",
"osal/src/osal_timer.c",
"osal/src/osal_workqueue.c",
]
if (defined(LOSCFG_NET_LWIP_SACK)) {
sources += [ "network/src/netbuf_adapter.c" ]
if (defined(LOSCFG_DRIVERS_HDF_WIFI)) {
sources += [ "network/src/net_device_adapter.c" ]
}
}
public_configs = [ ":public" ]
}
group("liteos") {
public_deps = [ ":$module_name" ]
deps = [
"model/audio",
"model/bus/usb",
"model/display",
"model/input",
"model/misc/dsoftbus",
"model/misc/vibrator",
"model/network/ethernet",
"model/network/wifi",
"model/sensor",
"model/storage",
"model/usb/device",
"model/usb/host",
"platform",
]
if (defined(LOSCFG_DRIVERS_HDF_TEST)) {
deps += [ "test" ]
}
}
config("public") {
include_dirs = [
"$HDF_FRAMEWORKS_PATH/core/common/include/manager",
"$HDF_FRAMEWORKS_PATH/include/utils",
"$HDF_FRAMEWORKS_PATH/utils/include",
"$HDF_FRAMEWORKS_PATH/include/osal",
"$HDF_FRAMEWORKS_PATH/model/storage/include",
"osal/include",
]
configs = [
"platform:public",
"model/bus/usb:public",
"model/usb/host:public",
"model/storage:public",
]
}
@@ -151,22 +87,25 @@ config("hdf_config") {
"$HDF_FRAMEWORKS_PATH/include/core",
"$HDF_FRAMEWORKS_PATH/include/net",
"$HDF_FRAMEWORKS_PATH/include/wifi",
"$HDF_FRAMEWORKS_PATH/model/network/common/netdevice",
"$HDF_FRAMEWORKS_PATH/model/storage/include",
"$HDF_FRAMEWORKS_PATH/model/storage/include/mmc",
"$HDF_FRAMEWORKS_PATH/model/storage/include/mtd",
"$HDF_FRAMEWORKS_PATH/core/host/include",
"$HDF_FRAMEWORKS_PATH/core/manager/include",
"$HDF_FRAMEWORKS_PATH/core/shared/include",
"$HDF_FRAMEWORKS_PATH/core/common/include/manager",
"$HDF_FRAMEWORKS_PATH/core/common/include/host",
"network/include",
"osal/include",
"platform/include",
"model/storage/include",
"model/storage/include/mmc",
"model/storage/include/mtd",
"$HDF_FRAMEWORKS_PATH/core/adapter/vnode/include",
"$HDF_FRAMEWORKS_PATH/core/adapter/syscall/include",
]
}
module_group("liteos") {
modules = [
"manager",
"model",
"network",
"osal",
"platform",
"test",
]
deps = [ ":$module_name" ]
configs = [ ":hdf_config" ]
}
+14 -5
View File
@@ -41,25 +41,33 @@ template("hdf_driver") {
if (module_switch && defined(invoker.hcs_sources) &&
!defined(invoker.sources)) {
hc_gen_hex("hc_gen") {
hc_gen_hex("${target_name}_hc_gen_hex") {
sources = invoker.hcs_sources
}
}
if (module_switch && defined(invoker.hcs_sources) &&
defined(invoker.sources) && defined(invoker.outputs)) {
hc_gen_macro("hc_gen_macro") {
hc_gen_macro("${target_name}_hc_gen_macro") {
sources = invoker.hcs_sources
outputs = invoker.outputs
}
}
kernel_module(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
forward_variables_from(invoker,
"*",
[
"configs",
"visibility",
])
if (defined(invoker.configs)) {
configs += invoker.configs
}
if (defined(invoker.visibility)) {
visibility += invoker.visibility
}
if (module_switch && defined(invoker.hcs_sources) &&
!defined(invoker.sources)) {
hc_gen = ":hc_gen"
hc_gen = ":${target_name}_hc_gen_hex"
generated_sources = get_target_outputs(hc_gen)
set_sources_assignment_filter([ "*.hcb" ])
if (defined(invoker.sources)) {
@@ -76,7 +84,7 @@ template("hdf_driver") {
}
if (module_switch && defined(invoker.hcs_sources) &&
defined(invoker.sources)) {
hc_gen_macro = ":hc_gen_macro"
hc_gen_macro = ":${target_name}_hc_gen_macro"
generated_include = get_path_info(get_target_outputs(hc_gen_macro), "dir")
if (defined(invoker.include_dirs)) {
include_dirs += generated_include
@@ -94,4 +102,5 @@ template("hdf_driver") {
set_defaults("hdf_driver") {
configs = [ "$HDFTOPDIR:hdf_config" ]
visibility = [ "$HDFTOPDIR:*" ]
}
+35
View File
@@ -0,0 +1,35 @@
# Copyright (c) 2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//drivers/adapter/khdf/liteos/hdf.gni")
module_switch = defined(LOSCFG_DRIVERS_HDF)
module_name = "hdf_manager"
hdf_driver(module_name) {
sources = [ "src/devmgr_pm_reg.c" ]
}
+46
View File
@@ -0,0 +1,46 @@
# Copyright (c) 2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//drivers/adapter/khdf/liteos/hdf.gni")
module_group("model") {
modules = [
"audio",
"bus/usb",
"display",
"input",
"misc/dsoftbus",
"misc/vibrator",
"network/ethernet",
"network/wifi",
"sensor",
"storage",
"usb/device",
"usb/host",
]
}
+4 -1
View File
@@ -28,10 +28,11 @@
import("//drivers/adapter/khdf/liteos/hdf.gni")
FRAMEWORKS_INPUT_ROOT = "$HDF_FRAMEWORKS_PATH/model/input/driver"
module_switch = defined(LOSCFG_DRIVERS_HDF_INPUT)
module_name = "hdf_input_driver"
hdf_driver(module_name) {
FRAMEWORKS_INPUT_ROOT = "$HDF_FRAMEWORKS_PATH/model/input/driver"
sources = [
"$FRAMEWORKS_INPUT_ROOT/event_hub.c",
"$FRAMEWORKS_INPUT_ROOT/hdf_hid_adapter.c",
@@ -49,7 +50,9 @@ hdf_driver(module_name) {
if (defined(LOSCFG_DRIVERS_HDF_TP_2P35_FT6236)) {
sources += [ "$FRAMEWORKS_INPUT_ROOT/touchscreen/touch_ft6336.c" ]
}
}
config("public") {
include_dirs = [
"$FRAMEWORKS_INPUT_ROOT",
"$FRAMEWORKS_INPUT_ROOT/input_bus_ops",
+2 -2
View File
@@ -35,8 +35,6 @@ hdf_driver(module_name) {
include_dirs = [ "//base/hiviewdfx/interfaces/kits" ]
deps = [ "//drivers/adapter/khdf/liteos/platform:hdf_platform" ]
sources = []
if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_MMC)) {
@@ -78,6 +76,8 @@ hdf_driver(module_name) {
config("public") {
include_dirs = [
"include",
"include/mmc",
"include/mtd",
"$HDF_FRAMEWORKS_PATH/model/storage/include",
"$HDF_FRAMEWORKS_PATH/model/storage/include/mmc",
"$HDF_FRAMEWORKS_PATH/model/storage/include/mtd",
+45
View File
@@ -0,0 +1,45 @@
# Copyright (c) 2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//drivers/adapter/khdf/liteos/hdf.gni")
module_switch = defined(LOSCFG_NET_LWIP_SACK)
module_name = "hdf_network"
hdf_driver(module_name) {
sources = [ "src/netbuf_adapter.c" ]
if (defined(LOSCFG_DRIVERS_HDF_WIFI)) {
sources += [ "src/net_device_adapter.c" ]
}
}
config("public") {
include_dirs = [
"include",
"$HDF_FRAMEWORKS_PATH/model/network/common/netdevice",
]
}
+52
View File
@@ -0,0 +1,52 @@
# Copyright (c) 2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//drivers/adapter/khdf/liteos/hdf.gni")
module_switch = defined(LOSCFG_DRIVERS_HDF)
module_name = "hdf_osal"
hdf_driver(module_name) {
sources = [
"src/osal_cdev.c",
"src/osal_file.c",
"src/osal_firmware.c",
"src/osal_irq.c",
"src/osal_mem.c",
"src/osal_mutex.c",
"src/osal_sem.c",
"src/osal_spinlock.c",
"src/osal_thread.c",
"src/osal_time.c",
"src/osal_timer.c",
"src/osal_workqueue.c",
]
}
config("public") {
include_dirs = [ "include" ]
}
+12 -3
View File
@@ -41,17 +41,25 @@ template("hdf_driver") {
}
if (module_switch && defined(invoker.hcs_sources)) {
hc_gen_hex("hc_gen") {
hc_gen_hex("${target_name}_hc_gen_hex") {
sources = invoker.hcs_sources
}
}
kernel_module(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
forward_variables_from(invoker,
"*",
[
"configs",
"visibility",
])
if (defined(invoker.configs)) {
configs += invoker.configs
}
if (defined(invoker.visibility)) {
visibility += invoker.visibility
}
if (module_switch && defined(invoker.hcs_sources)) {
hc_gen = ":hc_gen"
hc_gen = ":${target_name}_hc_gen_hex"
generated_sources = get_target_outputs(hc_gen)
set_sources_assignment_filter([ "*.hcb" ])
if (defined(invoker.sources)) {
@@ -70,4 +78,5 @@ template("hdf_driver") {
set_defaults("hdf_driver") {
configs = [ "$HDFTOPDIR:hdf_config" ]
visibility = [ "$HDFTOPDIR:*" ]
}