15c735df2Sopenharmony_ci# Copyright (C) 2022-2023 Huawei Device Co., Ltd.
25c735df2Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
35c735df2Sopenharmony_ci# you may not use this file except in compliance with the License.
45c735df2Sopenharmony_ci# You may obtain a copy of the License at
55c735df2Sopenharmony_ci#
65c735df2Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
75c735df2Sopenharmony_ci#
85c735df2Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
95c735df2Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
105c735df2Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
115c735df2Sopenharmony_ci# See the License for the specific language governing permissions and
125c735df2Sopenharmony_ci# limitations under the License.
135c735df2Sopenharmony_ci
145c735df2Sopenharmony_ciimport("//base/location/config.gni")
155c735df2Sopenharmony_ciimport("//build/ohos.gni")
165c735df2Sopenharmony_ci
175c735df2Sopenharmony_ciif (location_feature_with_gnss) {
185c735df2Sopenharmony_ci  local_base_sources = [
195c735df2Sopenharmony_ci    "$LOCATION_GNSS_ROOT/source/agnss_event_callback.cpp",
205c735df2Sopenharmony_ci    "$LOCATION_GNSS_ROOT/source/agnss_ni_manager.cpp",
215c735df2Sopenharmony_ci    "$LOCATION_GNSS_ROOT/source/geofence_event_callback.cpp",
225c735df2Sopenharmony_ci    "$LOCATION_GNSS_ROOT/source/gnss_ability.cpp",
235c735df2Sopenharmony_ci    "$LOCATION_GNSS_ROOT/source/gnss_ability_skeleton.cpp",
245c735df2Sopenharmony_ci    "$LOCATION_GNSS_ROOT/source/gnss_common_event_subscriber.cpp",
255c735df2Sopenharmony_ci    "$LOCATION_GNSS_ROOT/source/gnss_event_callback.cpp",
265c735df2Sopenharmony_ci    "$LOCATION_GNSS_ROOT/source/ntp/elapsed_real_time_check.cpp",
275c735df2Sopenharmony_ci    "$LOCATION_GNSS_ROOT/source/ntp/gps_time_manager.cpp",
285c735df2Sopenharmony_ci    "$LOCATION_GNSS_ROOT/source/ntp/net_conn_observer.cpp",
295c735df2Sopenharmony_ci    "$LOCATION_GNSS_ROOT/source/ntp/ntp_time_check.cpp",
305c735df2Sopenharmony_ci    "$LOCATION_GNSS_ROOT/source/ntp/ntp_time_helper.cpp",
315c735df2Sopenharmony_ci    "$LOCATION_GNSS_ROOT/source/ntp/time_manager.cpp",
325c735df2Sopenharmony_ci    "$LOCATION_GNSS_ROOT/source/string_utils.cpp",
335c735df2Sopenharmony_ci    "$LOCATION_LOCATOR_ROOT/source/location_config_manager.cpp",
345c735df2Sopenharmony_ci    "$LOCATION_LOCATOR_ROOT/source/subability_common.cpp",
355c735df2Sopenharmony_ci    "$LOCATION_LOCATOR_ROOT/source/work_record.cpp",
365c735df2Sopenharmony_ci    "$LOCATION_LOCATOR_ROOT/source/work_record_statistic.cpp",
375c735df2Sopenharmony_ci  ]
385c735df2Sopenharmony_ci
395c735df2Sopenharmony_ci  ohos_shared_library("lbsservice_gnss") {
405c735df2Sopenharmony_ci    sources = local_base_sources
415c735df2Sopenharmony_ci
425c735df2Sopenharmony_ci    include_dirs = [
435c735df2Sopenharmony_ci      "$LOCATION_ROOT_DIR/interfaces/inner_api/include",
445c735df2Sopenharmony_ci      "$LOCATION_GNSS_ROOT/include",
455c735df2Sopenharmony_ci      "$LOCATION_GNSS_ROOT/include/ntp",
465c735df2Sopenharmony_ci      "$LOCATION_LOCATOR_ROOT/include",
475c735df2Sopenharmony_ci    ]
485c735df2Sopenharmony_ci
495c735df2Sopenharmony_ci    sanitize = {
505c735df2Sopenharmony_ci      cfi = true
515c735df2Sopenharmony_ci      cfi_cross_dso = true
525c735df2Sopenharmony_ci      debug = false
535c735df2Sopenharmony_ci    }
545c735df2Sopenharmony_ci    branch_protector_ret = "pac_ret"
555c735df2Sopenharmony_ci
565c735df2Sopenharmony_ci    deps = [
575c735df2Sopenharmony_ci      "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
585c735df2Sopenharmony_ci      "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
595c735df2Sopenharmony_ci      "$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk",
605c735df2Sopenharmony_ci    ]
615c735df2Sopenharmony_ci
625c735df2Sopenharmony_ci    external_deps = [
635c735df2Sopenharmony_ci      "ability_base:want",
645c735df2Sopenharmony_ci      "eventhandler:libeventhandler",
655c735df2Sopenharmony_ci      "ffrt:libffrt",
665c735df2Sopenharmony_ci      "hdf_core:libhdi",
675c735df2Sopenharmony_ci      "hilog:libhilog",
685c735df2Sopenharmony_ci      "ipc:ipc_single",
695c735df2Sopenharmony_ci      "relational_store:native_rdb",
705c735df2Sopenharmony_ci      "safwk:system_ability_fwk",
715c735df2Sopenharmony_ci      "samgr:samgr_proxy",
725c735df2Sopenharmony_ci    ]
735c735df2Sopenharmony_ci
745c735df2Sopenharmony_ci    defines = []
755c735df2Sopenharmony_ci
765c735df2Sopenharmony_ci    ldflags = [
775c735df2Sopenharmony_ci      "-Wl,--as-needed",
785c735df2Sopenharmony_ci      "-Wl,--gc-sections",
795c735df2Sopenharmony_ci    ]
805c735df2Sopenharmony_ci
815c735df2Sopenharmony_ci    cflags_cc = [
825c735df2Sopenharmony_ci      "-ffunction-sections",
835c735df2Sopenharmony_ci      "-fdata-sections",
845c735df2Sopenharmony_ci      "-flto=thin",
855c735df2Sopenharmony_ci      "-Os",
865c735df2Sopenharmony_ci    ]
875c735df2Sopenharmony_ci
885c735df2Sopenharmony_ci    if (telephony_core_service_enable) {
895c735df2Sopenharmony_ci      external_deps += [ "core_service:tel_core_service_api" ]
905c735df2Sopenharmony_ci      defines += [ "TEL_CORE_SERVICE_ENABLE" ]
915c735df2Sopenharmony_ci    }
925c735df2Sopenharmony_ci
935c735df2Sopenharmony_ci    if (telephony_cellular_data_enable) {
945c735df2Sopenharmony_ci      external_deps += [ "cellular_data:tel_cellular_data_api" ]
955c735df2Sopenharmony_ci      defines += [ "TEL_CELLULAR_DATA_ENABLE" ]
965c735df2Sopenharmony_ci    }
975c735df2Sopenharmony_ci
985c735df2Sopenharmony_ci    if (hdf_drivers_interface_location_agnss_enable) {
995c735df2Sopenharmony_ci      external_deps +=
1005c735df2Sopenharmony_ci          [ "drivers_interface_location_agnss:liblocation_agnss_proxy_2.0" ]
1015c735df2Sopenharmony_ci      defines += [ "HDF_DRIVERS_INTERFACE_AGNSS_ENABLE" ]
1025c735df2Sopenharmony_ci    }
1035c735df2Sopenharmony_ci
1045c735df2Sopenharmony_ci    if (location_feature_with_gnss &&
1055c735df2Sopenharmony_ci        hdf_drivers_interface_location_gnss_enable) {
1065c735df2Sopenharmony_ci      external_deps +=
1075c735df2Sopenharmony_ci          [ "drivers_interface_location_gnss:liblocation_gnss_proxy_2.0" ]
1085c735df2Sopenharmony_ci      defines += [ "FEATURE_GNSS_SUPPORT" ]
1095c735df2Sopenharmony_ci    }
1105c735df2Sopenharmony_ci
1115c735df2Sopenharmony_ci    if (location_feature_with_passive) {
1125c735df2Sopenharmony_ci      defines += [ "FEATURE_PASSIVE_SUPPORT" ]
1135c735df2Sopenharmony_ci    }
1145c735df2Sopenharmony_ci
1155c735df2Sopenharmony_ci    if (communication_wifi_enable) {
1165c735df2Sopenharmony_ci      external_deps += [ "wifi:wifi_sdk" ]
1175c735df2Sopenharmony_ci      defines += [ "WIFI_ENABLE" ]
1185c735df2Sopenharmony_ci    }
1195c735df2Sopenharmony_ci
1205c735df2Sopenharmony_ci    if (call_manager_enable) {
1215c735df2Sopenharmony_ci      external_deps += [ "call_manager:tel_call_manager_api" ]
1225c735df2Sopenharmony_ci      defines += [ "CALL_MANAGER_ENABLE" ]
1235c735df2Sopenharmony_ci    }
1245c735df2Sopenharmony_ci
1255c735df2Sopenharmony_ci    if (common_event_service_enable) {
1265c735df2Sopenharmony_ci      external_deps += [
1275c735df2Sopenharmony_ci        "ability_runtime:extension_manager",
1285c735df2Sopenharmony_ci        "common_event_service:cesfwk_innerkits",
1295c735df2Sopenharmony_ci      ]
1305c735df2Sopenharmony_ci      defines += [ "COMMON_EVENT_SERVICE_ENABLE" ]
1315c735df2Sopenharmony_ci    }
1325c735df2Sopenharmony_ci
1335c735df2Sopenharmony_ci    if (sms_mms_enable) {
1345c735df2Sopenharmony_ci      external_deps += [ "sms_mms:tel_sms_mms_api" ]
1355c735df2Sopenharmony_ci      defines += [ "SMS_MMS_ENABLE" ]
1365c735df2Sopenharmony_ci    }
1375c735df2Sopenharmony_ci
1385c735df2Sopenharmony_ci    if (notification_distributed_notification_service_enable) {
1395c735df2Sopenharmony_ci      defines += [ "NOTIFICATION_ENABLE" ]
1405c735df2Sopenharmony_ci    }
1415c735df2Sopenharmony_ci
1425c735df2Sopenharmony_ci    if (hdf_drivers_interface_location_geofence_enable) {
1435c735df2Sopenharmony_ci      external_deps += [
1445c735df2Sopenharmony_ci        "drivers_interface_location_geofence:liblocation_geofence_proxy_2.0",
1455c735df2Sopenharmony_ci      ]
1465c735df2Sopenharmony_ci      defines += [ "HDF_DRIVERS_INTERFACE_GEOFENCE_ENABLE" ]
1475c735df2Sopenharmony_ci    }
1485c735df2Sopenharmony_ci
1495c735df2Sopenharmony_ci    if (time_service_enable) {
1505c735df2Sopenharmony_ci      external_deps += [ "time_service:time_client" ]
1515c735df2Sopenharmony_ci      defines += [ "TIME_SERVICE_ENABLE" ]
1525c735df2Sopenharmony_ci    }
1535c735df2Sopenharmony_ci
1545c735df2Sopenharmony_ci    if (net_manager_enable) {
1555c735df2Sopenharmony_ci      external_deps += [ "netmanager_base:net_conn_manager_if" ]
1565c735df2Sopenharmony_ci      defines += [ "NET_MANAGER_ENABLE" ]
1575c735df2Sopenharmony_ci    }
1585c735df2Sopenharmony_ci
1595c735df2Sopenharmony_ci    # Used to control the export of dynamic library symbols.
1605c735df2Sopenharmony_ci    version_script = "liblbsservice_gnss_version_script.txt"
1615c735df2Sopenharmony_ci
1625c735df2Sopenharmony_ci    part_name = "location"
1635c735df2Sopenharmony_ci    subsystem_name = "location"
1645c735df2Sopenharmony_ci  }
1655c735df2Sopenharmony_ci
1665c735df2Sopenharmony_ci  ohos_static_library("lbsservice_gnss_static") {
1675c735df2Sopenharmony_ci    sources = local_base_sources
1685c735df2Sopenharmony_ci
1695c735df2Sopenharmony_ci    include_dirs = [
1705c735df2Sopenharmony_ci      "$LOCATION_ROOT_DIR/interfaces/inner_api/include",
1715c735df2Sopenharmony_ci      "$LOCATION_GNSS_ROOT/include",
1725c735df2Sopenharmony_ci      "$LOCATION_GNSS_ROOT/include/ntp",
1735c735df2Sopenharmony_ci      "$LOCATION_LOCATOR_ROOT/include",
1745c735df2Sopenharmony_ci    ]
1755c735df2Sopenharmony_ci
1765c735df2Sopenharmony_ci    sanitize = {
1775c735df2Sopenharmony_ci      cfi = true
1785c735df2Sopenharmony_ci      cfi_cross_dso = true
1795c735df2Sopenharmony_ci      debug = false
1805c735df2Sopenharmony_ci    }
1815c735df2Sopenharmony_ci    branch_protector_ret = "pac_ret"
1825c735df2Sopenharmony_ci
1835c735df2Sopenharmony_ci    deps = [
1845c735df2Sopenharmony_ci      "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
1855c735df2Sopenharmony_ci      "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
1865c735df2Sopenharmony_ci      "$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk",
1875c735df2Sopenharmony_ci    ]
1885c735df2Sopenharmony_ci
1895c735df2Sopenharmony_ci    external_deps = [
1905c735df2Sopenharmony_ci      "ability_base:want",
1915c735df2Sopenharmony_ci      "eventhandler:libeventhandler",
1925c735df2Sopenharmony_ci      "ffrt:libffrt",
1935c735df2Sopenharmony_ci      "hdf_core:libhdi",
1945c735df2Sopenharmony_ci      "hilog:libhilog",
1955c735df2Sopenharmony_ci      "ipc:ipc_single",
1965c735df2Sopenharmony_ci      "relational_store:native_rdb",
1975c735df2Sopenharmony_ci      "safwk:system_ability_fwk",
1985c735df2Sopenharmony_ci      "samgr:samgr_proxy",
1995c735df2Sopenharmony_ci    ]
2005c735df2Sopenharmony_ci
2015c735df2Sopenharmony_ci    defines = []
2025c735df2Sopenharmony_ci
2035c735df2Sopenharmony_ci    if (telephony_core_service_enable) {
2045c735df2Sopenharmony_ci      external_deps += [ "core_service:tel_core_service_api" ]
2055c735df2Sopenharmony_ci      defines += [ "TEL_CORE_SERVICE_ENABLE" ]
2065c735df2Sopenharmony_ci    }
2075c735df2Sopenharmony_ci
2085c735df2Sopenharmony_ci    if (telephony_cellular_data_enable) {
2095c735df2Sopenharmony_ci      external_deps += [ "cellular_data:tel_cellular_data_api" ]
2105c735df2Sopenharmony_ci      defines += [ "TEL_CELLULAR_DATA_ENABLE" ]
2115c735df2Sopenharmony_ci    }
2125c735df2Sopenharmony_ci
2135c735df2Sopenharmony_ci    if (hdf_drivers_interface_location_agnss_enable) {
2145c735df2Sopenharmony_ci      external_deps +=
2155c735df2Sopenharmony_ci          [ "drivers_interface_location_agnss:liblocation_agnss_proxy_2.0" ]
2165c735df2Sopenharmony_ci      defines += [ "HDF_DRIVERS_INTERFACE_AGNSS_ENABLE" ]
2175c735df2Sopenharmony_ci    }
2185c735df2Sopenharmony_ci
2195c735df2Sopenharmony_ci    if (location_feature_with_gnss &&
2205c735df2Sopenharmony_ci        hdf_drivers_interface_location_gnss_enable) {
2215c735df2Sopenharmony_ci      external_deps +=
2225c735df2Sopenharmony_ci          [ "drivers_interface_location_gnss:liblocation_gnss_proxy_2.0" ]
2235c735df2Sopenharmony_ci      defines += [ "FEATURE_GNSS_SUPPORT" ]
2245c735df2Sopenharmony_ci    }
2255c735df2Sopenharmony_ci
2265c735df2Sopenharmony_ci    if (location_feature_with_passive) {
2275c735df2Sopenharmony_ci      defines += [ "FEATURE_PASSIVE_SUPPORT" ]
2285c735df2Sopenharmony_ci    }
2295c735df2Sopenharmony_ci
2305c735df2Sopenharmony_ci    if (communication_wifi_enable) {
2315c735df2Sopenharmony_ci      external_deps += [ "wifi:wifi_sdk" ]
2325c735df2Sopenharmony_ci      defines += [ "WIFI_ENABLE" ]
2335c735df2Sopenharmony_ci    }
2345c735df2Sopenharmony_ci
2355c735df2Sopenharmony_ci    if (call_manager_enable) {
2365c735df2Sopenharmony_ci      external_deps += [ "call_manager:tel_call_manager_api" ]
2375c735df2Sopenharmony_ci      defines += [ "CALL_MANAGER_ENABLE" ]
2385c735df2Sopenharmony_ci    }
2395c735df2Sopenharmony_ci
2405c735df2Sopenharmony_ci    if (common_event_service_enable) {
2415c735df2Sopenharmony_ci      external_deps += [
2425c735df2Sopenharmony_ci        "ability_runtime:extension_manager",
2435c735df2Sopenharmony_ci        "common_event_service:cesfwk_innerkits",
2445c735df2Sopenharmony_ci      ]
2455c735df2Sopenharmony_ci      defines += [ "COMMON_EVENT_SERVICE_ENABLE" ]
2465c735df2Sopenharmony_ci    }
2475c735df2Sopenharmony_ci
2485c735df2Sopenharmony_ci    if (sms_mms_enable) {
2495c735df2Sopenharmony_ci      external_deps += [ "sms_mms:tel_sms_mms_api" ]
2505c735df2Sopenharmony_ci      defines += [ "SMS_MMS_ENABLE" ]
2515c735df2Sopenharmony_ci    }
2525c735df2Sopenharmony_ci
2535c735df2Sopenharmony_ci    if (notification_distributed_notification_service_enable) {
2545c735df2Sopenharmony_ci      defines += [ "NOTIFICATION_ENABLE" ]
2555c735df2Sopenharmony_ci    }
2565c735df2Sopenharmony_ci
2575c735df2Sopenharmony_ci    if (hdf_drivers_interface_location_geofence_enable) {
2585c735df2Sopenharmony_ci      external_deps += [
2595c735df2Sopenharmony_ci        "drivers_interface_location_geofence:liblocation_geofence_proxy_2.0",
2605c735df2Sopenharmony_ci      ]
2615c735df2Sopenharmony_ci      defines += [ "HDF_DRIVERS_INTERFACE_GEOFENCE_ENABLE" ]
2625c735df2Sopenharmony_ci    }
2635c735df2Sopenharmony_ci
2645c735df2Sopenharmony_ci    if (time_service_enable) {
2655c735df2Sopenharmony_ci      external_deps += [ "time_service:time_client" ]
2665c735df2Sopenharmony_ci      defines += [ "TIME_SERVICE_ENABLE" ]
2675c735df2Sopenharmony_ci    }
2685c735df2Sopenharmony_ci
2695c735df2Sopenharmony_ci    if (net_manager_enable) {
2705c735df2Sopenharmony_ci      external_deps += [ "netmanager_base:net_conn_manager_if" ]
2715c735df2Sopenharmony_ci      defines += [ "NET_MANAGER_ENABLE" ]
2725c735df2Sopenharmony_ci    }
2735c735df2Sopenharmony_ci
2745c735df2Sopenharmony_ci    part_name = "location"
2755c735df2Sopenharmony_ci    subsystem_name = "location"
2765c735df2Sopenharmony_ci  }
2775c735df2Sopenharmony_ci} else {
2785c735df2Sopenharmony_ci  ohos_shared_library("lbsservice_gnss") {
2795c735df2Sopenharmony_ci    part_name = "location"
2805c735df2Sopenharmony_ci    subsystem_name = "location"
2815c735df2Sopenharmony_ci  }
2825c735df2Sopenharmony_ci
2835c735df2Sopenharmony_ci  ohos_static_library("lbsservice_gnss_static") {
2845c735df2Sopenharmony_ci    part_name = "location"
2855c735df2Sopenharmony_ci    subsystem_name = "location"
2865c735df2Sopenharmony_ci  }
2875c735df2Sopenharmony_ci}
288