From c0031cfd95e131c7b11be41d0272455cc63f10f4 Mon Sep 17 00:00:00 2001 From: Cheng Yangyang Date: Thu, 15 Jun 2023 17:05:07 +0800 Subject: [PATCH] Add GN builds on loongarch platform. Currently, chromium has merged loongarch config file in bug:1454442, and so we resubmit gn builds support for loongarch. Bug: chromium:1289502 Change-Id: Iac83f5ea016945f7d9cc5f6de20d4c561bab6347 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/4615589 Reviewed-by: Frank Barchard Commit-Queue: Frank Barchard --- BUILD.gn | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ libyuv.gni | 5 +++++ 2 files changed, 57 insertions(+) diff --git a/BUILD.gn b/BUILD.gn index 133336dd..df019b88 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -36,6 +36,12 @@ config("libyuv_config") { if (libyuv_disable_rvv) { defines += [ "LIBYUV_DISABLE_RVV" ] } + if (!libyuv_use_lsx) { + defines += [ "LIBYUV_DISABLE_LSX" ] + } + if (!libyuv_use_lasx) { + defines += [ "LIBYUV_DISABLE_LASX" ] + } } # This target is built when no specific target is specified on the command line. @@ -74,6 +80,14 @@ group("libyuv") { deps += [ ":libyuv_msa" ] } + if (libyuv_use_lsx) { + deps += [ ":libyuv_lsx"] + } + + if (libyuv_use_lasx) { + deps += [ ":libyuv_lasx"] + } + if (!is_ios && !libyuv_disable_jpeg) { # Make sure that clients of libyuv link with libjpeg. This can't go in # libyuv_internal because in Windows x64 builds that will generate a clang @@ -236,6 +250,44 @@ if (libyuv_use_msa) { } } +if (libyuv_use_lsx) { + static_library("libyuv_lsx") { + sources = [ + # LSX Source Files + "source/row_lsx.cc", + "source/rotate_lsx.cc", + "source/scale_lsx.cc", + ] + + cflags_cc = [ + "-mlsx", + "-Wno-c++11-narrowing", + ] + + deps = [ ":libyuv_internal" ] + + public_configs = [ ":libyuv_config" ] + } +} + +if (libyuv_use_lasx) { + static_library("libyuv_lasx") { + sources = [ + # LASX Source Files + "source/row_lasx.cc", + ] + + cflags_cc = [ + "-mlasx", + "-Wno-c++11-narrowing", + ] + + deps = [ ":libyuv_internal" ] + + public_configs = [ ":libyuv_config" ] + } +} + if (libyuv_include_tests) { config("libyuv_unittest_warnings_config") { if (!is_win) { diff --git a/libyuv.gni b/libyuv.gni index 0a6c4453..343160c3 100644 --- a/libyuv.gni +++ b/libyuv.gni @@ -7,6 +7,7 @@ # be found in the AUTHORS file in the root of the source tree. import("//build/config/arm.gni") +import("//build/config/loongarch64.gni") import("//build/config/mips.gni") import("//build_overrides/build.gni") @@ -21,4 +22,8 @@ declare_args() { (current_cpu == "mips64el" || current_cpu == "mipsel") && mips_use_msa libyuv_use_mmi = (current_cpu == "mips64el" || current_cpu == "mipsel") && mips_use_mmi + libyuv_use_lsx = + (current_cpu == "loong64") && loongarch64_use_lsx + libyuv_use_lasx = + (current_cpu == "loong64") && loongarch64_use_lasx }