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