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 <fbarchard@chromium.org>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
Cheng Yangyang 2023-06-15 17:05:07 +08:00 committed by Frank Barchard
parent eaaf27ba91
commit c0031cfd95
2 changed files with 57 additions and 0 deletions

View File

@ -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) {

View File

@ -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
}