Skip to content

Commit

Permalink
Convert Linux Release to CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Apr 10, 2024
1 parent fdb5b55 commit 22df5fe
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 380 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Linux Build

on:
push:
branches:
- master
- 'Stable*'
tags:
- 'v*'
paths-ignore:
- 'docs/**'
- 'android/**'
pull_request:
paths-ignore:
- 'docs/**'
- 'android/**'

defaults:
run:
shell: bash

env:
ARTIFACT: QGroundControl-x86_64.AppImage

jobs:
build:
runs-on: ubuntu-20.04

strategy:
matrix:
BuildType: [Debug, Release]

steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: recursive
fetch-tags: true

- name: Set up Cache
uses: hendrikmuhs/[email protected]
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
with:
create-symlink: true
key: ${{ runner.os }}-${{ matrix.BuildType }}
restore-keys: ${{ runner.os }}-${{ matrix.BuildType }}
max-size: 1G
append-timestamp: false

- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: 6.6.3
aqtversion: ==3.1.*
host: linux
target: desktop
dir: ${{ runner.temp }}
modules: qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d
setup-python: true
cache: true

- name: Install Dependencies
run: |
chmod a+x ./tools/setup/ubuntu.sh
./tools/setup/ubuntu.sh
- name: Create build directory
run: mkdir ${{ runner.temp }}/shadow_build_dir

- name: Configure
working-directory: ${{ runner.temp }}/shadow_build_dir
run: cmake -S ${{ github.workspace }} -B . -G Ninja \
-DCMAKE_BUILD_TYPE=${{ matrix.BuildType }} \
-DQGC_BUILD_TESTING=${{ matrix.BuildType == 'Debug' }} \
-DQGC_STABLE_BUILD=${{ github.ref_type == 'tag' || contains(github.ref, 'Stable') && 'ON' || 'OFF' }}

- name: Build
working-directory: ${{ runner.temp }}/shadow_build_dir
run: cmake --build . --target all --config ${{ matrix.BuildType }}

- name: Create AppImage
working-directory: ${{ runner.temp }}/shadow_build_dir
run: cmake --install .

- name: Run unit tests
if: matrix.BuildType == 'Debug'
working-directory: ${{ runner.temp }}/shadow_build_dir
run: |
mkdir -p ~/.config/QtProject/
cp ${{ github.workspace }}/test/qtlogging.ini ~/.config/QtProject/
export QT_FATAL_WARNINGS=1
xvfb-run -a ./${{ env.ARTIFACT }} --unittest
- name: Upload Build File
uses: ./.github/actions/upload
if: matrix.BuildType == 'Release'
with:
artifact_name: ${{ env.ARTIFACT }}
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
source: ''
87 changes: 0 additions & 87 deletions .github/workflows/linux_debug.yml

This file was deleted.

90 changes: 0 additions & 90 deletions .github/workflows/linux_release.yml

This file was deleted.

28 changes: 12 additions & 16 deletions cmake/CreateAppImage.cmake
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
message(STATUS Creating AppImage)

set(APPDIR_PATH "${CMAKE_BINARY_DIR}/AppDir")
# set(AIT_PATH "${CMAKE_BINARY_DIR}/appimagetool-x86_64.AppImage")
set(LD_PATH "${CMAKE_BINARY_DIR}/linuxdeploy-x86_64.AppImage")
#set(LD_QTPLUGIN_PATH "${CMAKE_BINARY_DIR}/linuxdeploy-plugin-qt-x86_64.AppImage")
set(LD_APPIMAGEPLUGIN_PATH "${CMAKE_BINARY_DIR}/linuxdeploy-plugin-appimage-x86_64.AppImage")
set(LD_QTPLUGIN_PATH "${CMAKE_BINARY_DIR}/linuxdeploy-plugin-qt-x86_64.AppImage")

# if(NOT EXISTS "${AIT_PATH}")
# file(DOWNLOAD https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage "${AIT_PATH}")
# execute_process(COMMAND chmod a+x "${AIT_PATH}")
# endif()
if(NOT EXISTS "${LD_PATH}")
file(DOWNLOAD https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20240109-1/linuxdeploy-x86_64.AppImage "${LD_PATH}")
file(DOWNLOAD https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage "${LD_PATH}")
execute_process(COMMAND chmod a+x "${LD_PATH}")
endif()
# if(NOT EXISTS "${LD_QTPLUGIN_PATH}")
# file(DOWNLOAD https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/1-alpha-20240109-1/linuxdeploy-plugin-qt-x86_64.AppImage "${LD_QTPLUGIN_PATH}")
# execute_process(COMMAND chmod a+x "${LD_QTPLUGIN_PATH}")
# endif()

# execute_process(COMMAND chmod a+x "${APPDIR_PATH}/AppRun")
if(NOT EXISTS "${LD_APPIMAGEPLUGIN_PATH}")
file(DOWNLOAD https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage "${LD_APPIMAGEPLUGIN_PATH}")
execute_process(COMMAND chmod a+x "${LD_APPIMAGEPLUGIN_PATH}")
endif()
if(NOT EXISTS "${LD_QTPLUGIN_PATH}")
file(DOWNLOAD https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage "${LD_QTPLUGIN_PATH}")
execute_process(COMMAND chmod a+x "${LD_QTPLUGIN_PATH}")
endif()

# execute_process(COMMAND ${AIT_PATH} --appdir ${APPDIR_PATH} --output appimage)
# execute_process(COMMAND ${LDQT_PATH} ${APPDIR_PATH}/usr/share/applications/org.mavlink.qgroundcontrol.desktop -unsupported-allow-new-glibc -verbose=2 -appimage)
execute_process(COMMAND ${LD_PATH} --appdir ${APPDIR_PATH} --output appimage)
execute_process(COMMAND ${LD_PATH} --appdir ${APPDIR_PATH} --output appimage) # --plugin qt
Loading

0 comments on commit 22df5fe

Please sign in to comment.