Skip to content

Commit

Permalink
awesome!!
Browse files Browse the repository at this point in the history
Signed-off-by: swurl <[email protected]>
  • Loading branch information
crueter committed Jan 9, 2024
1 parent 2e0af43 commit 6462cd3
Show file tree
Hide file tree
Showing 21 changed files with 773 additions and 20 deletions.
188 changes: 188 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: CMake on multiple platforms

on:
workflow_call:
inputs:
build_type:
description: Type of build (Debug, Release, RelWithDebInfo, MinSizeRel)
type: string
default: Debug

jobs:
build:
strategy:
fail-fast: false
matrix:
include:

- os: ubuntu-20.04
qt_host: linux
qt_version: '6.6.0'
qt_modules: 'qt6-svg-dev qt6-wayland-dev'

runs-on: ${{ matrix.os }}

env:
INSTALL_DIR: "install"
INSTALL_APPIMAGE_DIR: "install-appdir"
BUILD_DIR: "build"
VERSION: "1.0.0"

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Install CMake
uses: lukka/[email protected]

- name: 'Install Qt 6.6.0'
if: runner.os == 'Linux'
uses: jurplel/[email protected]
with:
version: 6.6.0
modules: qtsvg qtwaylandcompositor

- name: 'Install Python Dependencies (Linux)'
if: runner.os == 'Linux'
run: |
pip install jinja2
- name: Prepare AppImage (Linux)
if: runner.os == 'Linux'
run: |
wget "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
wget "https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage"
wget "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
- name: Configure CMake (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install libstdc++-10-dev gcc-10 ninja-build
git submodule update --init --recursive
cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/g++-10
- name: Build
run: |
cmake --build ${{ env.BUILD_DIR }} --parallel $(nproc)
- name: Package (Linux)
if: runner.os == 'Linux'
run: |
cmake --install ${{ env.BUILD_DIR }} --prefix ${{ env.INSTALL_DIR }}/usr
cd ${{ env.INSTALL_DIR }}
tar --owner root --group root -czf ../QFRCScouter.tar.gz *
- name: Package AppImage (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get install libxcb-cursor-dev libxcb-cursor0
mkdir -p ${{ env.INSTALL_APPIMAGE_DIR}}/usr/{lib,bin}
cmake --install ${{ env.BUILD_DIR }} --prefix ${{ env.INSTALL_APPIMAGE_DIR }}/usr
export OUTPUT="QFRCScouter-${{ runner.os }}-${{ env.VERSION }}-${{ inputs.build_type }}-x86_64.AppImage"
chmod +x linuxdeploy-*.AppImage
mkdir -p ${{ env.INSTALL_APPIMAGE_DIR }}/usr/plugins/iconengines
cp -r /home/runner/work/QFRCScouter/Qt/${{ matrix.qt_version }}/gcc_64/plugins/iconengines/* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/plugins/iconengines
cp /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/
cp /usr/lib/x86_64-linux-gnu/libssl.so.1.1 ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/
./linuxdeploy-x86_64.AppImage --appdir ${{ env.INSTALL_APPIMAGE_DIR }} --output appimage --plugin qt
- name: Upload portable tarball (Linux)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
with:
name: QFRCScouter-${{ runner.os }}-Binary-${{ env.VERSION }}-${{ inputs.build_type }}
path: QFRCScouter.tar.gz

- name: Upload AppImage (Linux)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
with:
name: QFRCScouter-${{ runner.os }}-${{ env.VERSION }}-${{ inputs.build_type }}-x86_64.AppImage
path: QFRCScouter-${{ runner.os }}-${{ env.VERSION }}-${{ inputs.build_type }}-x86_64.AppImage


build-windows:
name: "Build - Windows"
runs-on: windows-2022

env:
VERSION: "1.0.0"
BUILD_WIN_DIR: "winbuild"
INSTALL_WIN_DIR: "install-win"

steps:
- uses: ilammy/msvc-dev-cmd@v1

- name: Install CMake
uses: lukka/[email protected]

- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: 'Install Qt (Windows)'
uses: jurplel/[email protected]
with:
version: 6.6.0
modules: qtsvg

- name: Install jinja
run: |
python -m ensurepip
python -m pip install jinja2
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: 'Build (Windows)'
run: |
git submodule update --init --recursive
cmake -S . -B ${{ env.BUILD_WIN_DIR }} -G "Ninja" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=${{ inputs.build_type }}
cmake --build ${{ env.BUILD_WIN_DIR }} --config ${{ inputs.build_type }} --parallel $(nproc)
env:
SCCACHE_GHA_ENABLED: "true"

- name: Package (Windows)
shell: cmd
run: |
mkdir ${{ env.INSTALL_WIN_DIR }}
set PATH=%PATH%;"${{ runner.workspace }}\Qt\6.6.0\msvc2019_64\bin"
windeployqt ${{ env.BUILD_WIN_DIR }}\QFRCScouter.exe --dir ${{ env.INSTALL_WIN_DIR }}
cp ${{ env.BUILD_WIN_DIR }}\QFRCScouter.exe ${{ env.INSTALL_WIN_DIR }}
if "${{ inputs.build_type }}" == "Debug" (
cp C:\Windows\System32\ucrtbased.dll ${{ env.INSTALL_WIN_DIR }}
) else (
cp C:\Windows\System32\ucrtbase.dll ${{ env.INSTALL_WIN_DIR }}
)
##
# UPLOAD BUILDS
##

- name: Upload binary zip (Windows, portable)
uses: actions/upload-artifact@v3
with:
name: QFRCScouter-Windows-Portable-${{ env.VERSION }}-${{ inputs.build_type }}
path: ${{ env.INSTALL_WIN_DIR }}/**
26 changes: 26 additions & 0 deletions .github/workflows/trigger_builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build Application

on:
push:
branches-ignore:
- 'stable'
paths-ignore:
- '**.md'
- '**/LICENSE'
- '.github/ISSUE_TEMPLATE/**'
- '.markdownlint**'
pull_request:
paths-ignore:
- '**.md'
- '**/LICENSE'
- '.github/ISSUE_TEMPLATE/**'
- '.markdownlint**'
workflow_dispatch:

jobs:

build_debug:
name: Build Debug
uses: ./.github/workflows/build.yml
with:
build_type: Debug
58 changes: 58 additions & 0 deletions .github/workflows/trigger_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build Application and Make Release

on:
push:
tags:
- '*'

permissions:
contents: write

jobs:

build_release:
name: Build Release
uses: ./.github/workflows/build.yml
with:
build_type: Release

create_release:
needs: build_release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'true'
path: 'QFRCScouter-source'
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Grab and store version
run: |
tag_name=$(echo ${{ github.ref }} | grep -oE "[^/]+$")
echo "VERSION=$tag_name" >> $GITHUB_ENV
- name: Package artifacts properly
run: |
mv ${{ github.workspace }}/QFRCScouter-source QFRCScouter-${{ env.VERSION }}
ls *
mv QFRCScouter-Linux-Binary*/QFRCScouter.tar.gz QFRCScouter-Linux-Binary-${{ env.VERSION }}.tar.gz
mv QFRCScouter-*.AppImage/QFRCScouter-*.AppImage QFRCScouter-Linux-${{ env.VERSION }}-x86_64.AppImage
zip -r QFRCScouter-Windows-Portable-${{ env.VERSION }}.zip QFRCScouter-Windows-Portable*/* QFRCScouter-Windows-Portable-${{ env.VERSION }}.zip
tar -czf QFRCScouter-${{ env.VERSION }}.tar.gz QFRCScouter-${{ env.VERSION }}
- name: Create release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
name: QFRCScouter ${{ env.VERSION }}
draft: true
prerelease: false
files: |
QFRCScouter-Linux-Binary-${{ env.VERSION }}.tar.gz
QFRCScouter-Linux-${{ env.VERSION }}-x86_64.AppImage
QFRCScouter-Windows-Portable-${{ env.VERSION }}.zip
QFRCScouter-${{ env.VERSION }}.tar.gz
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "Qt-QrCodeGenerator"]
path = Qt-QrCodeGenerator
url = https://github.com/alex-spataru/Qt-QrCodeGenerator.git
[submodule "qt-android-cmake"]
path = qt-android-cmake
url = https://github.com/LaurentGomila/qt-android-cmake.git
23 changes: 7 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,15 @@ set(PROJECT_SOURCES
include/QRCode.h src/QRCode.cpp ui/QRCode.ui
)

# if(ANDROID)
# add_subdirectory(qt-android-cmake)
# add_library(QFRCScouter SHARED
# ${QRCODE_SOURCES}
# ${PROJECT_SOURCES}
# )
# include(qt-android-cmake/AddQtAndroidApk.cmake)
# add_qt_android_apk(QFRCScouterApk QFRCScouter)

qt_add_executable(QFRCScouter
MANUAL_FINALIZATION
${QRCODE_SOURCES}
${PROJECT_SOURCES}
include/BetterSpinBox.h src/BetterSpinBox.cpp ui/BetterSpinBox.ui
)
# endif()
qt_add_executable(QFRCScouter
MANUAL_FINALIZATION
${QRCODE_SOURCES}
${PROJECT_SOURCES}
include/BetterSpinBox.h src/BetterSpinBox.cpp ui/BetterSpinBox.ui


)

target_link_libraries(QFRCScouter PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Svg)

# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
Expand Down
21 changes: 21 additions & 0 deletions android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.frc4028.QFRCScouter" android:installLocation="auto" android:versionCode="1" android:versionName="1.0.0">
<!-- %%INSERT_PERMISSIONS -->
<!-- %%INSERT_FEATURES -->
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
<application android:name="org.qtproject.qt.android.bindings.QtApplication" android:hardwareAccelerated="true" android:label="QFRCScouter" android:requestLegacyExternalStorage="true" android:allowBackup="true" android:fullBackupOnly="false" android:icon="@drawable/icon">
<activity android:name="org.qtproject.qt.android.bindings.QtActivity" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:label="QFRCScouter" android:launchMode="singleTop" android:screenOrientation="unspecified" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
<meta-data android:name="android.app.arguments" android:value="-- %%INSERT_APP_ARGUMENTS%% --"/>
<meta-data android:name="android.app.extract_android_style" android:value="minimal"/>
</activity>

<provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.qtprovider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/qtprovider_paths"/>
</provider>
</application>
</manifest>
Loading

0 comments on commit 6462cd3

Please sign in to comment.