1# Copyright (c) 2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//base/print/print_fwk/print.gni")
15import("//build/ohos.gni")
16
17cflags_cc = []
18
19config("print_service_config") {
20  visibility = [ ":*" ]
21  include_dirs = [
22    "include",
23    "${print_path}/frameworks/models/print_models/include",
24  ]
25
26  cflags_cc += [
27    "-fno-exceptions",
28    "-fdata-sections",
29    "-ffunction-sections",
30    "-fno-asynchronous-unwind-tables",
31    "-fno-unwind-tables",
32    "-flto",
33    "--save-temps",
34    "-Os",
35  ]
36}
37
38ohos_shared_library("print_service") {
39  sources = [
40    "src/hisys_event_util.cpp",
41    "src/operation_queue.cpp",
42    "src/print_bms_death_recipient.cpp",
43    "src/print_bms_helper.cpp",
44    "src/print_callback_proxy.cpp",
45    "src/print_event_subscriber.cpp",
46    "src/print_extension_callback_proxy.cpp",
47    "src/print_http_request_process.cpp",
48    "src/print_http_server_manager.cpp",
49    "src/print_ipp_over_usb_manager.cpp",
50    "src/print_security_guard_info.cpp",
51    "src/print_security_guard_manager.cpp",
52    "src/print_service_ability.cpp",
53    "src/print_service_converter.cpp",
54    "src/print_service_helper.cpp",
55    "src/print_service_stub.cpp",
56    "src/print_system_data.cpp",
57    "src/print_usb_manager.cpp",
58    "src/print_user_data.cpp",
59    "src/thread_sync_wait.cpp",
60    "src/vendor_bsuni_driver.cpp",
61    "src/vendor_driver_base.cpp",
62    "src/vendor_driver_group.cpp",
63    "src/vendor_helper.cpp",
64    "src/vendor_ipp_everywhere.cpp",
65    "src/vendor_manager.cpp",
66    "src/vendor_ppd_driver.cpp",
67    "src/vendor_wlan_group.cpp",
68  ]
69
70  branch_protector_ret = "pac_ret"
71  sanitize = {
72    cfi = true
73    cfi_cross_dso = true
74    boundary_sanitize = true
75    debug = false
76    integer_overflow = true
77    ubsan = true
78  }
79
80  public_configs = [
81    "${c_utils_path}/base:utils_config",
82    ":print_service_config",
83  ]
84  include_dirs = [
85    "${print_path}/frameworks/innerkitsimpl/print_impl/include",
86    "${print_path}/frameworks/ohprint/include",
87    "${print_utils_path}/include",
88  ]
89
90  deps = [ "${print_path}/frameworks/models/print_models:print_models" ]
91
92  external_deps = [
93    "ability_base:base",
94    "ability_base:want",
95    "ability_base:zuri",
96    "ability_runtime:ability_manager",
97    "ability_runtime:abilitykit_native",
98    "access_token:libaccesstoken_sdk",
99    "bundle_framework:appexecfwk_base",
100    "bundle_framework:appexecfwk_core",
101    "c_utils:utils",
102    "common_event_service:cesfwk_innerkits",
103    "drivers_interface_usb:libusb_proxy_1.0",
104    "eventhandler:libeventhandler",
105    "hilog:libhilog",
106    "hisysevent:libhisysevent",
107    "init:libbegetutil",
108    "ipc:ipc_core",
109    "napi:ace_napi",
110    "os_account:os_account_innerkits",
111    "safwk:system_ability_fwk",
112    "samgr:samgr_proxy",
113    "usb_manager:usbsrv_client",
114    "wifi:wifi_sdk",
115  ]
116
117  if (cups_enable) {
118    include_dirs += [ "//third_party/cups/cups-2.4.0" ]
119    sources += [
120      "src/print_cups_attribute.cpp",
121      "src/print_cups_client.cpp",
122      "src/print_cups_wrapper.cpp",
123    ]
124    cflags_cc += [ "-DCUPS_ENABLE" ]
125    deps += [
126      "//third_party/cups:third_party_cups",
127      "//third_party/cups-filters:third_party_cupsfilters",
128    ]
129    external_deps += [ "cJSON:cjson" ]
130  }
131
132  if (ipp_over_usb_enable) {
133    include_dirs += [ "//third_party/cpp-httplib" ]
134    sources += [
135      "src/print_http_request_process.cpp",
136      "src/print_http_server_manager.cpp",
137      "src/print_ipp_over_usb_manager.cpp",
138      "src/print_usb_manager.cpp",
139    ]
140    cflags_cc += [ "-DCPPHTTPLIB_NO_EXCEPTIONS" ]
141    cflags_cc += [ "-DCPPHTTPLIB_RECV_BUFSIZ=4096ul" ]
142    cflags_cc += [ "-DIPPOVERUSB_ENABLE" ]
143  }
144
145  if (security_guard_enabled) {
146    external_deps += [
147      "security_guard:libsg_collect_sdk",
148      "time_service:time_client",
149    ]
150
151    cflags_cc += [ "-DSECURITY_GUARDE_ENABLE" ]
152  }
153
154  if (build_variant == "user") {
155    cflags_cc += [ "-DIS_RELEASE_VERSION" ]
156  }
157
158  subsystem_name = "print"
159  part_name = "print_fwk"
160}
161