# Copyright (c) 2021-2022 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("../../resmgr.gni") # source code for win. is_win = "${current_os}_${current_cpu}" == "mingw_x86_64" # source code for linux. is_linux = "${current_os}_${current_cpu}" == "linux_x64" # source code for mac. is_mac = "${current_os}_${current_cpu}" == "mac_x64" || "${current_os}_${host_cpu}" == "mac_arm64" config("resmgr_config") { include_dirs = [ "include", "../../interfaces/inner_api/include", ] } manager_sources = [ "src/hap_manager.cpp", "src/hap_resource.cpp", "src/locale_matcher.cpp", "src/lock.cpp", "src/res_config_impl.cpp", "src/res_desc.cpp", "src/res_locale.cpp", "src/resource_manager.cpp", "src/resource_manager_ext_mgr.cpp", "src/resource_manager_impl.cpp", "src/system_resource_manager.cpp", "src/theme_pack_config.cpp", "src/theme_pack_manager.cpp", "src/theme_pack_resource.cpp", "src/utils/hap_parser.cpp", "src/utils/psue_manager.cpp", "src/utils/string_utils.cpp", "src/utils/utils.cpp", ] config("resmgr_public_config") { visibility = [ ":*" ] include_dirs = [ "../../interfaces/inner_api/include" ] if (resource_management_support_icu) { defines = [ "SUPPORT_GRAPHICS" ] } } config("global_resmgr_all_deps_config") { include_dirs = [ "../../interfaces/inner_api/include" ] } config("rawfile_public_config") { include_dirs = [ "./include", "../../interfaces/native/resource/include", ] } ohos_shared_library("global_resmgr") { sources = manager_sources sources += [ "../../dfx/hisysevent_adapter/hisysevent_adapter.cpp" ] defines = [ "CONFIG_HILOG" ] configs = [ ":resmgr_config" ] version_script = "libresmgr.versionscript" include_dirs = [ "../../dfx/hisysevent_adapter" ] public_configs = [ ":resmgr_public_config", ":global_resmgr_all_deps_config", ] all_dependent_configs = [ ":global_resmgr_all_deps_config" ] external_deps = [ "ability_base:extractortool", "bounds_checking_function:libsec_shared", "cJSON:cjson", "hilog:libhilog", "hisysevent:libhisysevent", "hitrace:hitrace_meter", "init:libbegetutil", "zlib:shared_libz", ] if (resource_management_support_icu) { external_deps += [ "icu:shared_icui18n" ] public_external_deps = [ "icu:shared_icuuc" ] } branch_protector_ret = "pac_ret" sanitize = { boundary_sanitize = true cfi = true cfi_cross_dso = true debug = false integer_overflow = true ubsan = true } subsystem_name = "global" innerapi_tags = [ "platformsdk_indirect", "sasdk", ] part_name = "resource_management" } ohos_shared_library("global_resmgr_win") { if (resource_management_support_icu) { defines = [ "__WINNT__", "__EXPORT_MGR__", "__IDE_PREVIEW__", ] cflags = [ "-std=c++17", "-Wno-ignored-attributes", ] sources = manager_sources configs = [ ":resmgr_config" ] public_configs = [ ":resmgr_public_config" ] external_deps = [ "bounds_checking_function:libsec_shared", "cJSON:cjson_static", "icu:static_icui18n", "zlib:libz", ] public_external_deps = [ "icu:static_icuuc" ] libs = [ "shlwapi" ] } subsystem_name = "global" part_name = "resource_management" } group("win_resmgr") { if (is_win && resource_management_support_icu) { public_deps = [ ":global_resmgr_win" ] } } ohos_shared_library("global_resmgr_mac") { if (resource_management_support_icu) { defines = [ "__IDE_PREVIEW__" ] cflags = [ "-std=c++17", "-Wno-ignored-attributes", ] sources = manager_sources configs = [ ":resmgr_config" ] public_configs = [ ":resmgr_public_config" ] if (host_os == "mac") { external_deps = [ "bounds_checking_function:libsec_static", "cJSON:cjson_static", "icu:static_icui18n", "zlib:libz", ] public_external_deps = [ "icu:static_icuuc" ] } } subsystem_name = "global" part_name = "resource_management" } group("mac_resmgr") { if (is_mac && resource_management_support_icu) { public_deps = [ ":global_resmgr_mac" ] } } ohos_shared_library("global_resmgr_linux") { if (resource_management_support_icu) { defines = [ "__IDE_PREVIEW__", "__LINUX__", ] cflags = [ "-std=c++17", "-Wno-ignored-attributes", ] sources = manager_sources configs = [ ":resmgr_config" ] public_configs = [ ":resmgr_public_config" ] external_deps = [ "bounds_checking_function:libsec_shared", "cJSON:cjson_static", "icu:shared_icui18n", "zlib:shared_libz", ] public_external_deps = [ "icu:shared_icuuc" ] } subsystem_name = "global" part_name = "resource_management" } group("linux_resmgr") { if (is_linux && resource_management_support_icu) { deps = [ ":global_resmgr_linux" ] } } ohos_shared_library("librawfile") { output_name = "rawfile" public_configs = [ ":rawfile_public_config" ] sources = [ "src/raw_file_manager.cpp" ] defines = [ "CONFIG_HILOG" ] include_dirs = [ "./include", "../../interfaces/native/resource/include", "../../interfaces/inner_api/include", "../../interfaces/js/innerkits/core/include", ] cflags = [ "-Wno-error=inconsistent-missing-override" ] deps = [ ":global_resmgr" ] external_deps = [ "ability_base:configuration", "bundle_framework:appexecfwk_base", "cJSON:cjson_static", "c_utils:utils", "hilog:libhilog", "napi:ace_napi", ] if (resource_management_support_icu) { external_deps += [ "icu:shared_icuuc" ] } stack_protector_ret = true sanitize = { boundary_sanitize = true cfi = true cfi_cross_dso = true debug = false integer_overflow = true ubsan = true } subsystem_name = "global" part_name = "resource_management" } ohos_shared_library("ohresmgr") { public_configs = [ ":rawfile_public_config" ] sources = [ "src/native_resource_manager.cpp" ] output_extension = "so" output_name = "ohresmgr" defines = [ "CONFIG_HILOG" ] include_dirs = [ "./include", "../../interfaces/native/resource/include", "../../interfaces/inner_api/include", "../../interfaces/js/innerkits/core/include", ] cflags = [ "-Wno-error=inconsistent-missing-override" ] deps = [ ":global_resmgr" ] external_deps = [ "ability_base:configuration", "ace_engine:ace_ndk", "ace_engine:drawable_descriptor", "bundle_framework:appexecfwk_base", "cJSON:cjson_static", "c_utils:utils", "hilog:libhilog", "napi:ace_napi", ] stack_protector_ret = true sanitize = { boundary_sanitize = true cfi = true cfi_cross_dso = true debug = false integer_overflow = true ubsan = true } innerapi_tags = [ "ndk" ] subsystem_name = "global" part_name = "resource_management" }