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