From 0ed7d449bc1791a1e1d5bc2a3889b45225dff41c Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Fri, 31 May 2024 13:51:22 +0200 Subject: [PATCH] CI: cache AJA build [Win] Since we must now build the new libajantv2, which takes some 3 minutes, cache the build in order not to increase the build time. Also use libajantv2 path for the SDK instead of AJA (doesn't require unneeded rename), which will be Windows specific. Only do it in MSW, since the build is slowest. But it can be easily used also for other platforms. --- .github/scripts/install-common-deps.sh | 21 ++++++++++++--------- .github/workflows/ccpp.yml | 8 ++++++++ data/scripts/build_aja_lib_win64.sh | 4 ++-- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/.github/scripts/install-common-deps.sh b/.github/scripts/install-common-deps.sh index d31c4046f..28b2085e5 100755 --- a/.github/scripts/install-common-deps.sh +++ b/.github/scripts/install-common-deps.sh @@ -35,22 +35,25 @@ download_install_cineform() {( sudo cmake --install . )} -install_aja() {( +download_build_aja() { git clone --depth 1 https://github.com/aja-video/libajantv2.git - cd libajantv2 export MACOSX_DEPLOYMENT_TARGET=10.13 # needed for arm64 mac cmake -DAJANTV2_DISABLE_DEMOS=ON -DAJANTV2_DISABLE_DRIVER=ON \ -DAJANTV2_DISABLE_TOOLS=ON -DAJANTV2_DISABLE_TESTS=ON \ -DAJANTV2_DISABLE_PLUGINS=ON -DAJANTV2_BUILD_SHARED=ON \ - -DCMAKE_BUILD_TYPE=Release -Bbuild -S. - cmake --build build --config Release -j "$(nproc)" + -DCMAKE_BUILD_TYPE=Release -Blibajantv2/build -Slibajantv2 + cmake --build libajantv2/build --config Release -j "$(nproc)" +} + +install_aja() {( + if [ ! -d libajantv2 ]; then + download_build_aja + fi if is_win; then - cp build/ajantv2/Release/ajantv2.dll /usr/local/bin/ - cp build/ajantv2/Release/ajantv2.lib /usr/local/lib/ - cd .. - mv libajantv2 "$GITHUB_WORKSPACE/AJA" + cp libajantv2/build/ajantv2/Release/ajantv2.dll /usr/local/bin/ + cp libajantv2/build/ajantv2/Release/ajantv2.lib /usr/local/lib/ else - sudo cmake --install build + sudo cmake --install libajantv2/build fi )} diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 2b07dc176..642375cd2 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -266,6 +266,14 @@ jobs: - name: Download XIMEA if: steps.cache-macos-ximea.outputs.cache-hit != 'true' run: curl 'https://www.ximea.com/support/attachments/download/37/XIMEA_API_Installer.exe' -o 'C:\XIMEA_API_Installer.exe' + + - name: Cache libajantv2 build + id: cache-aja + uses: actions/cache@main + with: + path: 'libajantv2' + key: cache-aja-${{ runner.os }}-${{ hashFiles('.github/scripts/install-common-deps.sh') }} + - name: bootsrap run: .github/scripts/Windows/prepare.ps1 shell: pwsh -command ". '{0}'" diff --git a/data/scripts/build_aja_lib_win64.sh b/data/scripts/build_aja_lib_win64.sh index 83eba27c6..4eba3943e 100755 --- a/data/scripts/build_aja_lib_win64.sh +++ b/data/scripts/build_aja_lib_win64.sh @@ -31,7 +31,7 @@ function run_vs10 } # shellcheck disable=SC2016 -export INCLUDE='src;AJA;AJA\ajantv2\includes;AJA\ajantv2\src\win' +export INCLUDE='src;libajantv2;libajantv2\ajantv2\includes;libajantv2\ajantv2\src\win' # rename both aja.cpp because msvc creates object aja.obj for both in the same directory cp src/video_capture/aja.cpp aja_capture.cpp @@ -45,7 +45,7 @@ cmd //Q //C call "$vssetup" "&&" cl //std:c++latest //EHsc //LD //D_XKEYCHECK_H src/aja_common.cpp aja_capture.cpp aja_display.cpp \ src/video_capture/aja_win32_utils.cpp src/video_capture_params.cpp \ src/utils/config_file.cpp src/utils/video_frame_pool.cpp \ - AJA/build/ajantv2/Release/ajantv2.lib advapi32.lib Netapi32.lib \ + libajantv2/build/ajantv2/Release/ajantv2.lib advapi32.lib Netapi32.lib \ Shell32.lib Shlwapi.lib user32.lib winmm.lib //Feaja cp aja.lib /usr/local/lib