Skip to content

Commit

Permalink
Add GN builds on loongarch platform.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Commit-Queue: Frank Barchard <[email protected]>
  • Loading branch information
Cheng Yangyang authored and Frank Barchard committed Jun 19, 2023
1 parent eaaf27b commit c0031cf
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
52 changes: 52 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions libyuv.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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")

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

0 comments on commit c0031cf

Please sign in to comment.