diff -rub libaom-3.12.1.orig/apps/aomdec.c libaom-3.12.1/apps/aomdec.c --- libaom-3.12.1.orig/apps/aomdec.c 2025-04-12 04:37:49.000000000 +0800 +++ libaom-3.12.1/apps/aomdec.c 2025-08-05 18:27:51.862471098 +0800 @@ -43,7 +43,7 @@ #include "common/y4menc.h" #if CONFIG_LIBYUV -#include "third_party/libyuv/include/libyuv/scale.h" +#include #endif static const char *exec_name; diff -rub libaom-3.12.1.orig/apps/aomenc.c libaom-3.12.1/apps/aomenc.c --- libaom-3.12.1.orig/apps/aomenc.c 2025-04-12 04:37:49.000000000 +0800 +++ libaom-3.12.1/apps/aomenc.c 2025-08-05 18:27:51.862735438 +0800 @@ -47,7 +47,7 @@ #include "stats/rate_hist.h" #if CONFIG_LIBYUV -#include "third_party/libyuv/include/libyuv/scale.h" +#include #endif /* Swallow warnings about unused results of fread/fwrite */ diff -rub libaom-3.12.1.orig/CMakeLists.txt libaom-3.12.1/CMakeLists.txt --- libaom-3.12.1.orig/CMakeLists.txt 2025-04-12 04:37:49.000000000 +0800 +++ libaom-3.12.1/CMakeLists.txt 2025-08-05 18:27:51.862239400 +0800 @@ -473,22 +473,14 @@ endif() if(CONFIG_LIBYUV OR CONFIG_TUNE_BUTTERAUGLI) - add_library(yuv OBJECT ${AOM_LIBYUV_SOURCES}) - if(NOT MSVC) - target_compile_options(yuv PRIVATE -Wno-shadow) - # Many functions in libyuv trigger this warning when enabled with gcc and - # clang. - is_flag_present(AOM_CXX_FLAGS "-Wmissing-declarations" flag_present) - if(flag_present) - target_compile_options(yuv PRIVATE -Wno-missing-declarations) - endif() - # Many functions in libyuv trigger this warning when enabled with clang. - is_flag_present(AOM_CXX_FLAGS "-Wmissing-prototypes" flag_present) - if(flag_present) - target_compile_options(yuv PRIVATE -Wno-missing-prototypes) - endif() - endif() - include_directories("${AOM_ROOT}/third_party/libyuv/include") + find_package(PkgConfig REQUIRED) + pkg_check_modules(libyuv REQUIRED libyuv) + add_library(system_libyuv INTERFACE) + target_link_libraries(system_libyuv INTERFACE ${libyuv_LIBRARIES}) + target_link_directories(system_libyuv INTERFACE ${libyuv_LIBRARY_DIRS}) + target_link_options(system_libyuv INTERFACE ${libyuv_LDFLAGS_OTHER}) + target_include_directories(system_libyuv INTERFACE ${libyuv_INCLUDE_DIRS}) + target_compile_options(system_libyuv INTERFACE ${libyuv_CFLAGS_OTHER}) endif() if(CONFIG_AV1_ENCODER) @@ -611,10 +603,10 @@ set_target_properties(aom_static PROPERTIES LINKER_LANGUAGE CXX) endif() - list(APPEND AOM_LIB_TARGETS yuv) - target_sources(aom PRIVATE $) + list(APPEND AOM_LIB_TARGETS system_libyuv) + target_link_libraries(aom PRIVATE system_libyuv) if(BUILD_SHARED_LIBS) - target_sources(aom_static PRIVATE $) + target_link_libraries(aom_static PRIVATE system_libyuv) endif() endif() @@ -763,7 +755,7 @@ if(CONFIG_LIBYUV) # Add to existing targets. foreach(aom_app ${AOM_APP_TARGETS}) - target_sources(${aom_app} PRIVATE $) + target_link_libraries(${aom_app} PRIVATE system_libyuv) set_property(TARGET ${aom_app} PROPERTY LINKER_LANGUAGE CXX) endforeach() endif()