• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    "$ace_root/interfaces/inner_api/ace_kit/include",
23    "$root_out_dir/arkui/framework",
24  ]
25
26  if (use_hilog) {
27    include_dirs += [ "$hilog_root/interfaces/native/innerkits/include" ]
28  }
29
30  if (is_ohos_standard_system && !use_mingw_win && !use_mac && !use_linux) {
31    include_dirs += [ "$ace_root/adapter/ohos/services/uiservice/include" ]
32  }
33  defines = ace_common_defines
34
35  if (is_wearable_product) {
36    defines += ace_wearable_defines
37  }
38
39  if (is_ivi_product) {
40    defines += ace_ivi_defines
41  }
42
43  cflags = [
44    "-fvisibility=hidden",
45    "-fdata-sections",
46    "-ffunction-sections",
47    "-Wno-non-c-typedef-for-linkage",
48    "-Os",
49    "-Werror=return-stack-address",
50    "-Werror=anon-enum-enum-conversion",
51    "-Werror=sizeof-array-div",
52    "-Werror=undefined-var-template",
53    "-Werror=nonportable-include-path",
54    "-Werror=user-defined-warnings",
55    "-Werror=null-pointer-arithmetic",
56    "-Werror=enum-compare-switch",
57    "-Werror=absolute-value",
58    "-Werror=header-guard",
59    "-Werror=int-to-pointer-cast",
60    "-Werror=pointer-to-int-cast",
61    "-Werror=int-in-bool-context",
62    "-Werror=xor-used-as-pow",
63    "-Werror=unknown-warning-option",
64    "-Werror=abstract-final-class",
65    "-Werror=range-loop-construct",
66    "-Werror=incompatible-pointer-types",
67    "-DUNITEST_FRIEND_CLASS=",
68  ]
69
70  if (is_arkui_x) {
71    cflags -= [
72      "-Werror=anon-enum-enum-conversion",
73      "-Werror=incompatible-pointer-types",
74    ]
75  }
76
77  if (is_ohos && is_clang && (target_cpu == "arm" || target_cpu == "arm64") &&
78      enhanced_opt) {
79    if (ace_engine_feature_enable_pgo) {
80      cflags += [
81        "-fprofile-use=" + rebase_path(
82                "${ace_engine_feature_pgo_path}/libace_compatible.profdata",
83                root_build_dir),
84        "-Wno-error=backend-plugin",
85        "-Wno-profile-instr-out-of-date",
86        "-Wno-profile-instr-unprofiled",
87      ]
88    }
89    if (ace_engine_feature_enable_atomic) {
90      cflags += [ "-moutline-atomics" ]
91    }
92  }
93
94  if (ace_engine_enable_circle_feature) {
95    cflags += [ "-DARKUI_CIRCLE_FEATURE" ]
96  }
97
98  cflags_cc = [
99    "-fvisibility-inlines-hidden",
100    "-Wno-non-c-typedef-for-linkage",
101    "-Os",
102  ]
103
104  if (ace_engine_feature_enable_digital_crown) {
105    cflags += [ "-DSUPPORT_DIGITAL_CROWN" ]
106  }
107
108  if (use_mingw_win) {
109    cflags_cc += [ "-std=c++17" ]
110  }
111
112  if (use_linux) {
113    cflags_cc += [ "-std=c++17" ]
114  }
115
116  ldflags = []
117  if (ace_engine_feature_enable_coverage) {
118    cflags += [ "--coverage" ]
119    ldflags += [ "--coverage" ]
120  }
121}
122
123config("ace_test_config") {
124  visibility = [ ":*" ]
125  visibility += [
126    "//foundation/arkui/ace_engine/build/*",
127    "//foundation/arkui/ace_engine/frameworks/bridge/test/unittest/*",
128    "//foundation/arkui/ace_engine/frameworks/core/*",
129    "//foundation/arkui/ace_engine/test/fuzztest/*",
130    "//foundation/arkui/ace_engine/test/unittest/*",
131  ]
132  include_dirs = [
133    "$ace_root",
134    "$ace_root/frameworks",
135    "$ace_root/interfaces/inner_api/ace_kit/include",
136    "$root_out_dir/arkui/framework",
137  ]
138
139  cflags_cc = []
140  defines = ace_common_defines
141
142  if (is_ohos_standard_system && !use_mingw_win && !use_mac && !use_linux) {
143    include_dirs += [ "$ace_root/adapter/ohos/services/uiservice/include" ]
144
145    cflags_cc += [
146      "-Wno-thread-safety-attributes",
147      "-Wno-thread-safety-analysis",
148      "-Wno-non-c-typedef-for-linkage",
149    ]
150    defines += [ "OHOS_STANDARD_SYSTEM" ]
151  }
152
153  if (!is_ohos_standard_system) {
154    defines += [ "ENABLE_NATIVE_VIEW" ]
155  }
156
157  defines += [ "OHOS_PLATFORM" ]
158
159  if (is_wearable_product) {
160    defines += ace_wearable_defines
161  }
162
163  cflags = [
164    "-fvisibility=hidden",
165    "-fdata-sections",
166    "-ffunction-sections",
167    "-DUNITEST_FRIEND_CLASS=",
168  ]
169
170  cflags_cc += [ "-fvisibility-inlines-hidden" ]
171  ldflags = [ "-Wl,-gc-sections" ]
172
173  if (ace_engine_feature_enable_coverage) {
174    cflags += [ "--coverage" ]
175    ldflags += [ "--coverage" ]
176  }
177}
178
179config("ace_coverage_config") {
180  cflags = []
181  ldflags = []
182  if (ace_engine_feature_enable_coverage) {
183    cflags += [ "--coverage" ]
184    ldflags += [ "--coverage" ]
185  }
186}
187