123b3eb3cSopenharmony_ci# Copyright (c) 2021-2023 Huawei Device Co., Ltd. 223b3eb3cSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 323b3eb3cSopenharmony_ci# you may not use this file except in compliance with the License. 423b3eb3cSopenharmony_ci# You may obtain a copy of the License at 523b3eb3cSopenharmony_ci# 623b3eb3cSopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 723b3eb3cSopenharmony_ci# 823b3eb3cSopenharmony_ci# Unless required by applicable law or agreed to in writing, software 923b3eb3cSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 1023b3eb3cSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1123b3eb3cSopenharmony_ci# See the License for the specific language governing permissions and 1223b3eb3cSopenharmony_ci# limitations under the License. 1323b3eb3cSopenharmony_ci 1423b3eb3cSopenharmony_ciimport("//build/ohos.gni") 1523b3eb3cSopenharmony_ciimport("//foundation/arkui/ace_engine/ace_config.gni") 1623b3eb3cSopenharmony_ciimport("//foundation/arkui/ace_engine/adapter/preview/sdk/sharedlib_config.gni") 1723b3eb3cSopenharmony_ciimport("//foundation/arkui/ace_engine/interfaces/napi/kits/napi_lib.gni") 1823b3eb3cSopenharmony_ci 1923b3eb3cSopenharmony_ciace_devices = [ 2023b3eb3cSopenharmony_ci "phone", 2123b3eb3cSopenharmony_ci "tv", 2223b3eb3cSopenharmony_ci "wearable", 2323b3eb3cSopenharmony_ci "tablet", 2423b3eb3cSopenharmony_ci "card", 2523b3eb3cSopenharmony_ci "car", 2623b3eb3cSopenharmony_ci] 2723b3eb3cSopenharmony_ci 2823b3eb3cSopenharmony_ciforeach(device, ace_devices) { 2923b3eb3cSopenharmony_ci ohos_executable("ace_${device}_test") { 3023b3eb3cSopenharmony_ci ohos_test = true 3123b3eb3cSopenharmony_ci test_output_dir = "$root_out_dir/common/samples" 3223b3eb3cSopenharmony_ci defines = [ "USE_GLFW_WINDOW" ] 3323b3eb3cSopenharmony_ci cflags_cc = [] 3423b3eb3cSopenharmony_ci deps = [] 3523b3eb3cSopenharmony_ci config = { 3623b3eb3cSopenharmony_ci } 3723b3eb3cSopenharmony_ci if (defined(current_platform.config)) { 3823b3eb3cSopenharmony_ci config = current_platform.config 3923b3eb3cSopenharmony_ci } 4023b3eb3cSopenharmony_ci if (defined(config.defines)) { 4123b3eb3cSopenharmony_ci defines += config.defines 4223b3eb3cSopenharmony_ci } 4323b3eb3cSopenharmony_ci if (defined(config.cflags_cc)) { 4423b3eb3cSopenharmony_ci cflags_cc += config.cflags_cc 4523b3eb3cSopenharmony_ci } 4623b3eb3cSopenharmony_ci if (defined(config.libace_target)) { 4723b3eb3cSopenharmony_ci deps += [ config.libace_target ] 4823b3eb3cSopenharmony_ci } 4923b3eb3cSopenharmony_ci include_dirs = [ 5023b3eb3cSopenharmony_ci "$ace_root", 5123b3eb3cSopenharmony_ci "$ace_root/frameworks", 5223b3eb3cSopenharmony_ci "//foundation/window/window_manager", 5323b3eb3cSopenharmony_ci "//ide/tools/previewer", 5423b3eb3cSopenharmony_ci ] 5523b3eb3cSopenharmony_ci deps += [ 5623b3eb3cSopenharmony_ci ":copy_preview_shared_library", 5723b3eb3cSopenharmony_ci "//third_party/glfw:glfw", 5823b3eb3cSopenharmony_ci ] 5923b3eb3cSopenharmony_ci sources = [ 6023b3eb3cSopenharmony_ci "ace_${device}_test.cpp", 6123b3eb3cSopenharmony_ci "event_adapter.cpp", 6223b3eb3cSopenharmony_ci ] 6323b3eb3cSopenharmony_ci 6423b3eb3cSopenharmony_ci external_deps = [ 6523b3eb3cSopenharmony_ci "graphic_2d:librender_service_client", 6623b3eb3cSopenharmony_ci "previewer:ide_extension", 6723b3eb3cSopenharmony_ci "window_manager:previewer_window", 6823b3eb3cSopenharmony_ci ] 6923b3eb3cSopenharmony_ci 7023b3eb3cSopenharmony_ci if (use_mingw_win) { 7123b3eb3cSopenharmony_ci libs = [ "pthread" ] 7223b3eb3cSopenharmony_ci } 7323b3eb3cSopenharmony_ci subsystem_name = ace_engine_subsystem 7423b3eb3cSopenharmony_ci part_name = ace_engine_part 7523b3eb3cSopenharmony_ci } 7623b3eb3cSopenharmony_ci} 7723b3eb3cSopenharmony_ci 7823b3eb3cSopenharmony_ci# Install packages 7923b3eb3cSopenharmony_cigroup("previewer_demo") { 8023b3eb3cSopenharmony_ci if (is_wearable_product) { 8123b3eb3cSopenharmony_ci deps = [ ":ace_wearable_test" ] 8223b3eb3cSopenharmony_ci } else { 8323b3eb3cSopenharmony_ci deps = [ 8423b3eb3cSopenharmony_ci ":ace_car_test", 8523b3eb3cSopenharmony_ci ":ace_card_test", 8623b3eb3cSopenharmony_ci ":ace_phone_test", 8723b3eb3cSopenharmony_ci ":ace_tablet_test", 8823b3eb3cSopenharmony_ci ":ace_tv_test", 8923b3eb3cSopenharmony_ci ] 9023b3eb3cSopenharmony_ci } 9123b3eb3cSopenharmony_ci} 9223b3eb3cSopenharmony_ci 9323b3eb3cSopenharmony_cicommon_bin += [ 9423b3eb3cSopenharmony_ci # The dynamic librarys of hiviewdfx subsystem. 9523b3eb3cSopenharmony_ci { 9623b3eb3cSopenharmony_ci label = "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog" 9723b3eb3cSopenharmony_ci subsystem_name = "hiviewdfx" 9823b3eb3cSopenharmony_ci part_name = "hilog" 9923b3eb3cSopenharmony_ci }, 10023b3eb3cSopenharmony_ci 10123b3eb3cSopenharmony_ci # The dynamic librarys of IDE subsystem. 10223b3eb3cSopenharmony_ci { 10323b3eb3cSopenharmony_ci label = "//ide/tools/previewer/util:ide_util" 10423b3eb3cSopenharmony_ci subsystem_name = "ide" 10523b3eb3cSopenharmony_ci part_name = "previewer" 10623b3eb3cSopenharmony_ci }, 10723b3eb3cSopenharmony_ci { 10823b3eb3cSopenharmony_ci label = "//ide/tools/previewer/jsapp/rich/external:ide_extension" 10923b3eb3cSopenharmony_ci subsystem_name = "ide" 11023b3eb3cSopenharmony_ci part_name = "previewer" 11123b3eb3cSopenharmony_ci }, 11223b3eb3cSopenharmony_ci 11323b3eb3cSopenharmony_ci # The dynamic librarys of rosen window subsystem. 11423b3eb3cSopenharmony_ci { 11523b3eb3cSopenharmony_ci label = "//foundation/window/window_manager/previewer:previewer_window" 11623b3eb3cSopenharmony_ci subsystem_name = "window" 11723b3eb3cSopenharmony_ci part_name = "window_manager" 11823b3eb3cSopenharmony_ci }, 11923b3eb3cSopenharmony_ci] 12023b3eb3cSopenharmony_ci 12123b3eb3cSopenharmony_ciif (is_mingw || is_mac) { 12223b3eb3cSopenharmony_ci common_bin += [ 12323b3eb3cSopenharmony_ci # The dynamic librarys of rosen window subsystem. 12423b3eb3cSopenharmony_ci { 12523b3eb3cSopenharmony_ci label = 12623b3eb3cSopenharmony_ci "//foundation/window/window_manager/previewer:previewer_window_napi" 12723b3eb3cSopenharmony_ci subsystem_name = "window" 12823b3eb3cSopenharmony_ci part_name = "window_manager" 12923b3eb3cSopenharmony_ci }, 13023b3eb3cSopenharmony_ci 13123b3eb3cSopenharmony_ci # The napi dynamic librarys of ability subsystem. 13223b3eb3cSopenharmony_ci { 13323b3eb3cSopenharmony_ci label = "//foundation/ability/ability_runtime/frameworks/simulator/ability_simulator:ability_simulator" 13423b3eb3cSopenharmony_ci subsystem_name = "ability" 13523b3eb3cSopenharmony_ci part_name = "ability_runtime" 13623b3eb3cSopenharmony_ci }, 13723b3eb3cSopenharmony_ci { 13823b3eb3cSopenharmony_ci label = "//foundation/ability/ability_base:string_utils" 13923b3eb3cSopenharmony_ci subsystem_name = "ability" 14023b3eb3cSopenharmony_ci part_name = "ability_base" 14123b3eb3cSopenharmony_ci }, 14223b3eb3cSopenharmony_ci ] 14323b3eb3cSopenharmony_ci napi_modules += [ 14423b3eb3cSopenharmony_ci { 14523b3eb3cSopenharmony_ci prefix = "app/ability" 14623b3eb3cSopenharmony_ci shard_libs = [ 14723b3eb3cSopenharmony_ci # The napi dynamic librarys of ability subsystem. 14823b3eb3cSopenharmony_ci { 14923b3eb3cSopenharmony_ci label = "//foundation/ability/ability_runtime/frameworks/simulator/napi_module/uiability:uiability" 15023b3eb3cSopenharmony_ci subsystem_name = "ability" 15123b3eb3cSopenharmony_ci part_name = "ability_runtime" 15223b3eb3cSopenharmony_ci }, 15323b3eb3cSopenharmony_ci ] 15423b3eb3cSopenharmony_ci }, 15523b3eb3cSopenharmony_ci { 15623b3eb3cSopenharmony_ci prefix = "ability" 15723b3eb3cSopenharmony_ci 15823b3eb3cSopenharmony_ci # The napi dynamic librarys of ability subsystem. 15923b3eb3cSopenharmony_ci shard_libs = [ 16023b3eb3cSopenharmony_ci { 16123b3eb3cSopenharmony_ci label = "//foundation/ability/ability_runtime/frameworks/simulator/napi_module/want_constant:wantconstant_napi" 16223b3eb3cSopenharmony_ci subsystem_name = "ability" 16323b3eb3cSopenharmony_ci part_name = "ability_runtime" 16423b3eb3cSopenharmony_ci }, 16523b3eb3cSopenharmony_ci ] 16623b3eb3cSopenharmony_ci }, 16723b3eb3cSopenharmony_ci { 16823b3eb3cSopenharmony_ci prefix = "application" 16923b3eb3cSopenharmony_ci shard_libs = [ 17023b3eb3cSopenharmony_ci # The napi dynamic librarys of rosen window subsystem. 17123b3eb3cSopenharmony_ci { 17223b3eb3cSopenharmony_ci label = "//foundation/window/window_manager/previewer/window_stage_modules:windowstage" 17323b3eb3cSopenharmony_ci subsystem_name = "window" 17423b3eb3cSopenharmony_ci part_name = "window_manager" 17523b3eb3cSopenharmony_ci lib_names = [ "windowstage" ] 17623b3eb3cSopenharmony_ci }, 17723b3eb3cSopenharmony_ci 17823b3eb3cSopenharmony_ci # The napi dynamic librarys of ability subsystem. 17923b3eb3cSopenharmony_ci { 18023b3eb3cSopenharmony_ci label = "//foundation/ability/ability_runtime/frameworks/simulator/napi_module/ability:ability_napi" 18123b3eb3cSopenharmony_ci subsystem_name = "ability" 18223b3eb3cSopenharmony_ci part_name = "ability_runtime" 18323b3eb3cSopenharmony_ci }, 18423b3eb3cSopenharmony_ci { 18523b3eb3cSopenharmony_ci label = "//foundation/ability/ability_runtime/frameworks/simulator/napi_module/ability_constant:abilityconstant" 18623b3eb3cSopenharmony_ci subsystem_name = "ability" 18723b3eb3cSopenharmony_ci part_name = "ability_runtime" 18823b3eb3cSopenharmony_ci }, 18923b3eb3cSopenharmony_ci { 19023b3eb3cSopenharmony_ci label = "//foundation/ability/ability_runtime/frameworks/simulator/napi_module/ability_context:abilitycontext_napi" 19123b3eb3cSopenharmony_ci subsystem_name = "ability" 19223b3eb3cSopenharmony_ci part_name = "ability_runtime" 19323b3eb3cSopenharmony_ci }, 19423b3eb3cSopenharmony_ci { 19523b3eb3cSopenharmony_ci label = "//foundation/ability/ability_runtime/frameworks/simulator/napi_module/ability_stage:abilitystage" 19623b3eb3cSopenharmony_ci subsystem_name = "ability" 19723b3eb3cSopenharmony_ci part_name = "ability_runtime" 19823b3eb3cSopenharmony_ci }, 19923b3eb3cSopenharmony_ci { 20023b3eb3cSopenharmony_ci label = "//foundation/ability/ability_runtime/frameworks/simulator/napi_module/ability_stage_context:abilitystagecontext_napi" 20123b3eb3cSopenharmony_ci subsystem_name = "ability" 20223b3eb3cSopenharmony_ci part_name = "ability_runtime" 20323b3eb3cSopenharmony_ci }, 20423b3eb3cSopenharmony_ci { 20523b3eb3cSopenharmony_ci label = "//foundation/ability/ability_runtime/frameworks/simulator/napi_module/application_context:applicationcontext_napi" 20623b3eb3cSopenharmony_ci subsystem_name = "ability" 20723b3eb3cSopenharmony_ci part_name = "ability_runtime" 20823b3eb3cSopenharmony_ci }, 20923b3eb3cSopenharmony_ci { 21023b3eb3cSopenharmony_ci label = "//foundation/ability/ability_runtime/frameworks/simulator/napi_module/caller:caller_napi" 21123b3eb3cSopenharmony_ci subsystem_name = "ability" 21223b3eb3cSopenharmony_ci part_name = "ability_runtime" 21323b3eb3cSopenharmony_ci }, 21423b3eb3cSopenharmony_ci { 21523b3eb3cSopenharmony_ci label = "//foundation/ability/ability_runtime/frameworks/simulator/napi_module/callee:callee" 21623b3eb3cSopenharmony_ci subsystem_name = "ability" 21723b3eb3cSopenharmony_ci part_name = "ability_runtime" 21823b3eb3cSopenharmony_ci }, 21923b3eb3cSopenharmony_ci { 22023b3eb3cSopenharmony_ci label = "//foundation/ability/ability_runtime/frameworks/simulator/napi_module/context:context_napi" 22123b3eb3cSopenharmony_ci subsystem_name = "ability" 22223b3eb3cSopenharmony_ci part_name = "ability_runtime" 22323b3eb3cSopenharmony_ci }, 22423b3eb3cSopenharmony_ci { 22523b3eb3cSopenharmony_ci label = "//foundation/ability/ability_runtime/frameworks/simulator/napi_module/configuration_constant:configurationconstant" 22623b3eb3cSopenharmony_ci subsystem_name = "ability" 22723b3eb3cSopenharmony_ci part_name = "ability_runtime" 22823b3eb3cSopenharmony_ci }, 22923b3eb3cSopenharmony_ci ] 23023b3eb3cSopenharmony_ci }, 23123b3eb3cSopenharmony_ci ] 23223b3eb3cSopenharmony_ci} 23323b3eb3cSopenharmony_ci 23423b3eb3cSopenharmony_ci# All dynamic libraries to be copied to the path "/previewer/common/bin/module/", 23523b3eb3cSopenharmony_ci# which are called by the napi framework, can be added to this script. 23623b3eb3cSopenharmony_ciforeach(module, napi_modules) { 23723b3eb3cSopenharmony_ci ohos_copy("copy_napi_${module.prefix}libs") { 23823b3eb3cSopenharmony_ci deps = [] 23923b3eb3cSopenharmony_ci sources = [] 24023b3eb3cSopenharmony_ci foreach(shard_lib, module.shard_libs) { 24123b3eb3cSopenharmony_ci subsystem_name = shard_lib.subsystem_name 24223b3eb3cSopenharmony_ci part_name = shard_lib.part_name 24323b3eb3cSopenharmony_ci deps += [ shard_lib.label ] 24423b3eb3cSopenharmony_ci out_path = get_label_info(shard_lib.label, "root_out_dir") 24523b3eb3cSopenharmony_ci lib_names = [] 24623b3eb3cSopenharmony_ci if (defined(shard_lib.lib_names)) { 24723b3eb3cSopenharmony_ci lib_names += shard_lib.lib_names 24823b3eb3cSopenharmony_ci } else { 24923b3eb3cSopenharmony_ci cur_lib = get_label_info(shard_lib.label, "name") 25023b3eb3cSopenharmony_ci lib_names += [ string_replace(cur_lib, "lib", "", 1) ] 25123b3eb3cSopenharmony_ci } 25223b3eb3cSopenharmony_ci foreach(lib_name, lib_names) { 25323b3eb3cSopenharmony_ci sources += [ "${out_path}/${subsystem_name}/${part_name}/lib${lib_name}${dylib_suffix}" ] 25423b3eb3cSopenharmony_ci } 25523b3eb3cSopenharmony_ci } 25623b3eb3cSopenharmony_ci 25723b3eb3cSopenharmony_ci # Set the output directory for all dynamic libraries. 25823b3eb3cSopenharmony_ci if (module.prefix == "") { 25923b3eb3cSopenharmony_ci outputs = [ "${root_out_dir}/common/samples/module/{{source_file_part}}" ] 26023b3eb3cSopenharmony_ci } else { 26123b3eb3cSopenharmony_ci outputs = [ "${root_out_dir}/common/samples/module/${module.prefix}/{{source_file_part}}" ] 26223b3eb3cSopenharmony_ci } 26323b3eb3cSopenharmony_ci } 26423b3eb3cSopenharmony_ci} 26523b3eb3cSopenharmony_ci 26623b3eb3cSopenharmony_ci# All dynamic libraries to be copied to the path "/previewer/common/bin/", 26723b3eb3cSopenharmony_ci# which are related to the previewer, can be added to this script. 26823b3eb3cSopenharmony_ciohos_copy("copy_preview_shared_library") { 26923b3eb3cSopenharmony_ci deps = [] 27023b3eb3cSopenharmony_ci foreach(module, napi_modules) { 27123b3eb3cSopenharmony_ci deps += [ ":copy_napi_${module.prefix}libs" ] 27223b3eb3cSopenharmony_ci } 27323b3eb3cSopenharmony_ci 27423b3eb3cSopenharmony_ci sources = [ 27523b3eb3cSopenharmony_ci "//base/global/system_resources/fonts", 27623b3eb3cSopenharmony_ci "//third_party/icu/ohos_icu4j/data/icudt72l.dat", 27723b3eb3cSopenharmony_ci "//third_party/skia/src/ports/skia_ohos/config/fontconfig.json", 27823b3eb3cSopenharmony_ci ] 27923b3eb3cSopenharmony_ci 28023b3eb3cSopenharmony_ci foreach(item, common_bin) { 28123b3eb3cSopenharmony_ci subsystem_name = item.subsystem_name 28223b3eb3cSopenharmony_ci part_name = item.part_name 28323b3eb3cSopenharmony_ci deps += [ item.label ] 28423b3eb3cSopenharmony_ci out_path = get_label_info(item.label, "root_out_dir") 28523b3eb3cSopenharmony_ci lib_names = [] 28623b3eb3cSopenharmony_ci if (defined(item.lib_names)) { 28723b3eb3cSopenharmony_ci lib_names += item.lib_names 28823b3eb3cSopenharmony_ci } else { 28923b3eb3cSopenharmony_ci lib_names += 29023b3eb3cSopenharmony_ci [ string_replace(get_label_info(item.label, "name"), "lib", "", 1) ] 29123b3eb3cSopenharmony_ci } 29223b3eb3cSopenharmony_ci foreach(lib_name, lib_names) { 29323b3eb3cSopenharmony_ci sources += [ "${out_path}/${subsystem_name}/${part_name}/lib${lib_name}${dylib_suffix}" ] 29423b3eb3cSopenharmony_ci } 29523b3eb3cSopenharmony_ci } 29623b3eb3cSopenharmony_ci 29723b3eb3cSopenharmony_ci outputs = [ "${root_out_dir}/common/samples/{{source_file_part}}" ] 29823b3eb3cSopenharmony_ci} 299