From b8917293d0bdb9bf473d6a0348a151616d974069 Mon Sep 17 00:00:00 2001 From: xuchang Date: Fri, 22 Sep 2023 19:55:07 -0700 Subject: [PATCH] =?UTF-8?q?IssueNo:=20#I83QMS=201=E3=80=81=E5=85=BC?= =?UTF-8?q?=E5=AE=B9mac=E7=BC=96=E8=AF=91=EF=BC=9B2=E3=80=81ohos=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E5=83=8F=E7=B4=A0=E5=AF=86=E5=BA=A6=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=B5=AE=E7=82=B9=E6=95=B0=E8=A1=A8=E7=A4=BA=20Description:=20?= =?UTF-8?q?1=E3=80=81=E5=85=BC=E5=AE=B9mac=E7=BC=96=E8=AF=91=EF=BC=9B2?= =?UTF-8?q?=E3=80=81ohos=E8=AE=BE=E5=A4=87=E5=83=8F=E7=B4=A0=E5=AF=86?= =?UTF-8?q?=E5=BA=A6=E4=BD=BF=E7=94=A8=E6=B5=AE=E7=82=B9=E6=95=B0=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=20Sig:=20OpenHarmony-SIG/flutter-engine=20Feature=20o?= =?UTF-8?q?r=20Bugfix:=20Feature=20Binary=20Source:=20No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuchang --- common/config.gni | 2 +- shell/platform/ohos/napi/platform_view_ohos_napi.cpp | 6 +++--- tools/gn | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/common/config.gni b/common/config.gni index afb8f0b2b2..21a43ba4f8 100644 --- a/common/config.gni +++ b/common/config.gni @@ -132,4 +132,4 @@ if (flutter_prebuilt_dart_sdk) { # see https://github.com/flutter/flutter/issues/74322 build_engine_artifacts = current_toolchain == host_toolchain || - (is_linux && !is_chromeos && current_cpu != "arm") || is_mac || is_win + (is_linux && !is_chromeos && current_cpu != "arm") || is_mac || is_win || is_ohos diff --git a/shell/platform/ohos/napi/platform_view_ohos_napi.cpp b/shell/platform/ohos/napi/platform_view_ohos_napi.cpp index 6eec795900..9dd3f6b272 100644 --- a/shell/platform/ohos/napi/platform_view_ohos_napi.cpp +++ b/shell/platform/ohos/napi/platform_view_ohos_napi.cpp @@ -693,13 +693,13 @@ napi_value PlatformViewOHOSNapi::nativeSetViewportMetrics( } LOGD("nativeSetViewportMetrics::shell_holder : %{public}ld", shell_holder); - int64_t devicePixelRatio; - ret = napi_get_value_int64(env, args[1], &devicePixelRatio); + double devicePixelRatio; + ret = napi_get_value_double(env, args[1], &devicePixelRatio); if (ret != napi_ok) { LOGE("nativeSetViewportMetrics napi_get_value_int64 error"); return nullptr; } - LOGD("nativeSetViewportMetrics::devicePixelRatio : %{public}ld", + LOGD("nativeSetViewportMetrics::devicePixelRatio : %{public}lf", devicePixelRatio); int64_t physicalWidth; diff --git a/tools/gn b/tools/gn index 5882b343a6..99b7b88e79 100755 --- a/tools/gn +++ b/tools/gn @@ -343,6 +343,8 @@ def to_gn_args(args): gn_args['target_os'] = args.target_os gn_args['target_cpu'] = get_target_cpu(args) gn_args['dart_target_arch'] = gn_args['target_cpu'] + if (args.target_os == 'ohos'): + gn_args['host_cpu'] = get_host_cpu() print("ARGS.target_os:%s-%s" % (args.target_os,gn_args['target_os'] ) ) # We cannot cross-compile for 32 bit arm on a Windows host. We work around @@ -451,7 +453,7 @@ def to_gn_args(args): else: gn_args['skia_use_gl'] = args.target_os != 'fuchsia' - if sys.platform == 'darwin' and args.target_os not in ['android', 'fuchsia']: + if sys.platform == 'darwin' and args.target_os not in ['android', 'fuchsia', 'ohos']: # OpenGL is deprecated on macOS > 10.11. # This is not necessarily needed but enabling this until we have a way to # build a macOS metal only shell and a gl only shell. -- Gitee