• 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=deprecated-copy",
64    "-Werror=unknown-warning-option",
65    "-Werror=abstract-final-class",
66    "-Werror=range-loop-construct",
67    "-Werror=incompatible-pointer-types",
68  ]
69
70  if (is_arkui_x) {
71    cflags -= [
72      "-Werror=deprecated-copy",
73      "-Werror=anon-enum-enum-conversion",
74      "-Werror=incompatible-pointer-types",
75    ]
76  }
77
78  if (is_ohos && is_clang && (target_cpu == "arm" || target_cpu == "arm64") &&
79      enhanced_opt) {
80    if (ace_engine_feature_enable_pgo) {
81      cflags += [
82        "-fprofile-use=" + rebase_path(
83                "${ace_engine_feature_pgo_path}/libace_compatible.profdata",
84                root_build_dir),
85        "-Wno-error=backend-plugin",
86        "-Wno-profile-instr-out-of-date",
87        "-Wno-profile-instr-unprofiled",
88      ]
89    }
90    if (ace_engine_feature_enable_atomic) {
91      cflags += [ "-moutline-atomics" ]
92    }
93  }
94
95  if (ace_engine_feature_enable_digital_crown) {
96    cflags += [ "-DSUPPORT_DIGITAL_CROWN" ]
97  }
98
99  if (ace_engine_enable_circle_feature) {
100    cflags += [ "-DARKUI_CIRCLE_FEATURE" ]
101  }
102
103  cflags_cc = [
104    "-fvisibility-inlines-hidden",
105    "-Wno-non-c-typedef-for-linkage",
106    "-Os",
107  ]
108
109  if (ace_engine_feature_enable_digital_crown) {
110    cflags += [ "-DSUPPORT_DIGITAL_CROWN" ]
111  }
112
113  if (use_mingw_win) {
114    cflags_cc += [ "-std=c++17" ]
115    defines += [ "_USE_MATH_DEFINES" ]
116  }
117
118  if (use_linux) {
119    cflags_cc += [ "-std=c++17" ]
120    defines += [ "_USE_MATH_DEFINES" ]
121  }
122
123  if (ace_engine_feature_enable_digital_crown) {
124    cflags += [ "-DSUPPORT_DIGITAL_CROWN" ]
125  }
126
127  ldflags = []
128  if (ace_engine_feature_enable_coverage) {
129    cflags += [ "--coverage" ]
130    ldflags += [ "--coverage" ]
131  }
132}
133
134config("ace_test_config") {
135  visibility = [ ":*" ]
136  visibility += [
137    "//foundation/arkui/ace_engine/build/*",
138    "//foundation/arkui/ace_engine/frameworks/bridge/test/unittest/*",
139    "//foundation/arkui/ace_engine/frameworks/core/*",
140    "//foundation/arkui/ace_engine/test/fuzztest/*",
141    "//foundation/arkui/ace_engine/test/unittest/*",
142  ]
143  include_dirs = [
144    "$ace_root",
145    "$ace_root/frameworks",
146    "$ace_root/interfaces/inner_api/ace_kit/include",
147    "$root_out_dir/arkui/framework",
148  ]
149
150  cflags_cc = []
151  defines = ace_common_defines
152
153  if (is_ohos_standard_system && !use_mingw_win && !use_mac && !use_linux) {
154    include_dirs += [ "$ace_root/adapter/ohos/services/uiservice/include" ]
155
156    cflags_cc += [
157      "-Wno-thread-safety-attributes",
158      "-Wno-thread-safety-analysis",
159      "-Wno-non-c-typedef-for-linkage",
160    ]
161    defines += [ "OHOS_STANDARD_SYSTEM" ]
162  }
163
164  if (!is_ohos_standard_system) {
165    defines += [ "ENABLE_NATIVE_VIEW" ]
166  }
167
168  defines += [ "OHOS_PLATFORM" ]
169
170  if (is_wearable_product) {
171    defines += ace_wearable_defines
172  }
173
174  cflags = [
175    "-fvisibility=hidden",
176    "-fdata-sections",
177    "-ffunction-sections",
178  ]
179
180  cflags_cc += [ "-fvisibility-inlines-hidden" ]
181  ldflags = [ "-Wl,-gc-sections" ]
182
183  if (ace_engine_feature_enable_coverage) {
184    cflags += [ "--coverage" ]
185    ldflags += [ "--coverage" ]
186  }
187}
188
189config("ace_coverage_config") {
190  cflags = []
191  ldflags = []
192  if (ace_engine_feature_enable_coverage) {
193    cflags += [ "--coverage" ]
194    ldflags += [ "--coverage" ]
195  }
196}
197