# Copyright (c) 2025 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")
import("//build/templates/rust/rust_cxx.gni")
import("../companion_device_auth.gni")
import("BUILD.gni")
config("service_config") {
include_dirs = companion_device_auth_service_include_dirs
}
config("optimize_for_size") {
cflags = [ "-Oz" ]
}
ohos_shared_library("companiondeviceauthservice") {
sanitize = companion_device_auth_default_sanitize
branch_protector_ret = "pac_ret"
sources = companion_device_auth_service_sources
configs = [
":service_config",
":optimize_for_size",
]
cflags = companion_device_auth_service_flags
deps = companion_device_auth_service_deps
external_deps = companion_device_auth_service_external_deps
if (use_musl) {
version_script = "companion_device_auth_service_map"
}
subsystem_name = companion_device_auth_subsystem_name
part_name = companion_device_auth_part_name
}
group("companion_device_auth_service_group") {
if (!companion_device_auth_has_ext) {
deps = [ ":companiondeviceauthservice" ]
} else {
deps = []
}
}
ohos_static_library("companion_device_auth_service_static") {
sanitize = companion_device_auth_default_sanitize
branch_protector_ret = "pac_ret"
sources = companion_device_auth_service_static_sources
sources += [ "${companion_device_auth_path}/common/src/iam_log_tracer.cpp" ]
public_configs = [
":service_config",
"${companion_device_auth_path}/frameworks/native/ipc:companion_device_auth_native_ipc_config",
"${companion_device_auth_path}/common:companion_device_auth_common_config",
]
configs = [ ":optimize_for_size" ]
# Add flag for static library compilation
cflags = companion_device_auth_service_flags + [ "-DSTATIC_LIBRARY" ]
deps = companion_device_auth_service_deps
external_deps = companion_device_auth_service_external_deps
subsystem_name = companion_device_auth_subsystem_name
part_name = companion_device_auth_part_name
}
ohos_static_library("companion_device_auth_service_header_static") {
sanitize = companion_device_auth_default_sanitize
branch_protector_ret = "pac_ret"
public_configs = [
":service_config",
"${companion_device_auth_path}/frameworks/native/ipc:companion_device_auth_native_ipc_config",
"${companion_device_auth_path}/common:companion_device_auth_common_config",
]
configs = [ ":optimize_for_size" ]
# Add flag for static library compilation
cflags = companion_device_auth_service_flags + [ "-DSTATIC_LIBRARY" ]
deps = companion_device_auth_service_deps
external_deps = companion_device_auth_service_external_deps
subsystem_name = companion_device_auth_subsystem_name
part_name = companion_device_auth_part_name
}