From 2eabab8bf0f8a3453c160c10973ca9ad9339cb6f Mon Sep 17 00:00:00 2001 From: Holden Date: Sat, 31 Aug 2024 17:14:49 -0400 Subject: [PATCH] CI: Adjust Which Workflows Run --- .github/actions/qt-android/action.yml | 15 +- .github/workflows/android-linux.yml | 3 +- .github/workflows/android-macos.yml | 7 +- .github/workflows/android-windows.yml | 25 ++- .github/workflows/docker-linux.yml | 43 ++++ .github/workflows/docker.yml | 25 --- .github/workflows/ios.yml | 29 ++- .github/workflows/linux.yml | 9 +- .github/workflows/macos.yml | 16 +- .github/workflows/windows.yml | 6 +- CMakeLists.txt | 20 ++ cmake/FindFFMPEG.cmake | 195 ++++++++++++++++++ cmake/FindGStreamer.cmake | 13 +- deploy/docker/Dockerfile-build-ubuntu | 9 +- .../{run-docker.sh => run-docker-ubuntu.sh} | 0 src/Comms/LinkManager.cc | 2 + src/Joystick/JoystickManager.cc | 9 +- .../GStreamer/gstqml6gl/CMakeLists.txt | 59 +++++- tools/setup/install-dependencies-debian.sh | 8 +- 19 files changed, 417 insertions(+), 76 deletions(-) create mode 100644 .github/workflows/docker-linux.yml delete mode 100644 .github/workflows/docker.yml create mode 100644 cmake/FindFFMPEG.cmake rename deploy/docker/{run-docker.sh => run-docker-ubuntu.sh} (100%) diff --git a/.github/actions/qt-android/action.yml b/.github/actions/qt-android/action.yml index c932454e5a7..9bc90bf3325 100644 --- a/.github/actions/qt-android/action.yml +++ b/.github/actions/qt-android/action.yml @@ -4,6 +4,9 @@ inputs: host: description: Host required: true + arch: + description: Arch + required: true version: description: Qt Version required: false @@ -28,10 +31,6 @@ runs: packages: 'platform-tools platforms;android-34 build-tools;34.0.0' # ndk;25.1.8937393' log-accepted-android-sdk-licenses: false - - name: Update Android SDK / NDK / Tools - run: sdkmanager --update - shell: bash - - name: Install Android NDK uses: nttld/setup-ndk@v1 id: setup-ndk @@ -45,10 +44,15 @@ runs: echo "ANDROID_NDK=${{ steps.setup-ndk.outputs.ndk-path }}" >> "$GITHUB_ENV" shell: bash + - name: Update Android SDK / NDK / Tools + if: ${{ runner.os != 'Windows' }} + run: sdkmanager --update + shell: bash + - name: Set Up Cache uses: hendrikmuhs/ccache-action@v1.2 with: - create-symlink: true + create-symlink: ${{ runner.os != 'Windows' }} key: ${{ runner.os }}-Android-${{ matrix.BuildType }} restore-keys: ${{ runner.os }}-Android-${{ matrix.BuildType }} max-size: 1G @@ -62,6 +66,7 @@ runs: aqtversion: ==3.1.* host: ${{ inputs.host }} target: desktop + arch: ${{ inputs.arch }} dir: ${{ runner.temp }} modules: qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d qtsensors cache: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} diff --git a/.github/workflows/android-linux.yml b/.github/workflows/android-linux.yml index 45779c44b9b..6ee800330fc 100644 --- a/.github/workflows/android-linux.yml +++ b/.github/workflows/android-linux.yml @@ -25,7 +25,7 @@ jobs: strategy: matrix: - BuildType: [Debug, Release] + BuildType: [Release] defaults: run: @@ -68,6 +68,7 @@ jobs: uses: ./.github/actions/qt-android with: host: linux + arch: gcc_64 version: ${{ env.QT_VERSION }} abis: ${{ env.QT_ANDROID_ABIS }} diff --git a/.github/workflows/android-macos.yml b/.github/workflows/android-macos.yml index 7b2f10998bf..e050b295507 100644 --- a/.github/workflows/android-macos.yml +++ b/.github/workflows/android-macos.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - BuildType: [Debug, Release] + BuildType: [Release] defaults: run: @@ -23,7 +23,7 @@ jobs: QT_ANDROID_KEYSTORE_ALIAS: QGCAndroidKeyStore QT_ANDROID_KEYSTORE_STORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} QT_ANDROID_KEYSTORE_KEY_PASS: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} - QT_ANDROID_ABIS: "armeabi-v7a;arm64-v8a" + QT_ANDROID_ABIS: 'arm64-v8a' steps: - name: Checkout repo @@ -44,6 +44,7 @@ jobs: uses: ./.github/actions/qt-android with: host: mac + arch: clang_64 version: ${{ env.QT_VERSION }} abis: ${{ env.QT_ANDROID_ABIS }} @@ -55,7 +56,7 @@ jobs: -DCMAKE_BUILD_TYPE=${{ matrix.BuildType }} -DQT_ANDROID_ABIS="${{ env.QT_ANDROID_ABIS }}" -DQT_ANDROID_BUILD_ALL_ABIS=OFF - -DQT_HOST_PATH="${{ env.QT_ROOT_DIR }}/../msvc2019_64" + -DQT_HOST_PATH="${{ env.QT_ROOT_DIR }}/../macos" -DQT_ANDROID_SIGN_APK=${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && 'ON' || 'OFF' }} -DQT_DEBUG_FIND_PACKAGE=ON -DQGC_STABLE_BUILD=${{ github.ref_type == 'tag' || contains(github.ref, 'Stable') && 'ON' || 'OFF' }} diff --git a/.github/workflows/android-windows.yml b/.github/workflows/android-windows.yml index efb48dd49fb..cf05ed8a9fb 100644 --- a/.github/workflows/android-windows.yml +++ b/.github/workflows/android-windows.yml @@ -1,7 +1,23 @@ name: Android-Windows on: - workflow_dispatch: + push: + branches: + - master + - 'Stable*' + tags: + - 'v*' + paths-ignore: + - 'deploy/**' + - 'docs/**' + pull_request: + paths-ignore: + - 'deploy/**' + - 'docs/**' + - '.github/workflows/docs_deploy.yml' + - '.github/workflows/linux.yml' + - '.github/workflows/macos.yml' + - '.github/workflows/windows.yml' jobs: build: @@ -9,7 +25,7 @@ jobs: strategy: matrix: - BuildType: [Debug, Release] + BuildType: [Release] defaults: run: @@ -23,7 +39,7 @@ jobs: QT_ANDROID_KEYSTORE_ALIAS: QGCAndroidKeyStore QT_ANDROID_KEYSTORE_STORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} QT_ANDROID_KEYSTORE_KEY_PASS: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} - QT_ANDROID_ABIS: "armeabi-v7a;arm64-v8a" + QT_ANDROID_ABIS: 'arm64-v8a' steps: - name: Checkout repo @@ -37,7 +53,7 @@ jobs: - name: Install Dependencies run: | - choco install --no-progress ninja sscache -y + choco install --no-progress ninja pkgconfiglite -y choco install --no-progress cmake --installargs 'ADD_CMAKE_TO_PATH=System' --apply-install-arguments-to-dependencies # - name: Set Up sccache @@ -47,6 +63,7 @@ jobs: uses: ./.github/actions/qt-android with: host: windows + arch: win64_msvc2019_64 version: ${{ env.QT_VERSION }} abis: ${{ env.QT_ANDROID_ABIS }} diff --git a/.github/workflows/docker-linux.yml b/.github/workflows/docker-linux.yml new file mode 100644 index 00000000000..0ebabcacbff --- /dev/null +++ b/.github/workflows/docker-linux.yml @@ -0,0 +1,43 @@ +name: Docker-Linux + +on: + push: + branches: + - master + - 'Stable*' + tags: + - 'v*' + paths-ignore: + - 'android/**' + - 'deploy/**' + - 'docs/**' + pull_request: + paths-ignore: + - 'android/**' + - 'deploy/**' + - 'docs/**' + - '.github/workflows/docs_deploy.yml' + - '.github/workflows/android.yml' + - '.github/workflows/macos.yml' + - '.github/workflows/windows.yml' + +jobs: + build: + runs-on: ubuntu-latest + + defaults: + run: + shell: bash + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-tags: true + fetch-depth: 0 + + - run: chmod a+x ./deploy/docker/run-docker-ubuntu.sh + + - name: Run Docker Build + run: ./deploy/docker/run-docker-ubuntu.sh diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index ae416db7b29..00000000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Docker - -on: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - - defaults: - run: - shell: bash - - steps: - - name: Checkout repo - uses: actions/checkout@v4 - with: - submodules: recursive - fetch-tags: true - fetch-depth: 0 - - - run: chmod a+x ./deploy/docker/run-docker.sh - - - name: Run Docker Build - run: ./deploy/docker/run-docker.sh diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index c42d6866bce..b0f4f0d7f32 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - BuildType: [Debug, Release] + BuildType: [Release] defaults: run: @@ -21,6 +21,20 @@ jobs: GST_VERSION: 1.22.12 steps: + - name: Recover disk space + run: | + df -h + ls /Applications + brew uninstall google-chrome + sudo rm -rf /Users/runner/Library/Android + sudo rm -rf /Applications/Xcode_14* + sudo rm -rf /Applications/Xcode_15.0* + sudo rm -rf /Applications/Xcode_15.1* + sudo rm -rf /Applications/Xcode_15.2* + sudo rm -rf /Applications/Xcode_15.3* + ls /Applications + df -h + - name: Checkout repo uses: actions/checkout@v4 with: @@ -28,6 +42,11 @@ jobs: fetch-tags: true fetch-depth: 0 + - name: Setup Xcode + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest-stable + - uses: seanmiddleditch/gha-setup-ninja@v5 - name: Install Dependencies @@ -38,8 +57,8 @@ jobs: - name: Set Up Cache uses: hendrikmuhs/ccache-action@v1.2 with: - key: ${{ runner.os }}-${{ matrix.BuildType }} - restore-keys: ${{ runner.os }}-${{ matrix.BuildType }} + key: ${{ runner.os }}-iOS-${{ matrix.BuildType }} + restore-keys: ${{ runner.os }}-iOS-${{ matrix.BuildType }} max-size: 1G append-timestamp: false save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} @@ -51,6 +70,7 @@ jobs: aqtversion: ==3.1.* host: mac target: desktop + arch: clang_64 dir: ${{ runner.temp }} modules: qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d qtsensors cache: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} @@ -62,12 +82,13 @@ jobs: aqtversion: ==3.1.* host: mac target: ios + arch: ios dir: ${{ runner.temp }} extra: --autodesktop modules: qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtimageformats qtshadertools qtconnectivity qtquick3d qtsensors cache: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} - - run: mkdir ${{ runner.temp }}/shadow_build_dir + - run: mkdir ${{ runner.temp }}/shadow_build_dir - name: Configure working-directory: ${{ runner.temp }}/shadow_build_dir diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 2ccaeec3684..21406644a03 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -29,15 +29,15 @@ jobs: matrix: BuildType: [Debug, Release] + defaults: + run: + shell: bash + env: ARTIFACT: QGroundControl-x86_64.AppImage QT_VERSION: 6.6.3 # GST_VERSION: 1.22.12 - defaults: - run: - shell: bash - steps: - name: Free Disk Space (Ubuntu) uses: jlumbroso/free-disk-space@main @@ -98,6 +98,7 @@ jobs: aqtversion: ==3.1.* host: linux target: desktop + arch: gcc_64 dir: ${{ runner.temp }} modules: qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d qtsensors cache: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index e005e25a0a4..fb4d8fcf33b 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -27,17 +27,17 @@ jobs: strategy: matrix: - BuildType: [Debug, Release] + BuildType: [Release] + + defaults: + run: + shell: bash env: ARTIFACT: QGroundControl.dmg QT_VERSION: 6.6.3 GST_VERSION: 1.22.12 - defaults: - run: - shell: bash - steps: - name: Checkout repo uses: actions/checkout@v4 @@ -46,6 +46,11 @@ jobs: fetch-tags: true fetch-depth: 0 + - name: Setup Xcode + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest-stable + - uses: seanmiddleditch/gha-setup-ninja@v5 - name: Install Dependencies @@ -78,6 +83,7 @@ jobs: aqtversion: ==3.1.* host: mac target: desktop + arch: clang_64 dir: ${{ runner.temp }} modules: qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d qtsensors cache: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 8daac794f85..9bb21ce684c 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -27,7 +27,7 @@ jobs: strategy: matrix: - BuildType: [Debug, Release] + BuildType: [Release] Arch: [x64] # Arm64 defaults: @@ -52,7 +52,7 @@ jobs: - name: Install Dependencies run: | - choco install --no-progress ninja sccache -y + choco install --no-progress ninja pkgconfiglite -y choco install --no-progress cmake --installargs 'ADD_CMAKE_TO_PATH=System' --apply-install-arguments-to-dependencies - name: Install Vulkan @@ -105,7 +105,7 @@ jobs: aqtversion: ==3.1.* host: windows target: desktop - arch: win64_msvc2019_64 + arch: win64_msvc2019_arm64 dir: ${{ runner.temp }} extra: --autodesktop modules: qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d qtsensors diff --git a/CMakeLists.txt b/CMakeLists.txt index a436fa94f9d..2b38735430a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,8 @@ set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) set(CMAKE_INCLUDE_CURRENT_DIR OFF) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug;Release") if(NOT CMAKE_BUILD_TYPE) @@ -370,9 +372,27 @@ elseif(MACOS) ) elseif(IOS) enable_language(OBJC) + + set(CMAKE_OSX_ARCHITECTURES "arm64") + set(CMAKE_OSX_SYSROOT "iphoneos") + set(CMAKE_OSX_DEPLOYMENT_TARGET "14.0") + set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "14.0") + set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2") # iPhone,iPad + set(CMAKE_XCODE_ATTRIBUTE_INFOPLIST_FILE "${CMAKE_CURRENT_SOURCE_DIR}/deploy/ios/iOS-Info.plist") + set_target_properties(${PROJECT_NAME} PROPERTIES QT_IOS_LAUNCH_SCREEN ${CMAKE_SOURCE_DIR}/deploy/ios/QGCLaunchScreen.xib + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.mavlink.qgroundcontrol" + XCODE_ATTRIBUTE_PRODUCT_NAME ${CMAKE_PROJECT_NAME} + XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION ${CMAKE_PROJECT_VERSION} + XCODE_ATTRIBUTE_MARKETING_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon" + XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "14.0" + XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2" # iPhone,iPad + XCODE_ATTRIBUTE_INFOPLIST_KEY_CFBundleDisplayName ${CMAKE_PROJECT_NAME} + XCODE_ATTRIBUTE_INFOPLIST_KEY_LSApplicationCategoryType "public.app-category.mycategory" + XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS "YES" ) elseif(ANDROID) FetchContent_Declare(android_openssl diff --git a/cmake/FindFFMPEG.cmake b/cmake/FindFFMPEG.cmake new file mode 100644 index 00000000000..f727ef2dddf --- /dev/null +++ b/cmake/FindFFMPEG.cmake @@ -0,0 +1,195 @@ +#[==[ +Provides the following variables: + + * `FFMPEG_INCLUDE_DIRS`: Include directories necessary to use FFMPEG. + * `FFMPEG_LIBRARIES`: Libraries necessary to use FFMPEG. Note that this only + includes libraries for the components requested. + * `FFMPEG_VERSION`: The version of FFMPEG found. + +The following components are supported: + + * `avcodec` + * `avdevice` + * `avfilter` + * `avformat` + * `avresample` + * `avutil` + * `swresample` + * `swscale` + +For each component, the following are provided: + + * `FFMPEG__FOUND`: Libraries for the component. + * `FFMPEG__INCLUDE_DIRS`: Include directories for + the component. + * `FFMPEG__LIBRARIES`: Libraries for the component. + * `FFMPEG::`: A target to use with `target_link_libraries`. + +Note that only components requested with `COMPONENTS` or `OPTIONAL_COMPONENTS` +are guaranteed to set these variables or provide targets. +#]==] + +function (_ffmpeg_find component headername) + find_path("FFMPEG_${component}_INCLUDE_DIR" + NAMES + "lib${component}/${headername}" + PATHS + "${FFMPEG_ROOT}/include" + ~/Library/Frameworks + /Library/Frameworks + /usr/local/include + /usr/include + /sw/include # Fink + /opt/local/include # DarwinPorts + /opt/csw/include # Blastwave + /opt/include + /usr/freeware/include + PATH_SUFFIXES + ffmpeg + DOC "FFMPEG's ${component} include directory") + mark_as_advanced("FFMPEG_${component}_INCLUDE_DIR") + + # On Windows, static FFMPEG is sometimes built as `lib.a`. + if (WIN32) + list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".a" ".lib") + list(APPEND CMAKE_FIND_LIBRARY_PREFIXES "" "lib") + endif () + + find_library("FFMPEG_${component}_LIBRARY" + NAMES + "${component}" + PATHS + "${FFMPEG_ROOT}/lib" + ~/Library/Frameworks + /Library/Frameworks + /usr/local/lib + /usr/local/lib64 + /usr/lib + /usr/lib64 + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + /usr/freeware/lib64 + "${FFMPEG_ROOT}/bin" + DOC "FFMPEG's ${component} library") + mark_as_advanced("FFMPEG_${component}_LIBRARY") + + if (FFMPEG_${component}_LIBRARY AND FFMPEG_${component}_INCLUDE_DIR) + set(_deps_found TRUE) + set(_deps_link) + foreach (_ffmpeg_dep IN LISTS ARGN) + if (TARGET "FFMPEG::${_ffmpeg_dep}") + list(APPEND _deps_link "FFMPEG::${_ffmpeg_dep}") + else () + set(_deps_found FALSE) + endif () + endforeach () + if (_deps_found) + if (NOT TARGET "FFMPEG::${component}") + add_library("FFMPEG::${component}" UNKNOWN IMPORTED) + set_target_properties("FFMPEG::${component}" PROPERTIES + IMPORTED_LOCATION "${FFMPEG_${component}_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${FFMPEG_${component}_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LIBRARIES "${_deps_link}") + endif () + set("FFMPEG_${component}_FOUND" 1 + PARENT_SCOPE) + + set(version_header_path "${FFMPEG_${component}_INCLUDE_DIR}/lib${component}/version.h") + if (EXISTS "${version_header_path}") + string(TOUPPER "${component}" component_upper) + file(STRINGS "${version_header_path}" version + REGEX "#define *LIB${component_upper}_VERSION_(MAJOR|MINOR|MICRO) ") + string(REGEX REPLACE ".*_MAJOR *\([0-9]*\).*" "\\1" major "${version}") + string(REGEX REPLACE ".*_MINOR *\([0-9]*\).*" "\\1" minor "${version}") + string(REGEX REPLACE ".*_MICRO *\([0-9]*\).*" "\\1" micro "${version}") + if (NOT major STREQUAL "" AND + NOT minor STREQUAL "" AND + NOT micro STREQUAL "") + set("FFMPEG_${component}_VERSION" "${major}.${minor}.${micro}" + PARENT_SCOPE) + endif () + endif () + else () + set("FFMPEG_${component}_FOUND" 0 + PARENT_SCOPE) + set(what) + if (NOT FFMPEG_${component}_LIBRARY) + set(what "library") + endif () + if (NOT FFMPEG_${component}_INCLUDE_DIR) + if (what) + string(APPEND what " or headers") + else () + set(what "headers") + endif () + endif () + set("FFMPEG_${component}_NOT_FOUND_MESSAGE" + "Could not find the ${what} for ${component}." + PARENT_SCOPE) + endif () + endif () +endfunction () + +_ffmpeg_find(avutil avutil.h) +_ffmpeg_find(avresample avresample.h + avutil) +_ffmpeg_find(swresample swresample.h + avutil) +_ffmpeg_find(swscale swscale.h + avutil) +_ffmpeg_find(avcodec avcodec.h + avutil) +_ffmpeg_find(avformat avformat.h + avcodec avutil) +_ffmpeg_find(avfilter avfilter.h + avutil) +_ffmpeg_find(avdevice avdevice.h + avformat avutil) + +if (TARGET FFMPEG::avutil) + set(_ffmpeg_version_header_path "${FFMPEG_avutil_INCLUDE_DIR}/libavutil/ffversion.h") + if (EXISTS "${_ffmpeg_version_header_path}") + file(STRINGS "${_ffmpeg_version_header_path}" _ffmpeg_version + REGEX "FFMPEG_VERSION") + string(REGEX REPLACE ".*\"n?\(.*\)\"" "\\1" FFMPEG_VERSION "${_ffmpeg_version}") + unset(_ffmpeg_version) + else () + set(FFMPEG_VERSION FFMPEG_VERSION-NOTFOUND) + endif () + unset(_ffmpeg_version_header_path) +endif () + +set(FFMPEG_INCLUDE_DIRS) +set(FFMPEG_LIBRARIES) +set(_ffmpeg_required_vars) +foreach (_ffmpeg_component IN LISTS FFMPEG_FIND_COMPONENTS) + if (TARGET "FFMPEG::${_ffmpeg_component}") + set(FFMPEG_${_ffmpeg_component}_INCLUDE_DIRS + "${FFMPEG_${_ffmpeg_component}_INCLUDE_DIR}") + set(FFMPEG_${_ffmpeg_component}_LIBRARIES + "${FFMPEG_${_ffmpeg_component}_LIBRARY}") + list(APPEND FFMPEG_INCLUDE_DIRS + "${FFMPEG_${_ffmpeg_component}_INCLUDE_DIRS}") + list(APPEND FFMPEG_LIBRARIES + "${FFMPEG_${_ffmpeg_component}_LIBRARIES}") + if (FFMEG_FIND_REQUIRED_${_ffmpeg_component}) + list(APPEND _ffmpeg_required_vars + "FFMPEG_${_ffmpeg_required_vars}_INCLUDE_DIRS" + "FFMPEG_${_ffmpeg_required_vars}_LIBRARIES") + endif () + endif () +endforeach () +unset(_ffmpeg_component) + +if (FFMPEG_INCLUDE_DIRS) + list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS) +endif () + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FFMPEG + REQUIRED_VARS FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES ${_ffmpeg_required_vars} + VERSION_VAR FFMPEG_VERSION + HANDLE_COMPONENTS) +unset(_ffmpeg_required_vars) diff --git a/cmake/FindGStreamer.cmake b/cmake/FindGStreamer.cmake index 5d761571265..70507567bdd 100644 --- a/cmake/FindGStreamer.cmake +++ b/cmake/FindGStreamer.cmake @@ -108,7 +108,6 @@ elseif(ANDROID) set(ENV{PKG_CONFIG_LIBDIR} "${GSTREAMER_PREFIX}/lib/pkgconfig:${GSTREAMER_PREFIX}/lib/gstreamer-1.0/pkgconfig") # set(ENV{PKG_CONFIG_SYSROOT_DIR} "${GSTREAMER_PREFIX}") message(STATUS "PKG_CONFIG_PATH $ENV{PKG_CONFIG_PATH}") - message(STATUS "PKG_CONFIG_LIBDIR $ENV{PKG_CONFIG_LIBDIR}") # message(STATUS "PKG_CONFIG_SYSROOT_DIR $ENV{PKG_CONFIG_SYSROOT_DIR}") list(APPEND PKG_CONFIG_ARGN --dont-define-prefix @@ -128,7 +127,9 @@ find_dependency(GObject) set(GStreamer_VERSION ${QGC_GST_TARGET_VERSION}) find_package(PkgConfig QUIET) -if(NOT PkgConfig_FOUND) +if(PkgConfig_FOUND) + pkg_check_modules(GStreamer gstreamer-1.0) +else() find_file(GStreamer_VERSION_HEADER NAMES gst/gstversion.h PATHS ${GSTREAMER_PREFIX}/include/gstreamer-1.0 @@ -155,18 +156,16 @@ if(NOT PkgConfig_FOUND) string(SUBSTRING "${_gst_micro_version_line}" 19 -1 GStreamer_VERSION_PATCH) unset(_gstversion_header_contents) set(GStreamer_VERSION "${GStreamer_VERSION_MAJOR}.${GStreamer_VERSION_MINOR}.${GStreamer_VERSION_PATCH}") - cmake_print_variables(GStreamer_VERSION) endif() endif() +cmake_print_variables(GStreamer_VERSION) function(find_gstreamer_component component prefix header library) if(NOT TARGET GStreamer::${component}) string(TOUPPER ${component} upper) - # if(ANDROID) - # pkg_check_modules(PC_GSTREAMER_${upper} ${prefix} IMPORTED_TARGET NO_CMAKE_ENVIRONMENT_PATH) - # else() + if(PkgConfig_FOUND) pkg_check_modules(PC_GSTREAMER_${upper} ${prefix} IMPORTED_TARGET) - # endif() + endif() if(TARGET PkgConfig::PC_GSTREAMER_${upper}) add_library(GStreamer::${component} INTERFACE IMPORTED) target_link_libraries(GStreamer::${component} INTERFACE PkgConfig::PC_GSTREAMER_${upper}) diff --git a/deploy/docker/Dockerfile-build-ubuntu b/deploy/docker/Dockerfile-build-ubuntu index 5ff6239088f..2e44e7154d4 100644 --- a/deploy/docker/Dockerfile-build-ubuntu +++ b/deploy/docker/Dockerfile-build-ubuntu @@ -1,5 +1,4 @@ FROM ubuntu:22.04 -LABEL authors="Daniel Agar , Patrick José Pereira " ARG QT_VERSION=6.6.3 ARG QT_MODULES="qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d qtsensors" @@ -16,16 +15,14 @@ ENV PATH /usr/lib/ccache:$QT_DESKTOP/bin:$PATH COPY tools/setup/install-dependencies-debian.sh /tmp/qt/ RUN /tmp/qt/install-dependencies-debian.sh -# Install Qt COPY tools/setup/install-qt-debian.sh /tmp/qt/ RUN /tmp/qt/install-qt-debian.sh -# Reconfigure locale RUN locale-gen en_US.UTF-8 && dpkg-reconfigure locales RUN git config --global --add safe.directory /project/source WORKDIR /project/build -CMD cmake -S /project/source -B . -G Ninja -DCMAKE_BUILD_TYPE=Debug -DQGC_BUILD_TESTING=ON -DQGC_STABLE_BUILD=OFF ; \ - cmake --build . --target all --config Debug ; \ - cmake --install . --config Debug +CMD cmake -S /project/source -B . -G Ninja -DCMAKE_BUILD_TYPE=Release ; \ + cmake --build . --target all --config Release ; \ + cmake --install . --config Release diff --git a/deploy/docker/run-docker.sh b/deploy/docker/run-docker-ubuntu.sh similarity index 100% rename from deploy/docker/run-docker.sh rename to deploy/docker/run-docker-ubuntu.sh diff --git a/src/Comms/LinkManager.cc b/src/Comms/LinkManager.cc index 85b8533fc1a..6fd410bfd42 100644 --- a/src/Comms/LinkManager.cc +++ b/src/Comms/LinkManager.cc @@ -71,7 +71,9 @@ LinkManager::LinkManager(QGCApplication* app, QGCToolbox* toolbox) qRegisterMetaType(); qRegisterMetaType("LinkInterface*"); +#ifndef NO_SERIAL_LINK qRegisterMetaType("QGCSerialPortInfo"); +#endif } LinkManager::~LinkManager() diff --git a/src/Joystick/JoystickManager.cc b/src/Joystick/JoystickManager.cc index 717ae4e93f8..fa942a98ec2 100644 --- a/src/Joystick/JoystickManager.cc +++ b/src/Joystick/JoystickManager.cc @@ -11,9 +11,8 @@ #include "JoystickManager.h" #include "MultiVehicleManager.h" #include "Joystick.h" -#if !defined(__mobile__) || defined(QGC_SDL_JOYSTICK) +#if defined(QGC_SDL_JOYSTICK) #include "JoystickSDL.h" - #define __sdljoystick__ #elif defined(Q_OS_ANDROID) #include "JoystickAndroid.h" #endif @@ -57,7 +56,7 @@ void JoystickManager::setToolbox(QGCToolbox *toolbox) } void JoystickManager::init() { -#ifdef __sdljoystick__ +#ifdef QGC_SDL_JOYSTICK if (!JoystickSDL::init()) { return; } @@ -77,7 +76,7 @@ void JoystickManager::_setActiveJoystickFromSettings(void) { QMap newMap; -#ifdef __sdljoystick__ +#ifdef QGC_SDL_JOYSTICK // Get the latest joystick mapping newMap = JoystickSDL::discover(_multiVehicleManager); #elif defined(Q_OS_ANDROID) @@ -194,7 +193,7 @@ bool JoystickManager::setActiveJoystickName(const QString& name) */ void JoystickManager::_updateAvailableJoysticks() { -#ifdef __sdljoystick__ +#ifdef QGC_SDL_JOYSTICK SDL_Event event; while (SDL_PollEvent(&event)) { switch(event.type) { diff --git a/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/CMakeLists.txt b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/CMakeLists.txt index 21b678266d5..07c94e57911 100644 --- a/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/CMakeLists.txt +++ b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/CMakeLists.txt @@ -1,7 +1,6 @@ -find_package(GStreamer REQUIRED COMPONENTS OPTIONAL_COMPONENTS X11 EGL Wayland) +find_package(GStreamer REQUIRED COMPONENTS Codecparsers Controller Mpegts Net Pbutils Riff Rtp Rtsp OPTIONAL_COMPONENTS Photography X11 EGL Wayland) # Use Latest Revisions for each minor version: 1.16.3, 1.18.6, 1.20.7, 1.22.12, 1.24.7 - string(REPLACE "." ";" GST_VERSION_LIST ${GStreamer_VERSION}) list(GET GST_VERSION_LIST 0 GST_VERSION_MAJOR) list(GET GST_VERSION_LIST 1 GST_VERSION_MINOR) @@ -64,8 +63,21 @@ target_link_libraries(gstqml6gl Qt6::Qml Qt6::Quick GStreamer::GStreamer + GStreamer::Codecparsers + GStreamer::Controller + GStreamer::Mpegts + GStreamer::Net + GStreamer::Pbutils + GStreamer::Riff + GStreamer::Rtp + GStreamer::Rtsp ) +# Photography not found on ubuntu 20.04? +if(GStreamer_Photography_FOUND) + target_link_libraries(gstqml6gl PUBLIC GStreamer::Photography) +endif() + target_include_directories(gstqml6gl PUBLIC ${QGC_GST_QT6_PLUGIN_PATH}) if(GStreamer_X11_FOUND) @@ -218,6 +230,49 @@ if(NOT GST_PLUGINS_FOUND) endif() endif() endforeach() + + if(ANDROID) + target_include_directories(gstqml6gl + PUBLIC + ${GSTREAMER_PREFIX}/include/gstreamer-1.0 + ${GSTREAMER_PREFIX}/include/glib-2.0 + ${GSTREAMER_PREFIX}/lib/glib-2.0/include + ${GSTREAMER_PREFIX}/lib/gstreamer-1.0/include + ${GSTREAMER_PREFIX}/include + ) + + find_package(FFMPEG REQUIRED COMPONENTS avcodec avfilter avformat avutil swresample) + if(FFMPEG_FOUND) + target_link_libraries(gstqml6gl PUBLIC ${FFMPEG_LIBRARIES}) + target_include_directories(gstqml6gl PUBLIC ${FFMPEG_INCLUDE_DIRS}) + endif() + + find_package(BZip2) + if(BZIP2_FOUND) + target_link_libraries(gstqml6gl PUBLIC BZip2::BZip2) + endif() + + find_library(graphene_LIBRARY graphene-1.0) + if(graphene_LIBRARY) + target_link_libraries(gstqml6gl PUBLIC ${graphene_LIBRARY}) + endif() + + find_library(x264_LIBRARY x264) + if(x264_LIBRARY) + target_link_libraries(gstqml6gl PUBLIC ${x264_LIBRARY}) + endif() + + find_package(JPEG) + if(JPEG_FOUND) + target_link_libraries(gstqml6gl PUBLIC JPEG::JPEG) + endif() + + find_package(PNG) + if(PNG_FOUND) + target_link_libraries(gstqml6gl PUBLIC PNG::PNG) + endif() + + endif() endif() if(ANDROID) diff --git a/tools/setup/install-dependencies-debian.sh b/tools/setup/install-dependencies-debian.sh index d1a1f4e75b7..027a33fee8e 100755 --- a/tools/setup/install-dependencies-debian.sh +++ b/tools/setup/install-dependencies-debian.sh @@ -63,9 +63,9 @@ DEBIAN_FRONTEND=noninteractive apt -y --quiet install \ # GStreamer DEBIAN_FRONTEND=noninteractive apt -y --quiet install \ libgstreamer1.0-dev \ - libgstreamer-plugins-bad1.0-0 \ + libgstreamer-plugins-bad1.0-dev \ libgstreamer-plugins-base1.0-dev \ - libgstreamer-plugins-good1.0-0 \ + libgstreamer-plugins-good1.0-dev \ libgstreamer-gl1.0-0 \ gstreamer1.0-plugins-bad \ gstreamer1.0-plugins-base \ @@ -96,12 +96,16 @@ DEBIAN_FRONTEND=noninteractive apt -y --quiet install \ libspeechd-dev \ libunwind-dev \ libva-dev \ + libvpx-dev \ libvdpau-dev \ libwayland-dev \ libx11-dev \ libzstd-dev \ mesa-common-dev \ + mesa-utils \ mesa-va-drivers \ + mesa-vdpau-drivers \ + mesa-vulkan-drivers \ speech-dispatcher \ speech-dispatcher-espeak \ speech-dispatcher-espeak-ng \