From 1b43073100f730877f74ce38b0107a823f2abe8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Vasconcellos?= Date: Sun, 18 Jun 2023 05:33:59 -0300 Subject: [PATCH] [ENG-748] Fix cache factory and libheif on Windows (#950) * Attempt to fix cache factory * Fix macOS/Windows failing to find libheif - Some clippy changes * Discard changes to core/src/p2p/p2p_manager.rs * Attempt fix libheif.lib not being built for windows * Added missing libde265 to ffmpeg-windows Dockerfile - Build .lib file for libheif to fix compilation failing in windows * Remove borked cmake option from libheif build script * Fix .lib name * Remove incorrect build option for libheif * Add cargo to cache factory * Cache factory is working, disable it on pull_request --- .github/scripts/ffmpeg-windows/Dockerfile | 6 ++++ .../ffmpeg-windows/scripts.d/99-libheif.sh | 31 +++++++++++++------ .github/scripts/setup-system.ps1 | 2 +- .github/scripts/setup-system.sh | 4 +-- .github/workflows/cache-factory.yaml | 7 +++-- 5 files changed, 35 insertions(+), 15 deletions(-) diff --git a/.github/scripts/ffmpeg-windows/Dockerfile b/.github/scripts/ffmpeg-windows/Dockerfile index 479c401a0..a6e8262a8 100644 --- a/.github/scripts/ffmpeg-windows/Dockerfile +++ b/.github/scripts/ffmpeg-windows/Dockerfile @@ -90,6 +90,10 @@ FROM layer-45 AS layer-50-kvazaar RUN --mount=src=scripts.d/50-kvazaar.sh,dst=/stage.sh run_stage /stage.sh +FROM layer-45 AS layer-50-libde265 + +RUN --mount=src=scripts.d/50-libde265.sh,dst=/stage.sh run_stage /stage.sh + FROM layer-45 AS layer-50-libjxl RUN --mount=src=scripts.d/50-libjxl.sh,dst=/stage.sh run_stage /stage.sh @@ -173,6 +177,8 @@ COPY --from=layer-50-ffnvcodec $FFBUILD_PREFIX/. $FFBUILD_PREFIX COPY --from=layer-50-kvazaar $FFBUILD_PREFIX/. $FFBUILD_PREFIX +COPY --from=layer-50-libde265 $FFBUILD_PREFIX/. $FFBUILD_PREFIX + COPY --from=layer-50-libjxl $FFBUILD_PREFIX/. $FFBUILD_PREFIX COPY --from=layer-50-libmp3lame $FFBUILD_PREFIX/. $FFBUILD_PREFIX diff --git a/.github/scripts/ffmpeg-windows/scripts.d/99-libheif.sh b/.github/scripts/ffmpeg-windows/scripts.d/99-libheif.sh index dbfdb07ad..84a199845 100644 --- a/.github/scripts/ffmpeg-windows/scripts.d/99-libheif.sh +++ b/.github/scripts/ffmpeg-windows/scripts.d/99-libheif.sh @@ -12,26 +12,37 @@ ffbuild_dockerbuild() { cmake \ -GNinja \ - -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX='/opt/dlls' \ -DCMAKE_INSTALL_BINDIR='/opt/dlls/bin' \ -DCMAKE_INSTALL_LIBDIR='/opt/dlls/lib' \ - -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" \ -DBUILD_TESTING=OFF \ - -DWITH_EXAMPLES=OFF \ + -DBUILD_SHARED_LIBS=ON \ + -DWITH_X265=ON \ + -DWITH_X265_PLUGIN=OFF \ + -DWITH_DAV1D=ON \ + -DWITH_DAV1D_PLUGIN=OFF \ + -DWITH_RAV1E=ON \ + -DWITH_RAV1E_PLUGIN=OFF \ + -DWITH_LIBDE265=ON \ + -DWITH_LIBDE265_PLUGIN=OFF \ + -DWITH_LIBSHARPYUV=ON \ -DWITH_FUZZERS=OFF \ + -DWITH_EXAMPLES=OFF \ + -DWITH_UNCOMPRESSED_CODEC=ON \ -DWITH_REDUCED_VISIBILITY=ON \ -DWITH_DEFLATE_HEADER_COMPRESSION=ON \ - -DWITH_AOM_DECODER_PLUGIN=OFF \ - -DWITH_AOM_ENCODER_PLUGIN=OFF \ - -DWITH_DAV1D_PLUGIN=OFF \ - -DWITH_LIBDE265_PLUGIN=OFF \ - -DWITH_RAV1E_PLUGIN=OFF \ - -DWITH_SvtEnc_PLUGIN=OFF \ - -DWITH_X265_PLUGIN=OFF \ + -DENABLE_PLUGIN_LOADING=OFF \ + -DENABLE_MULTITHREADING_SUPPORT=ON \ .. ninja -j"$(nproc)" ninja install + + cd /opt/dlls/bin + + "${FFBUILD_CROSS_PREFIX}gendef" libheif.dll + + "${FFBUILD_CROSS_PREFIX}dlltool" -m i386:x86-64 -d libheif.def -l heif.lib -D libheif.dll } diff --git a/.github/scripts/setup-system.ps1 b/.github/scripts/setup-system.ps1 index 9f19711f1..19da0d482 100644 --- a/.github/scripts/setup-system.ps1 +++ b/.github/scripts/setup-system.ps1 @@ -400,7 +400,7 @@ if ($success -ne 'yes') { "FFMPEG_DIR = `"$("$projectRoot\target\Frameworks" -replace '\\', '\\')`"", '', '[target.x86_64-pc-windows-msvc]', - "rustflags = [`"-L $("$projectRoot\target\Frameworks\lib" -replace '\\', '\\')`"]", + "rustflags = [`"-L`", `"$("$projectRoot\target\Frameworks\lib" -replace '\\', '\\')`"]", '', (Get-Content "$projectRoot\.cargo\config.toml" -Encoding utf8) ) | Out-File -Force -Encoding utf8 -FilePath "$projectRoot\.cargo\config" diff --git a/.github/scripts/setup-system.sh b/.github/scripts/setup-system.sh index 5311bce98..f1f32a653 100755 --- a/.github/scripts/setup-system.sh +++ b/.github/scripts/setup-system.sh @@ -408,10 +408,10 @@ PROTOC = "${_frameworks_dir}/bin/protoc" FFMPEG_DIR = "${_frameworks_dir}" [target.aarch64-apple-darwin] -rustflags = ["-L ${_frameworks_dir}/lib"] +rustflags = ["-L", "${_frameworks_dir}/lib"] [target.x86_64-apple-darwin] -rustflags = ["-L ${_frameworks_dir}/lib"] +rustflags = ["-L", "${_frameworks_dir}/lib"] $(cat "${_cargo_config}/config.toml") EOF diff --git a/.github/workflows/cache-factory.yaml b/.github/workflows/cache-factory.yaml index 40c19ac47..67ee90a6d 100644 --- a/.github/workflows/cache-factory.yaml +++ b/.github/workflows/cache-factory.yaml @@ -59,8 +59,11 @@ jobs: targets: ${{ matrix.settings.target }} save-cache: 'true' + - name: Clippy + run: cargo clippy --workspace --all-features --target ${{ matrix.settings.target }} + - name: Compile (debug) - run: cargo test --workspace --all-features --no-run + run: cargo test --workspace --all-features --no-run --target ${{ matrix.settings.target }} - name: Compile (release) - run: cargo test --workspace --all-features --no-run --release + run: cargo test --workspace --all-features --no-run --release --target ${{ matrix.settings.target }}