1# Copyright (c) 2021-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("//build/ohos.gni") 15import("//foundation/arkui/ace_engine/ace_config.gni") 16 17# Common config for Ability Cross-platform Environment(ACE) source 18config("ace_config") { 19 visibility = [ ":*" ] 20 include_dirs = [ 21 "$ace_root", 22 "$ace_root/frameworks", 23 "$root_out_dir/arkui/framework", 24 "//third_party/zlib", 25 ] 26 27 if (is_standard_system && !use_mingw_win && !use_mac && !use_linux) { 28 include_dirs += [ 29 "//base/global/resource_management/frameworks/resmgr/include", 30 "//base/global/resource_management/interfaces/inner_api/include", 31 "$ace_root/adapter/ohos/services/uiservice/include", 32 ] 33 } 34 defines = ace_common_defines 35 36 if (is_wearable_product) { 37 defines += ace_wearable_defines 38 } 39 40 if (is_ivi_product) { 41 defines += ace_ivi_defines 42 } 43 44 cflags = [ 45 "-fvisibility=hidden", 46 "-fdata-sections", 47 "-ffunction-sections", 48 "-Wno-non-c-typedef-for-linkage", 49 "-Os", 50 ] 51 52 cflags_cc = [ 53 "-fvisibility-inlines-hidden", 54 "-Wno-non-c-typedef-for-linkage", 55 "-Os", 56 ] 57 58 if (use_mingw_win) { 59 cflags_cc += [ "-std=c++17" ] 60 defines += [ "_USE_MATH_DEFINES" ] 61 } 62 63 if (use_linux) { 64 cflags_cc += [ "-std=c++17" ] 65 defines += [ "_USE_MATH_DEFINES" ] 66 } 67} 68 69config("ace_test_config") { 70 visibility = [ ":*" ] 71 include_dirs = [ 72 "$ace_root", 73 "$ace_root/frameworks", 74 "$root_out_dir/arkui/framework", 75 ] 76 cflags_cc = [] 77 defines = ace_common_defines 78 79 if (is_standard_system && !use_mingw_win && !use_mac && !use_linux) { 80 include_dirs += [ 81 "//base/global/resource_management/frameworks/resmgr/include", 82 "//base/global/resource_management/interfaces/inner_api/include", 83 ] 84 85 cflags_cc += [ 86 "-Wno-thread-safety-attributes", 87 "-Wno-thread-safety-analysis", 88 "-Wno-non-c-typedef-for-linkage", 89 ] 90 defines += [ "OHOS_STANDARD_SYSTEM" ] 91 } 92 93 if (!is_standard_system) { 94 defines += [ "ENABLE_NATIVE_VIEW" ] 95 } 96 97 defines += [ "OHOS_PLATFORM" ] 98 99 if (is_wearable_product) { 100 defines += ace_wearable_defines 101 } 102 103 cflags = [ 104 "-fvisibility=hidden", 105 "-fdata-sections", 106 "-ffunction-sections", 107 ] 108 109 cflags_cc += [ "-fvisibility-inlines-hidden" ] 110 ldflags = [ "-Wl,-gc-sections" ] 111} 112 113config("ace_unittest_config") { 114 visibility = [ ":*" ] 115 include_dirs = [ 116 "$ace_root", 117 "$ace_root/frameworks", 118 "$root_out_dir/arkui/framework", 119 ] 120 cflags_cc = [] 121 defines = [] 122 123 if (is_standard_system && !use_mingw_win && !use_mac && !use_linux) { 124 include_dirs += [ 125 "//base/global/resource_management/frameworks/resmgr/include", 126 "//base/global/resource_management/interfaces/inner_api/include", 127 ] 128 129 cflags_cc += [ 130 "-Wno-thread-safety-attributes", 131 "-Wno-thread-safety-analysis", 132 "-Wno-non-c-typedef-for-linkage", 133 ] 134 defines += [ "OHOS_STANDARD_SYSTEM" ] 135 } 136 137 cflags = [ 138 "-fvisibility=hidden", 139 "-fdata-sections", 140 "-ffunction-sections", 141 ] 142 143 cflags_cc += [ "-fvisibility-inlines-hidden" ] 144 ldflags = [ "-Wl,-gc-sections" ] 145 146 defines += [ "ACE_UNITTEST" ] 147} 148 149ohos_source_set("ace_test_log") { 150 sources = [ 151 "$ace_root/adapter/ohos/osal/ace_trace.cpp", 152 "$ace_root/adapter/ohos/osal/log_wrapper.cpp", 153 "$ace_root/frameworks/base/log/ace_trace.cpp", 154 ] 155 156 deps = [ "//third_party/bounds_checking_function:libsec_shared" ] 157 158 external_deps = [ 159 "hitrace_native:hitrace_meter", 160 "hiviewdfx_hilog_native:libhilog", 161 ] 162 163 configs = [ ":ace_unittest_config" ] 164} 165 166config("ace_test_coverage_config") { 167 if (ace_engine_feature_enable_coverage) { 168 cflags = [ "--coverage" ] 169 ldflags = [ "--coverage" ] 170 } 171} 172