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