1# Copyright (c) 2023 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("./gn/config.gni") 16 17template("previewer_executable") { 18 ohos_executable(target_name) { 19 subsystem_name = "ide" 20 part_name = invoker.part_name 21 output_name = invoker.output_name 22 sources = invoker.src 23 configs = [ ":myconfig" ] 24 include_dirs = [ 25 "./util/", 26 "./cli/", 27 "./mock/", 28 "./jsapp/", 29 ] 30 31 include_dirs += invoker.includes 32 deps = [ "//third_party/bounds_checking_function:libsec_static" ] 33 deps += invoker.deps 34 libs = invoker.libs 35 36 if (platform == "mingw_x86_64") { 37 defines = [ "NOGDI" ] 38 if (defined(enable_component_test) && enable_component_test) { 39 defines += [ "COMPONENT_TEST_ENABLED" ] 40 } 41 ldflags = [ 42 "-static", 43 "-lws2_32", 44 "-lshlwapi", 45 "-ldbghelp", 46 ] 47 } else { 48 defines = [] 49 } 50 cflags = [ 51 "-std=c++17", 52 "-Wno-deprecated-declarations", 53 "-Wno-reorder", 54 "-Wno-sign-compare", 55 ] 56 } 57} 58 59group("rich_ace_previewer") { 60 if (platform == "mingw_x86_64") { 61 deps = [ ":rich_previewer(${windows_buildtool})" ] 62 } else if (platform == "mac_arm64" || platform == "mac_x64") { 63 deps = [ ":rich_previewer(${mac_buildtool})" ] 64 } else if (platform == "linux_x64") { 65 deps = [ ":rich_previewer(${linux_buildtool})" ] 66 } 67} 68 69group("lite_ace_previewer") { 70 if (platform == "mingw_x86_64") { 71 deps = [ ":lite_previewer(${windows_buildtool})" ] 72 } else if (platform == "mac_arm64" || platform == "mac_x64") { 73 deps = [ ":lite_previewer(${mac_buildtool})" ] 74 } else if (platform == "linux_x64") { 75 deps = [ ":lite_previewer(${linux_buildtool})" ] 76 } 77} 78 79previewer_executable("rich_previewer") { 80 part_name = "previewer" 81 output_name = "Previewer" 82 src = [ "RichPreviewer.cpp" ] 83 includes = os_include_dirs 84 includes += [ 85 "./mock/rich/", 86 "./jsapp/rich/", 87 ] 88 libs = [] 89 deps = [ 90 "cli:cli_rich", 91 "jsapp:jsapp_rich", 92 "mock:mock_rich", 93 "util:util_rich", 94 "//third_party/libwebsockets:websockets_static", 95 ] 96} 97 98previewer_executable("lite_previewer") { 99 part_name = "litePreviewer" 100 output_name = "Simulator" 101 src = [ "ThinPreviewer.cpp" ] 102 includes = [ 103 "//foundation/ace/frameworks/base/utils/", 104 "./mock/lite/", 105 "./jsapp/lite/", 106 "//foundation/arkui/ui_lite/interfaces/innerkits/", 107 "//foundation/graphic/graphic_utils_lite/interfaces/kits/", 108 "//foundation/graphic/graphic_utils_lite/interfaces/innerkits/", 109 "//foundation/arkui/ui_lite/frameworks/dock/", 110 ] 111 deps = [ 112 "cli:cli_lite", 113 "jsapp:jsapp_lite", 114 "mock:mock_lite", 115 "util:util_lite", 116 "//foundation/arkui/ace_engine_lite/frameworks/targets/simulator:ace_lite", 117 "//third_party/libwebsockets:websockets_static", 118 ] 119 if (platform == "mingw_x86_64") { 120 libs = [ "psapi" ] 121 } else if (platform == "mac_arm64" || platform == "mac_x64") { 122 libs = [] 123 } else if (platform == "linux_x64" || platform == "linux_arm64") { 124 libs = [] 125 } 126} 127 128config("myconfig") { 129 cflags = [ 130 "-std=c++17", 131 "-Wno-error=implicit-fallthrough", 132 ] 133} 134 135# copy liteWearable config dir 136ohos_copy("copy_previewer_fonts_lite") { 137 sources = [ 138 "//foundation/arkui/ui_lite/tools/qt/simulator/font/SourceHanSansSC-Regular.otf", 139 "//foundation/arkui/ui_lite/tools/qt/simulator/font/font.bin", 140 "//foundation/arkui/ui_lite/tools/qt/simulator/font/line_cj.brk", 141 ] 142 outputs = [ target_out_dir + "/previewer/liteWearable/config/" + 143 "/{{source_file_part}}" ] 144 module_source_dir = target_out_dir + "/previewer/liteWearable/config/" 145 module_install_name = "" 146} 147 148# copy ide dynamic lib 149ohos_copy("copy_ide_library") { 150 if (platform == "mingw_x86_64") { 151 suffix = ".dll" 152 } else if (platform == "mac_arm64" || platform == "mac_x64") { 153 suffix = ".dylib" 154 } else if (platform == "linux_x64" || platform == "linux_arm64") { 155 suffix = ".so" 156 } 157 deps = [] 158 sources = [] 159 160 deps += [ "util:ide_util" ] 161 out_path = get_label_info("util:ide_util", "root_out_dir") 162 sources += [ out_path + "/ide/previewer/libide_util" + suffix ] 163 164 deps += [ "jsapp/rich/external:ide_extension" ] 165 out_path = get_label_info("jsapp/rich/external:ide_extension", "root_out_dir") 166 sources += [ out_path + "/ide/previewer/libide_extension" + suffix ] 167 168 outputs = [ target_out_dir + "/previewer/common/bin/{{source_file_part}}" ] 169 module_source_dir = target_out_dir + "/previewer/common/bin/" 170 module_install_name = "" 171} 172