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