• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 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
14ide_previewer_path = "//ide/tools/previewer"
15googletest_path = "//third_party/googletest"
16secodefuzz_path = "//Secodefuzz"
17secodepits_path = "//Secodepits"
18
19secodefuzz_deps = "$secodefuzz_path:secodefuzz"
20secodepits_deps = "$secodepits_path:secodepits"
21googletest_deps = "$googletest_path:gmock_main"
22googletest_include_path = "$googletest_path/include"
23
24ace_engine_path = "//foundation/arkui/ace_engine"
25ace_engine_include_path = [
26  "$ace_engine_path",
27  "$ace_engine_path/adapter/preview/entrance",
28  "$ace_engine_path/frameworks",
29  "$ace_engine_path/frameworks/base/utils",
30  "$ace_engine_path/frameworks/core/event",
31  "$ace_engine_path/engine",
32  "$ace_engine_path/engine/flutter/shell/platform/common/cpp/public",
33  "$ace_engine_path/engine/ace_adapter/flutter/shell/platform/glfw/public",
34  "$ace_engine_path/frameworks/core/common",
35  "$ace_engine_path/frameworks/core/common/clipboard",
36  "$ace_engine_path/adapter/preview/entrance/clipboard",
37  "$ace_engine_path/interfaces/inner_api/ace",
38  "$ace_engine_path/interfaces/inner_api/ace_kit/include",
39  "//",
40]
41ability_runtime_path = "//foundation/ability/ability_runtime"
42ability_runtime_include_path = [
43  "$ability_runtime_path/frameworks/simulator/common/include",
44  "$ability_runtime_path/frameworks/simulator/ability_simulator/include",
45]
46window_manager_path = "//foundation/window/window_manager"
47window_manager_include_path = [
48  "$window_manager_path/previewer/include",
49  "$window_manager_path/previewer/mock",
50  "$window_manager_path/utils/include",
51]
52graphic_2d_path = "//foundation/graphic/graphic_2d"
53graphic_2d_include_path = [
54  "$graphic_2d_path/rosen/modules/glfw_render_context/export",
55  "$graphic_2d_path/rosen/modules/platform/ipc_core",
56  "$graphic_2d_path/rosen/modules/platform/image_native",
57  "$graphic_2d_path/rosen/modules/platform/utils",
58]
59
60ace_engine_lite_path = "//foundation/arkui/ace_engine_lite"
61ui_lite_path = "//foundation/arkui/ui_lite"
62ui_ext_lite_path = "//foundation/arkui/ui_ext_lite"
63graphic_utils_lite_path = "//foundation/graphic/graphic_utils_lite"
64ability_lite_path = "//foundation/ability/ability_lite"
65resource_management_lite_path = "//base/global/resource_management_lite"
66powermgr_lite_path = "//base/powermgr/powermgr_lite"
67geo_lite_path = "//base/location/interfaces/kits/geo_lite"
68sensorjs_lite_path = "//base/sensors/sensorjs_lite"
69startup_init_path = "//base/startup/init"
70utils_lite_path = "//commonlibrary/utils_lite"
71
72template("ide_test") {
73  executable(target_name) {
74    testonly = invoker.testonly
75    subsystem_name = invoker.subsystem_name
76    part_name = invoker.part_name
77    module_out_path = invoker.module_out_path
78    output_name = invoker.output_name
79    print("$subsystem_name-$part_name-$module_out_path-$output_name")
80    defines = invoker.defines
81    sources = invoker.sources
82    include_dirs = invoker.include_dirs
83    include_dirs += [ googletest_include_path ]
84    deps = invoker.deps
85    deps += [
86      googletest_deps,
87      secodefuzz_deps,
88      secodepits_deps,
89    ]
90    libs = invoker.libs
91    libs += [ "pthread" ]
92    cflags = invoker.cflags
93    cflags += [
94      "-std=c++17",
95      "-Wno-deprecated-declarations",
96      "-Wno-reorder",
97      "-Wno-sign-compare",
98      "-Wno-error",
99      "-Wno-warnings",
100      "-Wno-unused-variable",
101      "-fsanitize=address",
102      "-fsanitize=undefined",
103      "-fsanitize-coverage=trace-pc",
104      "-fprofile-arcs",
105      "-ftest-coverage",
106      "-fdump-rtl-expand",
107      "-g",
108      "-O0",
109      "-fno-omit-frame-pointer",
110    ]
111    cflags_cc = invoker.cflags_cc
112    cflags_cc += [
113      "-fsanitize=address",
114      "-fsanitize=undefined",
115      "-fsanitize-coverage=trace-pc",
116      "-fprofile-arcs",
117      "-ftest-coverage",
118      "-fdump-rtl-expand",
119      "-g",
120      "-O0",
121      "-fno-omit-frame-pointer",
122    ]
123    ldflags = invoker.ldflags
124    ldflags += [
125      "-fsanitize=address",
126      "-fsanitize=undefined",
127      "-fsanitize-coverage=trace-pc",
128      "-fprofile-arcs",
129      "-lgcov",
130    ]
131  }
132}
133
134template("ide_fuzztest") {
135  ide_test(target_name) {
136    testonly = invoker.testonly
137    subsystem_name = invoker.subsystem_name
138    part_name = invoker.part_name
139    module_out_path = invoker.module_out_path
140    output_name = invoker.output_name
141    sources = invoker.sources
142    include_dirs = invoker.include_dirs
143    include_dirs += [
144      secodefuzz_path,
145      secodepits_path,
146    ]
147    deps = invoker.deps
148    libs = invoker.libs
149    cflags = invoker.cflags
150    cflags_cc = invoker.cflags_cc
151    ldflags = invoker.ldflags
152    defines = []
153  }
154}
155
156template("ide_unittest") {
157  ide_test(target_name) {
158    testonly = invoker.testonly
159    subsystem_name = invoker.subsystem_name
160    part_name = invoker.part_name
161    module_out_path = invoker.module_out_path
162    output_name = invoker.output_name
163    sources = invoker.sources
164    include_dirs = invoker.include_dirs
165    deps = invoker.deps
166    libs = invoker.libs
167    cflags = invoker.cflags
168    cflags_cc = invoker.cflags_cc
169    ldflags = invoker.ldflags
170    defines = [
171      "REPLACE_WINDOW_HEADER=1",
172      "ENABLE_ICU=1",
173    ]
174  }
175}
176