Skip to content

Commit

Permalink
Do not use AVIF_LOCAL for libxml2 and gtest. (#2097)
Browse files Browse the repository at this point in the history
- this prevents magic happening when finding libxml2 (hence the CI
  fixes)
- switch some old AVIF_LOCAL_* and add a warning

This fixes the Windows CI.
  • Loading branch information
vrabaud authored Apr 11, 2024
1 parent f1b936d commit c92d9ec
Show file tree
Hide file tree
Showing 20 changed files with 145 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-linux-golden-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
-DAVIF_CODEC_AOM=LOCAL -DAVIF_LIBYUV=LOCAL
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON
-DAVIF_LOCAL_LIBXML2=ON
-DAVIF_LIBXML2=LOCAL
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GOLDEN_TESTS=ON
-DAVIF_ENABLE_GTEST=OFF -DAVIF_ENABLE_WERROR=ON
-DGOLDEN_TESTS_OUTPUT_DIR=${{ runner.temp }}/golden_tests
Expand Down
95 changes: 95 additions & 0 deletions .github/workflows/ci-linux-static-old-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: CI Unix Static For AVIF_LOCAL
on: [push, pull_request]

permissions:
contents: read

# Cancel the workflow if a new one is triggered from the same PR, branch, or tag, except on main.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build-static:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
build-type: [Release, Debug]
include:
- runs-on: ubuntu-latest
compiler: gcc
gcc: 13

steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Set GCC & G++ compiler (on Linux)
run: echo "CC=gcc-${{matrix.gcc}}" >> $GITHUB_ENV && echo "CXX=g++-${{matrix.gcc}}" >> $GITHUB_ENV
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.x'
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
profile: minimal
toolchain: stable
override: true
- name: Install cargo-c (linux)
env:
LINK: https://github.com/lu-zero/cargo-c/releases/latest/download
CARGO_C_FILE: cargo-c-x86_64-unknown-linux-musl.tar.gz
run: |
curl -L $LINK/$CARGO_C_FILE | tar xz -C ~/.cargo/bin
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@959f1116cf9f1ae42fff8ec1a4aaae6d4a0e348b # v2.0.1
with:
# CMake version 3.18 is required to build libxml2.
cmake-version: '3.18.x'
- name: Print cmake version
run: cmake --version
- uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1
- uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # v4
- run: pip install meson
- name: Print ImageMagick version
run: convert --version
- name: Prepare libavif (cmake)
run: >
mkdir build && cd build
cmake .. -G Ninja
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DBUILD_SHARED_LIBS=OFF
-DAVIF_CODEC_AOM=ON -DAVIF_LOCAL_AOM=ON
-DAVIF_CODEC_DAV1D=ON -DAVIF_LOCAL_DAV1D=ON
-DAVIF_CODEC_RAV1E=ON -DAVIF_LOCAL_RAV1E=ON
-DAVIF_CODEC_SVT=ON -DAVIF_LOCAL_SVT=ON
-DAVIF_CODEC_LIBGAV1=ON -DAVIF_LOCAL_LIBGAV1=ON
-DAVIF_LOCAL_LIBSHARPYUV=ON -DAVIF_LOCAL_LIBXML2=ON -DAVIF_LOCAL_LIBYUV=ON
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_LOCAL_GTEST=ON
-DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON
-DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON
-DAVIF_ENABLE_EXPERIMENTAL_AVIR=ON
-DAVIF_ENABLE_WERROR=ON
- name: Cache cargo registry
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
continue-on-error: true
with:
path: ~/.cargo/registry/cache
key: cargo-registry-${{ runner.os }}-${{ hashFiles('ext/rav1e/Cargo.lock') }}-unix-static
restore-keys: |
cargo-registry-${{ runner.os }}-${{ hashFiles('ext/rav1e/Cargo.lock') }}-
cargo-registry-${{ runner.os }}-
- name: Build libavif (ninja)
working-directory: ./build
run: ninja
- name: Run AVIF Tests
working-directory: ./build
run: ctest -j $(getconf _NPROCESSORS_ONLN) --output-on-failure
- name: Check static link bundling
run: |
cc -o avifenc -I./apps/shared -I./third_party/iccjpeg -I./include apps/avifenc.c \
apps/shared/*.c third_party/iccjpeg/iccjpeg.c build/libavif.a \
-lpng -ljpeg -lz -lm -ldl -lstdc++
./avifenc --help
2 changes: 1 addition & 1 deletion .github/workflows/ci-mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
-DAVIF_CODEC_DAV1D=SYSTEM
-DAVIF_LIBSHARPYUV=LOCAL -DAVIF_LIBYUV=SYSTEM
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_LOCAL_GTEST=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_BUILD_GDK_PIXBUF=ON -DCMAKE_INSTALL_PREFIX=./install
-DAVIF_ENABLE_WERROR=ON
- name: Build libavif (ninja)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-unix-shared-installed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
-DAVIF_CODEC_AOM_DECODE=OFF -DAVIF_CODEC_AOM_ENCODE=ON
-DAVIF_CODEC_DAV1D=SYSTEM
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_LOCAL_GTEST=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_BUILD_GDK_PIXBUF=ON -DCMAKE_INSTALL_PREFIX=./install
-DAVIF_ENABLE_WERROR=ON ${{ env.CMAKE_AVIF_FLAGS }}
- name: Build libavif (ninja)
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
-DAVIF_CODEC_DAV1D=SYSTEM
-DAVIF_ENABLE_WUNUSED_RESULT=ON -DAVIF_ENABLE_WERROR=ON
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_LOCAL_GTEST=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_BUILD_GDK_PIXBUF=ON ${{ env.CMAKE_AVIF_FLAGS }}
-DCMAKE_INSTALL_PREFIX=./install
- name: Build libavif with [[nodiscard]] (ninja)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-unix-shared-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
-DAVIF_LIBYUV=${{ matrix.libyuv }}
-DAVIF_LIBSHARPYUV=LOCAL
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_LOCAL_GTEST=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_WERROR=ON
- name: Build libavif (ninja)
working-directory: ./build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-unix-static-av2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
-DAVIF_LIBYUV=LOCAL
-DAVIF_LIBSHARPYUV=LOCAL
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_LOCAL_GTEST=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_WERROR=ON
- name: Cache cargo registry
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-unix-static-sanitized.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
-DAVIF_CODEC_AOM=LOCAL -DAVIF_CODEC_DAV1D=LOCAL
-DAVIF_LIBYUV=LOCAL -DAVIF_LIBSHARPYUV=LOCAL
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_LOCAL_GTEST=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
env:
CFLAGS: -fsanitize=${{ matrix.sanitizer }}
CXXFLAGS: -fsanitize=${{ matrix.sanitizer }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci-unix-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ jobs:
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@959f1116cf9f1ae42fff8ec1a4aaae6d4a0e348b # v2.0.1
with:
# CMake version 3.17 is required to build libwebp (which libsharpyuv is part of) on macOS.
cmake-version: '3.17.x'
# CMake version 3.18 is required to build libxml2.
cmake-version: '3.18.x'
- name: Print cmake version
run: cmake --version
- uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1
Expand All @@ -72,10 +72,10 @@ jobs:
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DBUILD_SHARED_LIBS=OFF
-DAVIF_CODEC_AOM=LOCAL -DAVIF_CODEC_DAV1D=LOCAL
-DAVIF_CODEC_RAV1E=LOCAL -DAVIF_CODEC_SVT=LOCAL
-DAVIF_CODEC_LIBGAV1=LOCAL -DAVIF_LIBYUV=LOCAL
-DAVIF_LIBSHARPYUV=LOCAL
-DAVIF_CODEC_LIBGAV1=LOCAL
-DAVIF_LIBSHARPYUV=LOCAL -DAVIF_LIBXML2=LOCAL -DAVIF_LIBYUV=LOCAL
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_LOCAL_GTEST=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON
-DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON
-DAVIF_ENABLE_EXPERIMENTAL_AVIR=ON
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# https://gitlab.kitware.com/cmake/cmake/-/issues/20585
# * Runs ext/*.cmd as Windows batch files rather than using bash. This is
# important for ext/svt.cmd, to prevent it from running ext/svt.sh.
# * Builds with local libjpeg (-DAVIF_LOCAL_JPEG=ON).
# * Builds with local zlib and libpng (-DAVIF_LOCAL_ZLIBPNG=ON).
# * Builds with local libjpeg (-DAVIF_JPEG=LOCAL).
# * Builds with local zlib and libpng (-DAVIF_ZLIBPNG=LOCAL).

name: CI Windows
on: [push, pull_request]
Expand Down Expand Up @@ -90,11 +90,11 @@ jobs:
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF
-DAVIF_CODEC_AOM=LOCAL -DAVIF_CODEC_DAV1D=LOCAL
-DAVIF_CODEC_RAV1E=LOCAL -DAVIF_CODEC_SVT=LOCAL
-DAVIF_CODEC_LIBGAV1=LOCAL -DAVIF_LIBYUV=LOCAL
-DAVIF_LOCAL_JPEG=ON -DAVIF_LIBSHARPYUV=LOCAL
-DAVIF_LOCAL_ZLIBPNG=ON
-DAVIF_CODEC_LIBGAV1=LOCAL
-DAVIF_JPEG=LOCAL -DAVIF_LIBSHARPYUV=LOCAL -DAVIF_LIBXML2=LOCAL
-DAVIF_LIBYUV=LOCAL -DAVIF_ZLIBPNG=LOCAL
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_LOCAL_GTEST=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON
-DAVIF_ENABLE_EXPERIMENTAL_GAIN_MAP=ON
-DAVIF_ENABLE_EXPERIMENTAL_AVIR=ON -DAVIF_ENABLE_WERROR=ON
Expand Down
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ The changes are relative to the previous release, unless the baseline is specifi
crbug.com/1504792 by [Fudan University](https://secsys.fudan.edu.cn/).
* For codecs, AVIF_CODEC_* and AVIF_LOCAL_* are now merged into AVIF_CODEC_*
that can only take the values: OFF, LOCAL or SYSTEM.
* For the libyuv, libsharpyuv, zlibpng and jpeg dependencies, AVIF_LOCAL_* is
now replaced by flags AVIF_* that can take the values: OFF, LOCAL or SYSTEM.
* For the gtest, jpeg, libsharpyuv, libxml2, libyuv and zlibpng dependencies,
AVIF_LOCAL_* is now replaced by flags AVIF_* that can take the values:
OFF, LOCAL or SYSTEM.
* src/reformat.c: Allocate the threadData array directly.
* AVIF_ENABLE_WERROR is set to OFF by default.
* Fix wrong alpha plane deallocation when decoded tile pixel format does not
Expand Down
24 changes: 11 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function(set_local_or_system_option VAR DEFAULT TEXT)
else()
set(DEFAULT "SYSTEM")
endif()
message(WARNING "Setting AVIF_LOCAL_${VAR} is deprecated. " "Set AVIF_${VAR} to ${DEFAULT} instead.")
elseif(DEFINED AVIF_${VAR})
set(DEFAULT ${AVIF_${VAR}})
endif()
Expand Down Expand Up @@ -110,8 +111,9 @@ cmake_dependent_option(
AVIF_CODEC_AOM_ENCODE "if AVIF_CODEC_AOM is on, use/offer libaom's encoder" ON "NOT AVIF_CODEC_AOM STREQUAL OFF" OFF
)

option(AVIF_LOCAL_GTEST
"Build the GoogleTest framework by providing your own copy of the repo in ext/googletest (see Local Builds in README)" OFF
set_local_or_system_option(
"GTEST" OFF
"Build the GoogleTest framework by providing your own copy of the repo in ext/googletest (see Local Builds in README)"
)
option(AVIF_LOCAL_FUZZTEST
"Build the Google FuzzTest framework by providing your own copy of the repo in ext/fuzztest (see Local Builds in README)"
Expand Down Expand Up @@ -248,17 +250,13 @@ if(AVIF_LIBSHARPYUV_ENABLED)
avif_target_link_library(sharpyuv::sharpyuv)
endif(AVIF_LIBSHARPYUV_ENABLED)

option(AVIF_LOCAL_LIBXML2 "Build libxml2 by providing your own copy inside the ext subdir. \
libxml2 is used when AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP is ON" OFF
set_local_or_system_option(
"LIBXML2" "OFF" "Build libxml2 by providing your own copy inside the ext subdir. \
libxml2 is used when AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP is ON"
)

if(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP)
if(NOT TARGET LibXml2::LibXml2)
if(AVIF_LOCAL_LIBXML2)
include(LocalLibXml2)
else()
find_package(LibXml2 QUIET)
endif()
endif()
check_avif_option(AVIF_LIBXML2 TARGET LibXml2::LibXml2 PKG_NAME LibXml2)
endif()
# ---------------------------------------------------------------------------------------

Expand Down Expand Up @@ -879,10 +877,10 @@ if(WIN32)
avif_exclude_safe(genfiles)
avif_exclude_safe(minigzip)
endif()
if(AVIF_LOCAL_JPEG)
if(AVIF_JPEG STREQUAL "LOCAL")
avif_set_folder_safe(JPEG::JPEG "ext/libjpeg-turbo")
endif()
if(AVIF_LOCAL_LIBXML2)
if(AVIF_LIBXML2 STREQUAL "LOCAL")
avif_set_folder_safe(xml2 "ext/libxml2")
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ cd libavif/ext
./libjpeg.cmd
./zlibpng.cmd
cd ..
cmake -S . -B build -DBUILD_SHARED_LIBS=OFF -DAVIF_CODEC_AOM=ON -DAVIF_LOCAL_AOM=ON -DAVIF_LOCAL_LIBYUV=ON -DAVIF_LOCAL_LIBSHARPYUV=ON -DAVIF_LOCAL_JPEG=ON -DAVIF_LOCAL_ZLIBPNG=ON -DAVIF_BUILD_APPS=ON
cmake -S . -B build -DBUILD_SHARED_LIBS=OFF -DAVIF_CODEC_AOM=ON -DAVIF_LOCAL_AOM=ON -DAVIF_LIBYUV=LOCAL -DAVIF_LIBSHARPYUV=LOCAL -DAVIF_JPEG=LOCAL -DAVIF_ZLIBPNG=LOCAL -DAVIF_BUILD_APPS=ON
cmake --build build --parallel
```

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ install:
- mkdir build
- cd build
- cmake --version
- cmake .. -DAVIF_CODEC_AOM=LOCAL -DAVIF_CODEC_DAV1D=LOCAL -DBUILD_SHARED_LIBS=OFF -DAVIF_LOCAL_JPEG=ON -DAVIF_LOCAL_ZLIBPNG=ON -DAVIF_LIBYUV=LOCAL -DAVIF_BUILD_APPS=ON -DAVIF_ENABLE_WERROR=ON
- cmake .. -DAVIF_CODEC_AOM=LOCAL -DAVIF_CODEC_DAV1D=LOCAL -DBUILD_SHARED_LIBS=OFF -DAVIF_JPEG=JPEG -DAVIF_ZLIBPNG=LOCAL -DAVIF_LIBYUV=LOCAL -DAVIF_BUILD_APPS=ON -DAVIF_ENABLE_WERROR=ON

build:
project: build/libavif.sln
Expand Down
6 changes: 3 additions & 3 deletions cmake/Modules/LocalGoogletest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set(GTEST_MAIN_LIB_FILENAME
${AVIF_SOURCE_DIR}/ext/googletest/build/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX}
)
if(EXISTS ${GTEST_INCLUDE_DIRS}/gtest/gtest.h AND EXISTS ${GTEST_LIB_FILENAME} AND EXISTS ${GTEST_MAIN_LIB_FILENAME})
message(STATUS "libavif(AVIF_LOCAL_GTEST): compiled library found in ext/googletest")
message(STATUS "libavif(AVIF_GTEST=LOCAL): compiled library found in ext/googletest")

add_library(GTest::gtest STATIC IMPORTED)
set_target_properties(GTest::gtest PROPERTIES IMPORTED_LOCATION "${GTEST_LIB_FILENAME}" AVIF_LOCAL ON)
Expand All @@ -23,9 +23,9 @@ if(EXISTS ${GTEST_INCLUDE_DIRS}/gtest/gtest.h AND EXISTS ${GTEST_LIB_FILENAME} A
target_link_libraries(GTest::gtest_main INTERFACE GTest::gtest)
set_target_properties(GTest::gtest_main PROPERTIES IMPORTED_LOCATION "${GTEST_MAIN_LIB_FILENAME}" AVIF_LOCAL ON)
else()
message(STATUS "libavif(AVIF_LOCAL_GTEST): compiled library not found in ext/googletest; using FetchContent")
message(STATUS "libavif(AVIF_GTEST=LOCAL): compiled library not found in ext/googletest; using FetchContent")
if(EXISTS "${AVIF_SOURCE_DIR}/ext/googletest")
message(STATUS "libavif(AVIF_LOCAL_GTEST): ext/googletest found; using as FetchContent SOURCE_DIR")
message(STATUS "libavif(AVIF_GTEST=LOCAL): ext/googletest found; using as FetchContent SOURCE_DIR")
set(FETCHCONTENT_SOURCE_DIR_GOOGLETEST "${AVIF_SOURCE_DIR}/ext/googletest")
message(CHECK_START "libavif(AVIF_LOCAL_GTEST): configuring googletest")
else()
Expand Down
4 changes: 2 additions & 2 deletions cmake/Modules/LocalJpeg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ else()
set(LIB_FILENAME "${LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}jpeg${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif()
if(EXISTS "${LIB_FILENAME}")
message(STATUS "libavif(AVIF_LOCAL_JPEG): ${LIB_FILENAME} found, using for local JPEG")
message(STATUS "libavif(AVIF_JPEG=LOCAL): ${LIB_FILENAME} found, using for local JPEG")
set(JPEG_INCLUDE_DIR "${AVIF_SOURCE_DIR}/ext/libjpeg-turbo")
else()
message(STATUS "libavif(AVIF_LOCAL_JPEG): ${LIB_FILENAME} not found, fetching")
message(STATUS "libavif(AVIF_JPEG=LOCAL): ${LIB_FILENAME} not found, fetching")
set(LIB_DIR "${CMAKE_CURRENT_BINARY_DIR}/libjpeg/src/libjpeg-build")
if(MSVC)
set(LIB_FILENAME "${LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}jpeg-static${CMAKE_STATIC_LIBRARY_SUFFIX}")
Expand Down
6 changes: 3 additions & 3 deletions cmake/Modules/LocalLibXml2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ set(AVIF_LOCAL_LIBXML_GIT_TAG "v2.11.5")

set(LIB_FILENAME "${AVIF_SOURCE_DIR}/ext/libxml2/install.libavif/lib/${AVIF_LIBRARY_PREFIX}xml2${CMAKE_STATIC_LIBRARY_SUFFIX}")
if(EXISTS "${LIB_FILENAME}")
message(STATUS "libavif(AVIF_LOCAL_LIBXML2): compiled library found at ${LIB_FILENAME}")
message(STATUS "libavif(AVIF_LIBXML2=LOCAL): compiled library found at ${LIB_FILENAME}")
add_library(LibXml2 STATIC IMPORTED GLOBAL)
set_target_properties(LibXml2 PROPERTIES IMPORTED_LOCATION "${LIB_FILENAME}" AVIF_LOCAL ON)
target_include_directories(LibXml2 INTERFACE "${AVIF_SOURCE_DIR}/ext/libxml2/install.libavif/include/libxml2")
add_library(LibXml2::LibXml2 ALIAS LibXml2)
else()
message(STATUS "libavif(AVIF_LOCAL_LIBXML2): compiled library not found at ${LIB_FILENAME}; using FetchContent")
message(STATUS "libavif(AVIF_LIBXML2=LOCAL): compiled library not found at ${LIB_FILENAME}; using FetchContent")
if(EXISTS "${AVIF_SOURCE_DIR}/ext/libxml2")
message(STATUS "libavif(AVIF_LOCAL_LIBXML2): ext/libxml2 found; using as FetchContent SOURCE_DIR")
message(STATUS "libavif(AVIF_LIBXML2=LOCAL): ext/libxml2 found; using as FetchContent SOURCE_DIR")
set(FETCHCONTENT_SOURCE_DIR_LIBXML2 "${AVIF_SOURCE_DIR}/ext/libxml2")
message(CHECK_START "libavif(AVIF_LOCAL_LIBXML2): configuring libxml2")
else()
Expand Down
2 changes: 1 addition & 1 deletion ext/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This contains references to various external repositories which are known to
build and work properly with the current libavif. If you are building for
Windows or any kind of fully static (embedded) release, using these scripts in
conjunction with the `BUILD_SHARED_LIBS=0` and `AVIF_LOCAL_*` CMake flags make
conjunction with the `BUILD_SHARED_LIBS=0` and `AVIF_*` CMake flags make
for a convenient way to get all of the dependencies necessary. This method is
how many of libavif's continuous builders work.

Expand Down
9 changes: 1 addition & 8 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,7 @@ macro(add_avif_internal_gtest_with_data TEST_NAME)
endmacro()

if(AVIF_ENABLE_GTEST)
if(NOT TARGET GTest::gtest)
if(AVIF_LOCAL_GTEST)
include(LocalGoogletest)
else()
find_package(GTest REQUIRED)
endif()
endif()

check_avif_option(AVIF_GTEST TARGET GTest::gtest PKG_NAME Googletest)
add_library(avifincrtest_helpers OBJECT gtest/avifincrtest_helpers.cc)
target_link_libraries(avifincrtest_helpers avif_internal GTest::gtest)
endif()
Expand Down
4 changes: 2 additions & 2 deletions tests/oss-fuzz/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ cmake .. -G Ninja -DBUILD_SHARED_LIBS=OFF -DAVIF_CODEC_AOM=LOCAL -DAVIF_CODEC_DA
-DAVIF_CODEC_AOM_DECODE=ON -DAVIF_CODEC_AOM_ENCODE=ON \
-DAVIF_ENABLE_WERROR=OFF \
-DAVIF_LOCAL_FUZZTEST=ON \
-DAVIF_LOCAL_GTEST=OFF -DAVIF_LOCAL_JPEG=ON -DAVIF_LOCAL_LIBSHARPYUV=ON \
-DAVIF_LIBYUV=LOCAL -DAVIF_LOCAL_ZLIBPNG=ON \
-DAVIF_JPEG=LOCAL -DAVIF_LIBSHARPYUV=LOCAL \
-DAVIF_LIBYUV=LOCAL -DAVIF_ZLIBPNG=LOCAL \
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=OFF -DAVIF_ENABLE_WERROR=ON \
${EXTRA_CMAKE_FLAGS}

Expand Down
Loading

0 comments on commit c92d9ec

Please sign in to comment.