From 4e14c555faa097fecad091bddfd2e873afbd2e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=98=8A=E8=8B=8F?= Date: Sat, 25 May 2024 12:03:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EBUILD.gn=E5=92=8Cbundle.json?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20Signed-off-by:liuhaosu@huawei.com?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘昊苏 --- BUILD.gn | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++++ bundle.json | 39 ++++++++++ 2 files changed, 241 insertions(+) create mode 100644 BUILD.gn create mode 100644 bundle.json diff --git a/BUILD.gn b/BUILD.gn new file mode 100644 index 000000000..ba4ac611b --- /dev/null +++ b/BUILD.gn @@ -0,0 +1,202 @@ +#Copyright (c) 2024 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/ohos.gni") + +SANE_CONFIG_DIR = "/data/service/el1/public/print_service/sane/config" +SANE_DATA_DIR = "/data/service/el1/public/print_service/sane/data" +SANE_LOCK_DIR = "/data/service/el1/public/print_service/sane/lock" +SANE_V_MAJOR = 1 +SANE_V_MINOR = 2 +SANE_LIB_DIR = "/data/service/el1/public/print_service/sane/backend" +enable_hilog = true + +base_deps = [ + "//third_party/libusb:libusb", + "//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/libusb/libusb-1.0.26/libusb", + "//third_party/libpng/libpng-1.6.37" + ] + + cflags = [ + "-Wall", + "-g", + "-O2", + "-fPIC", + "-DPIC", + "-D_REENTRANT", + "-DHAVE_CONFIG_H", + "-Wno-format", + "-Wno-unused-const-variable", + "-Wno-unused-variable", + "-Wno-unused-but-set-variable", + ] + + if (enable_hilog) { + cflags += [ "-DENABLE_HILOG" ] + } + + defines = [ + "PATH_SANE_CONFIG_DIR=$SANE_CONFIG_DIR", + "PATH_SANE_DATA_DIR=$SANE_DATA_DIR", + "PATH_SANE_LOCK_DIR=$SANE_LOCK_DIR", + "V_MAJOR=$SANE_V_MAJOR", + "V_MINOR=$SANE_V_MINOR", + ] +} + +config("backend_config") { + configs = [":base_config"] + + defines = ["LIBDIR=\"$SANE_LIB_DIR\""] +} + +#build targets in /lib +ohos_source_set("lib") { + sources = ["./lib/md5.c"] + + configs = [":base_config"] + + deps = base_deps + + subsystem_name = "thirdparty" + part_name = "backends" +} + +#build targets in /sanei +sanei_names = [ + "sanei_directio", + "sanei_ab306", + "sanei_constrain_value", + "sanei_init_debug", + "sanei_net", + "sanei_wire", + "sanei_codec_ascii", + "sanei_codec_bin", + "sanei_scsi", + "sanei_config", + "sanei_config2", + "sanei_pio", + "sanei_pa4s2", + "sanei_auth", + "sanei_usb", + "sanei_thread", + "sanei_pv8630", + "sanei_pp", + "sanei_lm983x", + "sanei_access", + "sanei_tcp", + "sanei_udp", + "sanei_magic", + "sanei_ir", + "sanei_jpeg", +] + +foreach (name, sanei_names) { + ohos_source_set("$name") { + sources = ["./sanei/$name.c"] + + deps = base_deps + + if (enable_hilog) { + external_deps = [ + "hilog:libhilog", + ] + } + + configs = [":base_config"] + + subsystem_name = "thirdparty" + part_name = "backends" + } +} + +ohos_static_library("sanei") { + sources = [] + + foreach(name, sanei_names) { + sources += ["./sanei/$name.c"] + } + + if (enable_hilog) { + external_deps = [ + "hilog:libhilog", + ] + } + + configs = [":base_config"] + + subsystem_name = "thirdparty" + part_name = "backends" +} + +#build targets in /backend +ohos_source_set("sane_strstatus") { + sources = ["./backend/sane_strstatus.c"] + + configs = [":backend_config"] + + subsystem_name = "thirdparty" + part_name = "backends" +} + +ohos_shared_library("sane") { + sources = [ + "./backend/stubs.c", + "./backend/dll.c", + ] + + configs = [":backend_config"] + + defines = ["BACKEND_NAME=dll"] + + deps = [ + ":sanei_init_debug", + ":sanei_constrain_value", + ":sanei_config", + ":sane_strstatus", + ":sanei_usb", + ":lib", + ] + + deps += base_deps + + if (enable_hilog) { + external_deps = [ + "hilog:libhilog", + ] + } + + ldflags = ["-ldl"] + + subsystem_name = "thirdparty" + part_name = "backends" +} + +#the target group +group("third_sane") { + deps = [ + ":sane" + ] +} \ No newline at end of file diff --git a/bundle.json b/bundle.json new file mode 100644 index 000000000..a13a0ff14 --- /dev/null +++ b/bundle.json @@ -0,0 +1,39 @@ +{ + "name": "@ohos/backends", + "description": "backends(Scanner Access Now Easy) is a framework for standardized access to any raster scanner", + "version": "1.1.1", + "license": "GPL v2", + "publishAs": "code-segment", + "segment": { + "destPath": "third_party/backends" + }, + "dirs": {}, + "scripts": {}, + "component": { + "name": "backends", + "subsystem": "thirdparty", + "syscap": [], + "features": [], + "adapted_system_type": [], + "rom": "10KB", + "ram": "10KB", + "deps": { + "components": [ + "hilog" + ], + "third_party": [ + "libusb", + "libxml2", + "libpng", + "libjpeg-turbo" + ] + }, + "build": { + "sub_component": [ + "//third_party/backends:third_sane" + ], + "inner_kits": [], + "test": [] + } + } +} \ No newline at end of file -- Gitee