1# Copyright (c) 2021-2024 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 include_dirs = [ 20 "$ace_root", 21 "$ace_root/frameworks", 22 "$root_out_dir/arkui/framework", 23 ] 24 25 if (use_hilog) { 26 include_dirs += [ "$hilog_root/interfaces/native/innerkits/include" ] 27 } 28 29 if (is_ohos_standard_system && !use_mingw_win && !use_mac && !use_linux) { 30 include_dirs += [ "$ace_root/adapter/ohos/services/uiservice/include" ] 31 } 32 defines = ace_common_defines 33 34 if (is_wearable_product) { 35 defines += ace_wearable_defines 36 } 37 38 if (is_ivi_product) { 39 defines += ace_ivi_defines 40 } 41 42 cflags = [ 43 "-fvisibility=hidden", 44 "-fdata-sections", 45 "-ffunction-sections", 46 "-Wno-non-c-typedef-for-linkage", 47 "-Os", 48 "-Werror=return-stack-address", 49 ] 50 51 if (is_ohos && is_clang && (target_cpu == "arm" || target_cpu == "arm64") && 52 enhanced_opt) { 53 if (ace_engine_feature_enable_pgo) { 54 cflags += [ 55 "-fprofile-use=" + rebase_path( 56 "${ace_engine_feature_pgo_path}/libace_compatible.profdata", 57 root_build_dir), 58 "-Wno-error=backend-plugin", 59 "-Wno-profile-instr-out-of-date", 60 "-Wno-profile-instr-unprofiled", 61 ] 62 } 63 if (ace_engine_feature_enable_atomic) { 64 cflags += [ "-moutline-atomics" ] 65 } 66 } 67 68 cflags_cc = [ 69 "-fvisibility-inlines-hidden", 70 "-Wno-non-c-typedef-for-linkage", 71 "-Os", 72 ] 73 74 if (use_mingw_win) { 75 cflags_cc += [ "-std=c++17" ] 76 defines += [ "_USE_MATH_DEFINES" ] 77 } 78 79 if (use_linux) { 80 cflags_cc += [ "-std=c++17" ] 81 defines += [ "_USE_MATH_DEFINES" ] 82 } 83 84 ldflags = [] 85 if (ace_engine_feature_enable_coverage) { 86 cflags += [ "--coverage" ] 87 ldflags += [ "--coverage" ] 88 } 89} 90 91config("ace_test_config") { 92 visibility = [ ":*" ] 93 visibility += [ 94 "//foundation/arkui/ace_engine/build/*", 95 "//foundation/arkui/ace_engine/frameworks/bridge/test/unittest/*", 96 "//foundation/arkui/ace_engine/frameworks/core/*", 97 "//foundation/arkui/ace_engine/test/fuzztest/*", 98 "//foundation/arkui/ace_engine/test/unittest/*", 99 "//foundation/graphic/graphic_2d/rosen/test/render_service/*", 100 ] 101 include_dirs = [ 102 "$ace_root", 103 "$ace_root/frameworks", 104 "$root_out_dir/arkui/framework", 105 ] 106 107 cflags_cc = [] 108 defines = ace_common_defines 109 110 if (is_ohos_standard_system && !use_mingw_win && !use_mac && !use_linux) { 111 include_dirs += [ "$ace_root/adapter/ohos/services/uiservice/include" ] 112 113 cflags_cc += [ 114 "-Wno-thread-safety-attributes", 115 "-Wno-thread-safety-analysis", 116 "-Wno-non-c-typedef-for-linkage", 117 ] 118 defines += [ "OHOS_STANDARD_SYSTEM" ] 119 } 120 121 if (!is_ohos_standard_system) { 122 defines += [ "ENABLE_NATIVE_VIEW" ] 123 } 124 125 defines += [ "OHOS_PLATFORM" ] 126 127 if (is_wearable_product) { 128 defines += ace_wearable_defines 129 } 130 131 cflags = [ 132 "-fvisibility=hidden", 133 "-fdata-sections", 134 "-ffunction-sections", 135 ] 136 137 cflags_cc += [ "-fvisibility-inlines-hidden" ] 138 ldflags = [ "-Wl,-gc-sections" ] 139 140 if (ace_engine_feature_enable_coverage) { 141 cflags += [ "--coverage" ] 142 ldflags += [ "--coverage" ] 143 } 144} 145 146config("ace_coverage_config") { 147 cflags = [] 148 ldflags = [] 149 if (ace_engine_feature_enable_coverage) { 150 cflags += [ "--coverage" ] 151 ldflags += [ "--coverage" ] 152 } 153} 154