From 693fca762f77f101bf9d58d98e922174d8e3d229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=98=8A=E8=8B=8F?= Date: Fri, 6 Sep 2024 11:42:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9BUILD.gn=20Signed-off-by:liuh?= =?UTF-8?q?aosu@huawei.com?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘昊苏 --- BUILD.gn | 101 +++++++++++++++++++--------------------------------- bundle.json | 8 ++--- 2 files changed, 39 insertions(+), 70 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index b5b262367..602a3c529 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -26,7 +26,7 @@ target_dir = "${target_gen_dir}/sane" backends_usb_manager_source_file = [ "$target_dir/src/sanei_usb.c", - "$target_dir/src/usb_manager.cpp" + "$target_dir/src/usb_manager.cpp", ] backends_usb_header_file = [ @@ -52,22 +52,13 @@ action("backends_action") { ] } -base_deps = [ - "//third_party/libxml2:xml2", - "//third_party/libpng:libpng", - "//third_party/libjpeg-turbo:turbojpeg", -] - config("base_config") { include_dirs = [ ".", "./include", "./include/sane", - "//third_party/libxml2/libxml2-2.9.14/include", - "//third_party/libjpeg-turbo", - "//third_party/libpng/libpng-1.6.37" ] - + cflags = [ "-Wall", "-g", @@ -97,18 +88,16 @@ config("base_config") { } config("backend_config") { - configs = [":base_config"] + configs = [ ":base_config" ] - defines = ["LIBDIR=\"$SANE_LIB_DIR\""] + defines = [ "LIBDIR=\"$SANE_LIB_DIR\"" ] } #build targets in /lib ohos_source_set("lib") { - sources = ["./lib/md5.c"] - - configs = [":base_config"] + sources = [ "./lib/md5.c" ] - deps = base_deps + configs = [ ":base_config" ] subsystem_name = "thirdparty" part_name = "backends" @@ -142,19 +131,15 @@ sanei_names = [ "sanei_jpeg", ] -foreach (name, sanei_names) { +foreach(name, sanei_names) { ohos_source_set("$name") { - sources = ["./sanei/$name.c"] - - deps = base_deps + sources = [ "./sanei/$name.c" ] if (enable_hilog) { - external_deps = [ - "hilog:libhilog", - ] + external_deps = [ "hilog:libhilog" ] } - configs = [":base_config"] + configs = [ ":base_config" ] subsystem_name = "thirdparty" part_name = "backends" @@ -162,27 +147,23 @@ foreach (name, sanei_names) { } ohos_source_set("sanei_usb") { - include_dirs = [ - "$target_dir/include" - ] + include_dirs = [ "$target_dir/include" ] sources = [ "$target_dir/src/sanei_usb.c", - "$target_dir/src/usb_manager.cpp" + "$target_dir/src/usb_manager.cpp", ] - deps = base_deps - deps += [ - ":backends_action" - ] + deps = [ ":backends_action" ] external_deps = [ + "bounds_checking_function:libsec_shared", "c_utils:utils", "hilog:libhilog", + "libxml2:libxml2", "usb_manager:usbsrv_client", - "bounds_checking_function:libsec_shared" ] - configs = [":base_config"] + configs = [ ":base_config" ] subsystem_name = "thirdparty" part_name = "backends" @@ -192,16 +173,14 @@ ohos_static_library("sanei") { sources = [] foreach(name, sanei_names) { - sources += ["./sanei/$name.c"] + sources += [ "./sanei/$name.c" ] } if (enable_hilog) { - external_deps = [ - "hilog:libhilog", - ] + external_deps = [ "hilog:libhilog" ] } - - configs = [":base_config"] + + configs = [ ":base_config" ] subsystem_name = "thirdparty" part_name = "backends" @@ -209,9 +188,9 @@ ohos_static_library("sanei") { #build targets in /backend ohos_source_set("sane_strstatus") { - sources = ["./backend/sane_strstatus.c"] - - configs = [":backend_config"] + sources = [ "./backend/sane_strstatus.c" ] + + configs = [ ":backend_config" ] subsystem_name = "thirdparty" part_name = "backends" @@ -219,32 +198,28 @@ ohos_source_set("sane_strstatus") { ohos_shared_library("sane") { sources = [ - "./backend/stubs.c", "./backend/dll.c", + "./backend/stubs.c", ] - - configs = [":backend_config"] - - defines = ["BACKEND_NAME=dll"] + + configs = [ ":backend_config" ] + + defines = [ "BACKEND_NAME=dll" ] deps = [ - ":sanei_init_debug", - ":sanei_constrain_value", - ":sanei_config", + ":lib", ":sane_strstatus", + ":sanei_config", + ":sanei_constrain_value", + ":sanei_init_debug", ":sanei_usb", - ":lib", ] - deps += base_deps - if (enable_hilog) { - external_deps = [ - "hilog:libhilog", - ] + external_deps = [ "hilog:libhilog" ] } - - ldflags = ["-ldl"] + + ldflags = [ "-ldl" ] subsystem_name = "thirdparty" part_name = "backends" @@ -252,7 +227,5 @@ ohos_shared_library("sane") { #the target group group("third_sane") { - deps = [ - ":sane" - ] -} \ No newline at end of file + deps = [ ":sane" ] +} diff --git a/bundle.json b/bundle.json index d76129bd4..14586538f 100644 --- a/bundle.json +++ b/bundle.json @@ -22,12 +22,8 @@ "hilog", "usb_manager", "bounds_checking_function", - "c_utils" - ], - "third_party": [ - "libxml2", - "libpng", - "libjpeg-turbo" + "c_utils", + "libxml2" ] }, "build": { -- Gitee