# Copyright (c) 2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ide_previewer_path = "//ide/tools/previewer" googletest_path = "//third_party/googletest" secodefuzz_path = "//Secodefuzz" secodepits_path = "//Secodepits" secodefuzz_deps = "$secodefuzz_path:secodefuzz" secodepits_deps = "$secodepits_path:secodepits" googletest_deps = "$googletest_path:gmock_main" googletest_include_path = "$googletest_path/include" ace_engine_path = "//foundation/arkui/ace_engine" ace_engine_include_path = [ "$ace_engine_path", "$ace_engine_path/adapter/preview/entrance", "$ace_engine_path/frameworks", "$ace_engine_path/frameworks/base/utils", "$ace_engine_path/frameworks/core/event", "$ace_engine_path/engine", "$ace_engine_path/engine/flutter/shell/platform/common/cpp/public", "$ace_engine_path/engine/ace_adapter/flutter/shell/platform/glfw/public", "$ace_engine_path/frameworks/core/common", "$ace_engine_path/frameworks/core/common/clipboard", "$ace_engine_path/adapter/preview/entrance/clipboard", "$ace_engine_path/interfaces/inner_api/ace", ] ability_runtime_path = "//foundation/ability/ability_runtime" ability_runtime_include_path = [ "$ability_runtime_path/frameworks/simulator/common/include", "$ability_runtime_path/frameworks/simulator/ability_simulator/include", ] window_manager_path = "//foundation/window/window_manager" window_manager_include_path = [ "$window_manager_path/previewer/include", "$window_manager_path/previewer/mock", "$window_manager_path/utils/include", ] graphic_2d_path = "//foundation/graphic/graphic_2d" graphic_2d_include_path = [ "$graphic_2d_path/rosen/modules/glfw_render_context/export", "$graphic_2d_path/rosen/modules/platform/ipc_core", "$graphic_2d_path/rosen/modules/platform/image_native", "$graphic_2d_path/rosen/modules/platform/utils", ] template("ide_test") { executable(target_name) { testonly = invoker.testonly subsystem_name = invoker.subsystem_name part_name = invoker.part_name module_out_path = invoker.module_out_path output_name = invoker.output_name print("$subsystem_name-$part_name-$module_out_path-$output_name") defines = invoker.defines sources = invoker.sources include_dirs = invoker.include_dirs include_dirs += [ googletest_include_path ] deps = invoker.deps deps += [ googletest_deps, secodefuzz_deps, secodepits_deps, ] libs = invoker.libs libs += [ "pthread" ] cflags = invoker.cflags cflags += [ "-std=c++17", "-Wno-deprecated-declarations", "-Wno-reorder", "-Wno-sign-compare", "-Wno-error", "-Wno-warnings", "-Wno-unused-variable", "-fsanitize=address", "-fsanitize=undefined", "-fsanitize-coverage=trace-pc", "-fprofile-arcs", "-ftest-coverage", "-fdump-rtl-expand", "-g", "-O0", "-fno-omit-frame-pointer", ] cflags_cc = invoker.cflags_cc cflags_cc += [ "-fsanitize=address", "-fsanitize=undefined", "-fsanitize-coverage=trace-pc", "-fprofile-arcs", "-ftest-coverage", "-fdump-rtl-expand", "-g", "-O0", "-fno-omit-frame-pointer", ] ldflags = invoker.ldflags ldflags += [ "-fsanitize=address", "-fsanitize=undefined", "-fsanitize-coverage=trace-pc", "-fprofile-arcs", "-lgcov", ] } } template("ide_fuzztest") { ide_test(target_name) { testonly = invoker.testonly subsystem_name = invoker.subsystem_name part_name = invoker.part_name module_out_path = invoker.module_out_path output_name = invoker.output_name sources = invoker.sources include_dirs = invoker.include_dirs include_dirs += [ secodefuzz_path, secodepits_path, ] deps = invoker.deps libs = invoker.libs cflags = invoker.cflags cflags_cc = invoker.cflags_cc ldflags = invoker.ldflags defines = [] } } template("ide_unittest") { ide_test(target_name) { testonly = invoker.testonly subsystem_name = invoker.subsystem_name part_name = invoker.part_name module_out_path = invoker.module_out_path output_name = invoker.output_name sources = invoker.sources include_dirs = invoker.include_dirs deps = invoker.deps libs = invoker.libs cflags = invoker.cflags cflags_cc = invoker.cflags_cc ldflags = invoker.ldflags defines = [ "REPLACE_WINDOW_HEADER=1" ] } }