diff --git a/.github/actions/build-deps/action.yml b/.github/actions/build-deps/action.yml index 6592278f10..4762fb853a 100644 --- a/.github/actions/build-deps/action.yml +++ b/.github/actions/build-deps/action.yml @@ -34,6 +34,13 @@ inputs: description: Additional arguments to the Qt build script type: string + ffmpeg_pre_build: + description: Command to run before building ffmpeg dependencies + type: string + ffmpeg_args: + description: Additional arguments to the ffmpeg dependencies build script + type: string + other_pre_build: description: Command to run before building other dependencies type: string @@ -45,6 +52,14 @@ inputs: description: Version of Qt to build required: true type: string + libx264: + description: Commit of libx264 to build + default: '31e19f92f00c7003fa115047ce50978bc98c3a0d' + type: string + ffmpeg: + description: Version of ffmpeg to build + default: '7.0.1' + type: string libmicrohttpd: description: Version of libmicrohttpd to build default: 1.0.1 @@ -79,7 +94,7 @@ outputs: description: > A semicolon-separated list of all generated dependency trees suitable for use with `CMAKE_PREFIX_PATH` - value: ${{ github.workspace }}/${{ inputs.path }}/qt;${{ github.workspace }}/${{ inputs.path }}/other + value: ${{ github.workspace }}/${{ inputs.path }}/qt;${{ github.workspace }}/${{ inputs.path }}/ffmpeg;${{ github.workspace }}/${{ inputs.path }}/other runs: using: composite @@ -99,6 +114,23 @@ runs: ${{ inputs.qt_args }} -P .github/scripts/build-qt.cmake + - uses: ./.github/actions/build-and-cache + with: + name: ffmpeg dependencies + cache_key: ffmpeg-${{ inputs.cache_key }}-${{ inputs.libx264 }}-${{ inputs.ffmpeg }} + path: ${{ inputs.path }}/ffmpeg + pre_build: ${{ inputs.ffmpeg_pre_build }} + build: > + cmake + -DBUILD_TYPE=${{ inputs.build_type }} + "-DLIBX264=${{ inputs.libx264 }}" + "-DFFMPEG=${{ inputs.ffmpeg }}" + "-DCMAKE_PREFIX_PATH=${{ github.workspace }}/${{ inputs.path }}/qt" + "-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/${{ inputs.path }}/ffmpeg" + "-DTARGET_ARCH=${{ inputs.target_arch }}" + ${{ inputs.ffmpeg_args }} + -P .github/scripts/build-ffmpeg.cmake + - uses: ./.github/actions/build-and-cache with: name: other dependencies diff --git a/.github/scripts/build-ffmpeg.cmake b/.github/scripts/build-ffmpeg.cmake new file mode 100644 index 0000000000..cbe9a9dc7e --- /dev/null +++ b/.github/scripts/build-ffmpeg.cmake @@ -0,0 +1,135 @@ +# SPDX-License-Identifier: MIT +cmake_minimum_required(VERSION 3.19) +set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "macOS deployment target") +list(APPEND CMAKE_MODULE_PATH + ${CMAKE_CURRENT_LIST_DIR}/cmake + ${CMAKE_CURRENT_LIST_DIR}/../../cmake +) + +set(LIBX264 "31e19f92f00c7003fa115047ce50978bc98c3a0d" CACHE STRING + "The commit of libx264 to build") +set(FFMPEG "7.0.1" CACHE STRING + "The version of ffmpeg to build") +option(KEEP_ARCHIVES "Keep downloaded archives instead of deleting them" OFF) +option(KEEP_SOURCE_DIRS "Keep source directories instead of deleting them" OFF) +option(KEEP_BINARY_DIRS "Keep build directories instead of deleting them" OFF) +set(TARGET_ARCH "x86_64" CACHE STRING + "Target architecture (x86, x86_64, arm32, arm64)") + +include(BuildDependency) + +if(LIBX264) + build_dependency(x264 ${LIBX264} ${BUILD_TYPE} + URL https://code.videolan.org/videolan/x264/-/archive/@version@/x264-@version@.tar.gz + TARGET_ARCH "${TARGET_ARCH}" + VERSIONS + 31e19f92f00c7003fa115047ce50978bc98c3a0d + SHA384=bed835fcf11b4befa8341661b996c4f51842dfee6f7f87c9c2e767cebca0b7871a7f59435b4e92d89c2b13a659d1d737 + ALL_PLATFORMS + AUTOMAKE + ASSIGN_HOST ASSIGN_PREFIX WIN32_CC_CL + ALL + --enable-static + --enable-pic + --disable-lavf + --disable-swscale + --disable-avs + --disable-ffms + --disable-gpac + --disable-lsmash + --disable-bashcompletion + --disable-cli + --enable-strip + ) +endif() + +if(FFMPEG) + set(ffmpeg_configure_args + --enable-gpl + --enable-version3 + --disable-doc + --disable-autodetect + --disable-programs + --disable-avdevice + --disable-avfilter + --disable-swresample + --disable-postproc + --disable-alsa + --disable-appkit + --disable-avfoundation + --disable-bzlib + --disable-coreimage + --disable-iconv + --disable-lzma + --disable-metal + --disable-sndio + --disable-schannel + --disable-sdl2 + --disable-securetransport + --disable-xlib + --disable-zlib + --enable-libx264 + --disable-encoders + --disable-decoders + --disable-muxers + --disable-demuxers + --disable-parsers + --disable-bsfs + --disable-protocols + --disable-indevs + --disable-outdevs + --disable-devices + --disable-filters + --enable-encoder=libx264 + --enable-muxer=mp4 + ) + + if(ANDROID) + if(TARGET_ARCH STREQUAL "arm32") + list(PREPEND ffmpeg_configure_args --arch=arm) + elseif(TARGET_ARCH STREQUAL "arm64") + list(PREPEND ffmpeg_configure_args --arch=aarch64) + else() + message(FATAL_ERROR "Unhandled TARGET_ARCH '${TARGET_ARCH}'") + endif() + list(PREPEND ffmpeg_configure_args --enable-cross-compile) + list(PREPEND ffmpeg_configure_args --target-os=android) + elseif(WIN32) + if(TARGET_ARCH STREQUAL "x86") + list(PREPEND ffmpeg_configure_args --arch=x86_32) + elseif(TARGET_ARCH STREQUAL "x86_64") + list(PREPEND ffmpeg_configure_args --arch=x86_64) + else() + message(FATAL_ERROR "Unhandled TARGET_ARCH '${TARGET_ARCH}'") + endif() + list(PREPEND ffmpeg_configure_args --toolchain=msvc) + endif() + + build_dependency(ffmpeg ${FFMPEG} ${BUILD_TYPE} + URL https://ffmpeg.org/releases/ffmpeg-@version@.tar.xz + TARGET_ARCH "${TARGET_ARCH}" + VERSIONS + 7.0.1 + SHA384=25650331f409bf7efc09f0d859ce9a1a8e16fe429e4f9b2593743eb68e723b186559739e8b02aac83c6e5c96137fec7e + ALL_PLATFORMS + AUTOMAKE + ASSIGN_PREFIX FFMPEG_QUIRKS + PKG_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig" + ALL ${ffmpeg_configure_args} + PATCHES + ALL + patches/ffmpeg_configure.diff + ) + + # The pkg-config files generated on Windows contain garbage we have to fix. + if(WIN32) + execute_process( + COMMAND + perl + "${CMAKE_CURRENT_LIST_DIR}/fix-win32-ffmpeg-pkg-config-files.pl" + "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig" + COMMAND_ECHO STDOUT + COMMAND_ERROR_IS_FATAL ANY + ) + endif() +endif() diff --git a/.github/scripts/build-qt.cmake b/.github/scripts/build-qt.cmake index d07b0bc7b4..ed8a5c01fb 100644 --- a/.github/scripts/build-qt.cmake +++ b/.github/scripts/build-qt.cmake @@ -222,6 +222,8 @@ if(OPENSSL) CONFIGURATOR "Configure" ASSIGN_PREFIX BROKEN_INSTALL NEEDS_VC_WIN_TARGET MAKE_FLAGS ${OPENSSL_MAKE_FLAGS} + WIN32_CONFIGURE_COMMAND perl + WIN32_MAKE_COMMAND nmake INSTALL_TARGET install_sw ENV ${OPENSSL_ENV} ALL shared no-tests ${OPENSSL_FLAGS} diff --git a/.github/scripts/cmake/BuildDependency.cmake b/.github/scripts/cmake/BuildDependency.cmake index d5fc1f80fd..2851fb5219 100644 --- a/.github/scripts/cmake/BuildDependency.cmake +++ b/.github/scripts/cmake/BuildDependency.cmake @@ -139,7 +139,9 @@ endfunction() function(_build_automake build_type target_bits source_dir) set(configure "${source_dir}/configure") - cmake_parse_arguments(PARSE_ARGV 2 ARG "ASSIGN_PREFIX;BROKEN_INSTALL;NEEDS_VC_WIN_TARGET" "INSTALL_TARGET" "MAKE_FLAGS") + cmake_parse_arguments( + PARSE_ARGV 2 ARG "ASSIGN_HOST;ASSIGN_PREFIX;BROKEN_INSTALL;FFMPEG_QUIRKS;NEEDS_VC_WIN_TARGET;WIN32_CC_CL" + "INSTALL_TARGET;PKG_CONFIG_PATH;WIN32_CONFIGURE_COMMAND;WIN32_MAKE_COMMAND" "MAKE_FLAGS") _parse_flags("${build_type}" "${source_dir}" configure configure_flags env ${ARG_UNPARSED_ARGUMENTS}) if(NPROCS EQUAL 0 OR WIN32) @@ -156,18 +158,40 @@ function(_build_automake build_type target_bits source_dir) # https://developer.android.com/ndk/guides/other_build_systems#autoconf if(CMAKE_ANDROID_NDK) - get_android_env(android_env abi "${CMAKE_ANDROID_NDK}" "${CMAKE_ANDROID_ARCH_ABI}" "${ANDROID_PLATFORM}") + get_android_env( + android_env android_ffmpeg_flags abi "${CMAKE_ANDROID_NDK}" + "${CMAKE_ANDROID_ARCH_ABI}" "${ANDROID_PLATFORM}") list(APPEND env ${android_env}) - list(APPEND configure_flags --host "${abi}") + # ffmpeg's build system looks like autoconf, but isn't actually + if(ARG_FFMPEG_QUIRKS) + list(APPEND configure_flags ${android_ffmpeg_flags}) + list(APPEND env "AS_FLAGS=--target=${abi}") + else() + if(ARG_ASSIGN_HOST) + list(APPEND configure_flags "--host=${abi}") + else() + list(APPEND configure_flags --host "${abi}") + endif() + endif() endif() + if(ARG_PKG_CONFIG_PATH) + # pkg-config chokes on backslashes in PKG_CONFIG_PATH, so convert those + # to forward slashes. TO_CMAKE_PATH does that, despite its odd name. + file(TO_CMAKE_PATH "${ARG_PKG_CONFIG_PATH}" pkg_config_path) + list(APPEND env "PKG_CONFIG_PATH=${pkg_config_path}") + endif() + + # pkg-config also chokes on backslashes in the prefix. + file(TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" prefix) + # OpenSSL has a terrible configurator that only accepts `--prefix=foo` and # does not bail out when it receives a bogus argument, so if you send # `--prefix foo` it will just install to its default prefix! if(ARG_ASSIGN_PREFIX) - set(prefix "--prefix=${CMAKE_INSTALL_PREFIX}") + set(prefix "--prefix=${prefix}") else() - set(prefix "--prefix" "${CMAKE_INSTALL_PREFIX}") + set(prefix "--prefix" "${prefix}") endif() # OpenSSL somehow manages to find the 64bit compiler even when everything is @@ -189,13 +213,26 @@ function(_build_automake build_type target_bits source_dir) set(install install) endif() - # On Windows, the only usable thing here is OpenSSL's pseudo-automake Perl - # script. Shebangs don't work on Windows, so we have to run it explicitly. + # Windows needs special care because shebangs don't work there and it has + # both GNU Make, which regular autoconf uses, and Microsoft's nmake, which + # OpenSSL uses. They are mutually incompatible of course. if(WIN32) - set(make "nmake") + if(ARG_WIN32_CC_CL) + list(APPEND env "CC=cl") + endif() + if(ARG_WIN32_CONFIGURE_COMMAND) + set(winconfigure "${ARG_WIN32_CONFIGURE_COMMAND}") + else() + set(winconfigure "bash") + endif() + if(ARG_WIN32_MAKE_COMMAND) + set(make "${ARG_WIN32_MAKE_COMMAND}") + else() + set(make "make") + endif() execute_process( COMMAND "${CMAKE_COMMAND}" -E env ${env} - perl "${configure}" ${prefix} ${configure_flags} + "${winconfigure}" "${configure}" ${prefix} ${configure_flags} COMMAND_ECHO STDOUT WORKING_DIRECTORY "${source_dir}" COMMAND_ERROR_IS_FATAL ANY @@ -333,7 +370,7 @@ function(_build_cmake build_type target_bits source_dir) endif() endfunction() -function(get_android_env _out_env _out_triplet ndk abi platform) +function(get_android_env _out_env _out_ffmpeg_flags _out_triplet ndk abi platform) if(abi STREQUAL "armeabi-v7a") set(triplet armv7a-linux-androideabi) elseif(abi STREQUAL "arm64-v8a") @@ -368,6 +405,17 @@ function(get_android_env _out_env _out_triplet ndk abi platform) "STRIP=${toolchain}/bin/llvm-strip" PARENT_SCOPE ) + set(${_out_ffmpeg_flags} + "--ar=${toolchain}/bin/llvm-ar" + "--cc=${cc}" + "--ar=${cc}" + "--cxx=${cc}++" + "--ranlib=${toolchain}/bin/llvm-ranlib" + "--strip=${toolchain}/bin/llvm-strip" + "--extra-cflags=--target=${triplet}" + "--extra-ldflags=--target=${triplet}" + PARENT_SCOPE + ) set(${_out_triplet} ${triplet} PARENT_SCOPE) endfunction() diff --git a/.github/scripts/fix-win32-ffmpeg-pkg-config-files.pl b/.github/scripts/fix-win32-ffmpeg-pkg-config-files.pl new file mode 100755 index 0000000000..952922cc70 --- /dev/null +++ b/.github/scripts/fix-win32-ffmpeg-pkg-config-files.pl @@ -0,0 +1,40 @@ +#!/usr/bin/env perl +# SPDX-License-Identifier: MIT +use strict; +use warnings; +use File::Find; +use Encode qw(encode decode); + +sub slurp { + my ($path) = @_; + open my $fh, '<', $path or die "Can't open '$path': $!\n"; + my $content = do { local $/; <$fh> }; + close $fh or die "Can't close '$path': $!\n"; + return decode('UTF-8', $content); +} + +sub spew { + my ($path, $content) = @_; + open my $fh, '>', $path or die "Can't open '$path': $!\n"; + print {$fh} encode('UTF-8', $content); + close $fh or die "Can't close '$path': $!\n"; +} + +sub fix_libs { + my ($libs) = @_; + print "Got libs: '$libs'\n"; + my $result = join ' ', map { s/\A([^\-].*)\.lib\z/-l$1/r } grep { !/\A-libpath:/ } split ' ', $libs; + print "Fixed libs: '$result'\n"; + return "Libs: $result"; +} + +print 'Collecting .pc files in ', join(', ', @ARGV), "\n"; +my @paths; +find({wanted => sub { push @paths, $_ if -f && /\.pc\z/ }, no_chdir => 1}, @ARGV); + +for my $path (@paths) { + print "Fixing $path\n"; + my $content = slurp($path); + $content =~ s/^Libs:\s*(.+?)\s*$/fix_libs($1)/gme; + spew($path, $content); +} diff --git a/.github/scripts/patches/ffmpeg_configure.diff b/.github/scripts/patches/ffmpeg_configure.diff new file mode 100644 index 0000000000..7d6cf7fc01 --- /dev/null +++ b/.github/scripts/patches/ffmpeg_configure.diff @@ -0,0 +1,16 @@ +Description: Trying to build ffmpeg on Windows dies with some weird cmd syntax +error. I've tried to make it use bash instead, since that's apparently what +it wants to use, but no luck. This is a random workaround I found at +https://trac.ffmpeg.org/ticket/9360 that seems to work okay. + +--- a/configure ++++ b/configure +@@ -5018,7 +5018,7 @@ + else + _ident=$($_cc --version 2>/dev/null | head -n1 | tr -d '\r') + fi +- _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)' ++ _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | grep "^Note:.*file:" | sed -e "s^.*file: *^$@: ^" | tr \\\\ / > $(@:.o=.d)' + _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs' + _cflags_speed="-O2" + _cflags_size="-O1" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b4270d6617..5c13783b0a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,50 +43,54 @@ jobs: # There's ways to deduplicate these includes, but any mistake causes # utterly confounding errors, so just explicitly specify each target. include: - - os: ubuntu-20.04 - cross_os: '' - component: '' - qt: 5.15.14 - arch: x86_64 - sccache_triplet: x86_64-unknown-linux-musl - build_flags: -DINITSYS=systemd -DBUILD_PACKAGE_SUFFIX=x86_64 -G Ninja - build_type: Release - collect_symbols: false - # This causes the AppImage to be generated, instead of just creating - # the portable tree, because there seems to be no way to separate - # these steps with linuxdeploy - # Even though the svg component is linked explicitly, - # linuxdeploy-plugin-qt does not seem to notice and so does not - # export the iconengine if it is not told that we really, really - # want svg plugins please - packager: >- - EXTRA_QT_PLUGINS="svg;" - VERSION="${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '$(git describe)' }}" - cmake --install build --config Release - # The runner has multiple clang versions installed and CMake/Qt gets - # confused about which one to pick for some reason, so this also - # sets Clang_ROOT during the Qt build - qt_pre_build: > - sudo apt-get update && - sudo apt-get install --no-install-recommends - libatspi2.0-dev libmtdev-dev libts-dev libgtk-3-dev - libgl1-mesa-dev libglu1-mesa-dev libxi-dev libdrm-dev - libgbm-dev libgl-dev libgles-dev libegl-dev libegl1-mesa-dev - libxext-dev libxfixes-dev libxrender-dev libx11-dev - libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libxcb-util0-dev - libxkbcommon-dev libxkbcommon-x11-dev libxcb-keysyms1-dev - libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev - libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev - libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev - libxcb-util-dev libinput-dev libvulkan-dev - libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xinput-dev libclang-12-dev - libasound2-dev libpulse-dev libcups2-dev libssl-dev - libfontconfig1-dev && - echo "Clang_ROOT=/usr/lib/llvm-12" >> $GITHUB_ENV - other_pre_build: > - sudo apt-get update && - sudo apt-get install --no-install-recommends - libsecret-1-dev + # - os: ubuntu-20.04 + # cross_os: '' + # component: '' + # qt: 5.15.14 + # arch: x86_64 + # sccache_triplet: x86_64-unknown-linux-musl + # build_flags: -DINITSYS=systemd -DBUILD_PACKAGE_SUFFIX=x86_64 -G Ninja + # build_type: Release + # collect_symbols: false + # # This causes the AppImage to be generated, instead of just creating + # # the portable tree, because there seems to be no way to separate + # # these steps with linuxdeploy + # # Even though the svg component is linked explicitly, + # # linuxdeploy-plugin-qt does not seem to notice and so does not + # # export the iconengine if it is not told that we really, really + # # want svg plugins please + # packager: >- + # EXTRA_QT_PLUGINS="svg;" + # VERSION="${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '$(git describe)' }}" + # cmake --install build --config Release + # # The runner has multiple clang versions installed and CMake/Qt gets + # # confused about which one to pick for some reason, so this also + # # sets Clang_ROOT during the Qt build + # qt_pre_build: > + # sudo apt-get update && + # sudo apt-get install --no-install-recommends + # libatspi2.0-dev libmtdev-dev libts-dev libgtk-3-dev + # libgl1-mesa-dev libglu1-mesa-dev libxi-dev libdrm-dev + # libgbm-dev libgl-dev libgles-dev libegl-dev libegl1-mesa-dev + # libxext-dev libxfixes-dev libxrender-dev libx11-dev + # libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libxcb-util0-dev + # libxkbcommon-dev libxkbcommon-x11-dev libxcb-keysyms1-dev + # libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev + # libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev + # libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev + # libxcb-util-dev libinput-dev libvulkan-dev + # libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xinput-dev libclang-12-dev + # libasound2-dev libpulse-dev libcups2-dev libssl-dev + # libfontconfig1-dev && + # echo "Clang_ROOT=/usr/lib/llvm-12" >> $GITHUB_ENV + # ffmpeg_pre_build: > + # sudo apt-get update && + # sudo apt-get install --no-install-recommends + # nasm + # other_pre_build: > + # sudo apt-get update && + # sudo apt-get install --no-install-recommends + # libsecret-1-dev - os: ubuntu-20.04 cross_os: Android @@ -102,71 +106,22 @@ jobs: "-DANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" "-DANDROID_HOST_PATH=$GITHUB_WORKSPACE/.github/deps/qt" -DANDROID_ABI=arm64-v8a - cross_other_args: >- + cross_ffmpeg_args: >- "-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake" "-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" "-DANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" -DANDROID_PLATFORM=android-23 -DANDROID_ABI=arm64-v8a - build_flags: >- - "-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake" - -DANDROID_PLATFORM=android-23 - -DANDROID_ABI=arm64-v8a - -DANDROID_SDK_PLATFORM=android-31 - -DANDROID_SDK_BUILD_TOOLS_REVISION=34.0.0 - -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=on - -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH - -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH - -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH - # The runner has multiple clang versions installed and CMake/Qt gets - # confused about which one to pick for some reason, so this also - # sets Clang_ROOT during the Qt build - qt_pre_build: > - sudo apt-get update && - sudo apt-get install --no-install-recommends - libatspi2.0-dev libmtdev-dev libts-dev libgtk-3-dev - libgl1-mesa-dev libglu1-mesa-dev libxi-dev libdrm-dev - libgbm-dev libgl-dev libgles-dev libegl-dev libegl1-mesa-dev - libxext-dev libxfixes-dev libxrender-dev libx11-dev - libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libxcb-util0-dev - libxkbcommon-dev libxkbcommon-x11-dev libxcb-keysyms1-dev - libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev - libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev - libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev - libxcb-util-dev libinput-dev libvulkan-dev - libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xinput-dev libclang-12-dev - libasound2-dev libpulse-dev libcups2-dev libssl-dev - libfontconfig1-dev && - echo "Clang_ROOT=/usr/lib/llvm-12" >> $GITHUB_ENV - other_pre_build: > - sudo apt-get update && - sudo apt-get install --no-install-recommends - libsecret-1-dev - - - os: ubuntu-20.04 - cross_os: Android - component: '' - qt: 5.15.14 - arch: arm32 - sccache_triplet: x86_64-unknown-linux-musl - build_type: Release - collect_symbols: false - packager: cmake --install build --config Release --prefix . - cross_qt_args: >- - "-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" - "-DANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" - "-DANDROID_HOST_PATH=$GITHUB_WORKSPACE/.github/deps/qt" - -DANDROID_ABI=armeabi-v7a cross_other_args: >- "-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake" "-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" "-DANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" -DANDROID_PLATFORM=android-23 - -DANDROID_ABI=armeabi-v7a + -DANDROID_ABI=arm64-v8a build_flags: >- "-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake" -DANDROID_PLATFORM=android-23 - -DANDROID_ABI=armeabi-v7a + -DANDROID_ABI=arm64-v8a -DANDROID_SDK_PLATFORM=android-31 -DANDROID_SDK_BUILD_TOOLS_REVISION=34.0.0 -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=on @@ -193,96 +148,155 @@ jobs: libasound2-dev libpulse-dev libcups2-dev libssl-dev libfontconfig1-dev && echo "Clang_ROOT=/usr/lib/llvm-12" >> $GITHUB_ENV + ffmpeg_pre_build: > + sudo apt-get update && + sudo apt-get install --no-install-recommends + yasm other_pre_build: > sudo apt-get update && sudo apt-get install --no-install-recommends libsecret-1-dev - - os: macos-13 - cross_os: '' - component: '' - qt: 6.7.2 - arch: x86_64 - build_flags: -DBUILD_PACKAGE_SUFFIX=x86_64 -G Ninja - build_type: Release - collect_symbols: false - sccache_triplet: x86_64-apple-darwin - packager: cpack --verbose --config build/CPackConfig.cmake -C Release - - - os: macos-14 - cross_os: '' - component: '' - qt: 6.7.2 - arch: arm64 - build_flags: -DBUILD_PACKAGE_SUFFIX=arm64 -G Ninja - build_type: Release - collect_symbols: false - sccache_triplet: aarch64-apple-darwin - packager: cpack --verbose --config build/CPackConfig.cmake -C Release - - - os: windows-latest - cross_os: '' - component: '' - qt: 5.15.14 - arch: x86_64 - sccache_triplet: x86_64-pc-windows-msvc - build_flags: -DBUILD_PACKAGE_SUFFIX=x86_64 -G Ninja - build_type: RelWithDebInfo - collect_symbols: true - qt_pre_build: > - choco install gperf jom winflexbison3 && - New-Item -Path C:\ProgramData\Chocolatey\bin\flex.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_flex.exe && - New-Item -Path C:\ProgramData\Chocolatey\bin\bison.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_bison.exe - # Copying files is a disgusting hack because windeployqt does not - # search PATH to find DLLs and it gets confused by QtKeychain having - # a Qt prefix and thinks it is part of Qt and tries to process it - # and fails if it is not in the Qt bin directory with the rest of - # them - packager: > - cp .github/deps/other/bin/qt*.dll .github/deps/qt/bin && - cpack --verbose --config build/CPackConfig.cmake -C RelWithDebInfo - - - os: windows-latest - cross_os: '' - component: 'Tools' - qt: 5.15.14 - arch: x86_64 - sccache_triplet: x86_64-pc-windows-msvc - build_flags: -DBUILD_PACKAGE_SUFFIX=x86_64 -G Ninja - build_type: RelWithDebInfo - collect_symbols: false - qt_pre_build: > - choco install gperf jom winflexbison3 && - New-Item -Path C:\ProgramData\Chocolatey\bin\flex.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_flex.exe && - New-Item -Path C:\ProgramData\Chocolatey\bin\bison.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_bison.exe - # Copying files is a disgusting hack because windeployqt does not - # search PATH to find DLLs and it gets confused by QtKeychain having - # a Qt prefix and thinks it is part of Qt and tries to process it - # and fails if it is not in the Qt bin directory with the rest of - # them - packager: > - cp .github/deps/other/bin/qt*.dll .github/deps/qt/bin && - cpack --verbose --config build/CPackConfig.cmake -C RelWithDebInfo - - - os: windows-latest - qt: 5.15.14 - arch: x86 - sccache_triplet: x86_64-pc-windows-msvc - build_flags: -DCARGO_TRIPLE=i686-pc-windows-msvc -DBUILD_PACKAGE_SUFFIX=x86 -G Ninja - build_type: RelWithDebInfo - collect_symbols: false - qt_pre_build: > - choco install gperf jom winflexbison3 && - New-Item -Path C:\ProgramData\Chocolatey\bin\flex.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_flex.exe && - New-Item -Path C:\ProgramData\Chocolatey\bin\bison.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_bison.exe - # Copying files is a disgusting hack because windeployqt does not - # search PATH to find DLLs and it gets confused by QtKeychain having - # a Qt prefix and thinks it is part of Qt and tries to process it - # and fails if it is not in the Qt bin directory with the rest of - # them - packager: > - cp .github/deps/other/bin/qt*.dll .github/deps/qt/bin && - cpack --verbose --config build/CPackConfig.cmake -C RelWithDebInfo + #- os: ubuntu-20.04 + # cross_os: Android + # component: '' + # qt: 5.15.14 + # arch: arm32 + # sccache_triplet: x86_64-unknown-linux-musl + # build_type: Release + # collect_symbols: false + # packager: cmake --install build --config Release --prefix . + # cross_qt_args: >- + # "-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" + # "-DANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" + # "-DANDROID_HOST_PATH=$GITHUB_WORKSPACE/.github/deps/qt" + # -DANDROID_ABI=armeabi-v7a + # cross_other_args: >- + # "-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake" + # "-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" + # "-DANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" + # -DANDROID_PLATFORM=android-23 + # -DANDROID_ABI=armeabi-v7a + # build_flags: >- + # "-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake" + # -DANDROID_PLATFORM=android-23 + # -DANDROID_ABI=armeabi-v7a + # -DANDROID_SDK_PLATFORM=android-31 + # -DANDROID_SDK_BUILD_TOOLS_REVISION=34.0.0 + # -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=on + # -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH + # -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH + # -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH + # # The runner has multiple clang versions installed and CMake/Qt gets + # # confused about which one to pick for some reason, so this also + # # sets Clang_ROOT during the Qt build + # qt_pre_build: > + # sudo apt-get update && + # sudo apt-get install --no-install-recommends + # libatspi2.0-dev libmtdev-dev libts-dev libgtk-3-dev + # libgl1-mesa-dev libglu1-mesa-dev libxi-dev libdrm-dev + # libgbm-dev libgl-dev libgles-dev libegl-dev libegl1-mesa-dev + # libxext-dev libxfixes-dev libxrender-dev libx11-dev + # libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libxcb-util0-dev + # libxkbcommon-dev libxkbcommon-x11-dev libxcb-keysyms1-dev + # libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev + # libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev + # libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev + # libxcb-util-dev libinput-dev libvulkan-dev + # libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xinput-dev libclang-12-dev + # libasound2-dev libpulse-dev libcups2-dev libssl-dev + # libfontconfig1-dev && + # echo "Clang_ROOT=/usr/lib/llvm-12" >> $GITHUB_ENV + # other_pre_build: > + # sudo apt-get update && + # sudo apt-get install --no-install-recommends + # libsecret-1-dev + + # - os: macos-13 + # cross_os: '' + # component: '' + # qt: 6.7.2 + # arch: x86_64 + # build_flags: -DBUILD_PACKAGE_SUFFIX=x86_64 -G Ninja + # build_type: Release + # collect_symbols: false + # sccache_triplet: x86_64-apple-darwin + # packager: cpack --verbose --config build/CPackConfig.cmake -C Release + + # - os: macos-14 + # cross_os: '' + # component: '' + # qt: 6.7.2 + # arch: arm64 + # build_flags: -DBUILD_PACKAGE_SUFFIX=arm64 -G Ninja + # build_type: Release + # collect_symbols: false + # sccache_triplet: aarch64-apple-darwin + # packager: cpack --verbose --config build/CPackConfig.cmake -C Release + + # - os: windows-latest + # cross_os: '' + # component: '' + # qt: 5.15.14 + # arch: x86_64 + # sccache_triplet: x86_64-pc-windows-msvc + # build_flags: -DBUILD_PACKAGE_SUFFIX=x86_64 -G Ninja + # build_type: RelWithDebInfo + # collect_symbols: true + # qt_pre_build: > + # choco install gperf jom winflexbison3 && + # New-Item -Path C:\ProgramData\Chocolatey\bin\flex.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_flex.exe && + # New-Item -Path C:\ProgramData\Chocolatey\bin\bison.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_bison.exe + # # Copying files is a disgusting hack because windeployqt does not + # # search PATH to find DLLs and it gets confused by QtKeychain having + # # a Qt prefix and thinks it is part of Qt and tries to process it + # # and fails if it is not in the Qt bin directory with the rest of + # # them + # packager: > + # cp .github/deps/other/bin/qt*.dll .github/deps/qt/bin && + # cpack --verbose --config build/CPackConfig.cmake -C RelWithDebInfo + + # - os: windows-latest + # cross_os: '' + # component: 'Tools' + # qt: 5.15.14 + # arch: x86_64 + # sccache_triplet: x86_64-pc-windows-msvc + # build_flags: -DBUILD_PACKAGE_SUFFIX=x86_64 -G Ninja + # build_type: RelWithDebInfo + # collect_symbols: false + # qt_pre_build: > + # choco install gperf jom winflexbison3 && + # New-Item -Path C:\ProgramData\Chocolatey\bin\flex.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_flex.exe && + # New-Item -Path C:\ProgramData\Chocolatey\bin\bison.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_bison.exe + # # Copying files is a disgusting hack because windeployqt does not + # # search PATH to find DLLs and it gets confused by QtKeychain having + # # a Qt prefix and thinks it is part of Qt and tries to process it + # # and fails if it is not in the Qt bin directory with the rest of + # # them + # packager: > + # cp .github/deps/other/bin/qt*.dll .github/deps/qt/bin && + # cpack --verbose --config build/CPackConfig.cmake -C RelWithDebInfo + + # - os: windows-latest + # qt: 5.15.14 + # arch: x86 + # sccache_triplet: x86_64-pc-windows-msvc + # build_flags: -DCARGO_TRIPLE=i686-pc-windows-msvc -DBUILD_PACKAGE_SUFFIX=x86 -G Ninja + # build_type: RelWithDebInfo + # collect_symbols: false + # qt_pre_build: > + # choco install gperf jom winflexbison3 && + # New-Item -Path C:\ProgramData\Chocolatey\bin\flex.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_flex.exe && + # New-Item -Path C:\ProgramData\Chocolatey\bin\bison.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_bison.exe + # # Copying files is a disgusting hack because windeployqt does not + # # search PATH to find DLLs and it gets confused by QtKeychain having + # # a Qt prefix and thinks it is part of Qt and tries to process it + # # and fails if it is not in the Qt bin directory with the rest of + # # them + # packager: > + # cp .github/deps/other/bin/qt*.dll .github/deps/qt/bin && + # cpack --verbose --config build/CPackConfig.cmake -C RelWithDebInfo steps: @@ -303,12 +317,22 @@ jobs: arch: win${{ matrix.arch == 'x86_64' && '64' || '32' }} if: runner.os == 'Windows' - - name: Install NASM for building OpenSSL in Windows + - name: Install NASM for building ffmpeg in macOS + run: | + brew install nasm + if: runner.os == 'macOS' + + - name: Install NASM for building OpenSSL and ffmpeg in Windows uses: ilammy/setup-nasm@v1 with: platform: win${{ matrix.arch == 'x86_64' && '64' || '32' }} if: runner.os == 'Windows' + - name: Install pkg-config for building and linking to ffmpeg in Windows + run: | + choco install pkgconfiglite + if: runner.os == 'Windows' + - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 with: @@ -338,6 +362,8 @@ jobs: qt: ${{ matrix.qt }} qt_pre_build: ${{ matrix.qt_pre_build }} qt_args: ${{ matrix.qt_args }} + ffmpeg_pre_build: ${{ matrix.ffmpeg_pre_build }} + ffmpeg_args: ${{ matrix.ffmpeg_args }} other_pre_build: ${{ matrix.other_pre_build }} other_args: ${{ matrix.other_args }} if: '!matrix.cross_os' @@ -353,6 +379,8 @@ jobs: qt: ${{ matrix.qt }} qt_pre_build: ${{ matrix.cross_qt_pre_build }} qt_args: ${{ matrix.cross_qt_args }} + ffmpeg_pre_build: ${{ matrix.cross_ffmpeg_pre_build }} + ffmpeg_args: ${{ matrix.cross_ffmpeg_args }} other_pre_build: ${{ matrix.cross_other_pre_build }} other_args: ${{ matrix.cross_other_args }} if: matrix.cross_os diff --git a/cmake/DrawdanceDependencies.cmake b/cmake/DrawdanceDependencies.cmake index 7739caa47f..2883f44470 100644 --- a/cmake/DrawdanceDependencies.cmake +++ b/cmake/DrawdanceDependencies.cmake @@ -2,19 +2,33 @@ dp_find_package(ZLIB MODULE REQUIRED) -if(NOT ANDROID) - find_package(PkgConfig QUIET) - if(PKGCONFIG_FOUND) - pkg_check_modules(LIBAV IMPORTED_TARGET - libavcodec - libavformat - libavutil - libswscale +find_package(PkgConfig QUIET) +if(PKGCONFIG_FOUND) + pkg_check_modules(LIBAV IMPORTED_TARGET GLOBAL + libavcodec + libavformat + libavutil + libswscale + ) + if(TARGET PkgConfig::LIBAV) + include(CMakePrintHelpers) + cmake_print_properties(TARGETS PkgConfig::LIBAV PROPERTIES + INTERFACE_COMPILE_DEFINITIONS + INTERFACE_COMPILE_FEATURES + INTERFACE_COMPILE_OPTIONS + INTERFACE_INCLUDE_DIRECTORIES + INTERFACE_LINK_DEPENDS + INTERFACE_LINK_DIRECTORIES + INTERFACE_LINK_LIBRARIES + INTERFACE_LINK_LIBRARIES_DIRECT + INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE + INTERFACE_LINK_OPTIONS + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ) - if(TARGET PkgConfig::LIBAV) - add_library(LIBAV::LIBAV ALIAS PkgConfig::LIBAV) - endif() + add_library(LIBAV::LIBAV ALIAS PkgConfig::LIBAV) endif() +else() + message(WARNING "PkgConfig NOT FOUND") endif() add_feature_info("Video export via libav" "TARGET LIBAV::LIBAV" "")