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 += [ "-fexceptions" ]
27}
28
29ohos_shared_library("print_service") {
30  sources = [
31    "src/hisys_event_util.cpp",
32    "src/operation_queue.cpp",
33    "src/print_bms_death_recipient.cpp",
34    "src/print_bms_helper.cpp",
35    "src/print_callback_proxy.cpp",
36    "src/print_event_subscriber.cpp",
37    "src/print_extension_callback_proxy.cpp",
38    "src/print_http_request_process.cpp",
39    "src/print_http_server_manager.cpp",
40    "src/print_ipp_over_usb_manager.cpp",
41    "src/print_security_guard_info.cpp",
42    "src/print_security_guard_manager.cpp",
43    "src/print_service_ability.cpp",
44    "src/print_service_converter.cpp",
45    "src/print_service_helper.cpp",
46    "src/print_service_stub.cpp",
47    "src/print_system_data.cpp",
48    "src/print_usb_manager.cpp",
49    "src/print_user_data.cpp",
50    "src/thread_sync_wait.cpp",
51    "src/vendor_bsuni_driver.cpp",
52    "src/vendor_driver_base.cpp",
53    "src/vendor_helper.cpp",
54    "src/vendor_ipp_everywhere.cpp",
55    "src/vendor_manager.cpp",
56  ]
57
58  branch_protector_ret = "pac_ret"
59  sanitize = {
60    cfi = true
61    cfi_cross_dso = true
62    boundary_sanitize = true
63    debug = false
64    integer_overflow = true
65    ubsan = true
66  }
67
68  public_configs = [
69    "${c_utils_path}/base:utils_config",
70    ":print_service_config",
71  ]
72  include_dirs = [
73    "${print_path}/frameworks/innerkitsimpl/print_impl/include",
74    "${print_path}/frameworks/ohprint/include",
75    "${print_utils_path}/include",
76  ]
77
78  deps = [ "${print_path}/frameworks/models/print_models:print_models" ]
79
80  external_deps = [
81    "ability_base:base",
82    "ability_base:want",
83    "ability_base:zuri",
84    "ability_runtime:ability_manager",
85    "ability_runtime:abilitykit_native",
86    "access_token:libaccesstoken_sdk",
87    "bundle_framework:appexecfwk_base",
88    "bundle_framework:appexecfwk_core",
89    "c_utils:utils",
90    "common_event_service:cesfwk_innerkits",
91    "drivers_interface_usb:libusb_proxy_1.0",
92    "eventhandler:libeventhandler",
93    "hilog:libhilog",
94    "hisysevent:libhisysevent",
95    "init:libbegetutil",
96    "ipc:ipc_core",
97    "napi:ace_napi",
98    "os_account:os_account_innerkits",
99    "safwk:system_ability_fwk",
100    "samgr:samgr_proxy",
101    "usb_manager:usbsrv_client",
102    "wifi:wifi_sdk",
103  ]
104
105  if (cups_enable) {
106    include_dirs += [ "//third_party/cups/cups-2.4.0" ]
107    sources += [
108      "src/print_cups_attribute.cpp",
109      "src/print_cups_client.cpp",
110      "src/print_cups_wrapper.cpp",
111    ]
112    cflags_cc += [ "-DCUPS_ENABLE" ]
113    deps += [
114      "//third_party/cups:third_party_cups",
115      "//third_party/cups-filters:third_party_cupsfilters",
116    ]
117    external_deps += [ "cJSON:cjson" ]
118  }
119
120  if (ipp_over_usb_enable) {
121    include_dirs += [ "//third_party/cpp-httplib" ]
122    sources += [
123      "src/print_http_request_process.cpp",
124      "src/print_http_server_manager.cpp",
125      "src/print_ipp_over_usb_manager.cpp",
126      "src/print_usb_manager.cpp",
127    ]
128    cflags_cc += [ "-DCPPHTTPLIB_NO_EXCEPTIONS" ]
129    cflags_cc += [ "-DCPPHTTPLIB_RECV_BUFSIZ=4096ul" ]
130    cflags_cc += [ "-DIPPOVERUSB_ENABLE" ]
131  }
132
133  if (security_guard_enabled) {
134    external_deps += [
135      "security_guard:libsg_collect_sdk",
136      "time_service:time_client",
137    ]
138
139    cflags_cc += [ "-DSECURITY_GUARDE_ENABLE" ]
140  }
141
142  if (build_variant == "user") {
143    cflags_cc += [ "-DIS_RELEASE_VERSION" ]
144  }
145
146  subsystem_name = "print"
147  part_name = "print_fwk"
148}
149