Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Flatpak automatic generation #20

Merged
merged 4 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
build_release:
name: "Create flatpak release"
runs-on: ubuntu-24.04

container:
image: bilelmoussaoui/flatpak-github-actions:kde-5.15
options: --privileged

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Build Linux Flatpak
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: flatfab.flatpak
manifest-path: flatpak/edu.toronto.dgp.FlatFab.yml
cache-key: flatpak-builder-${{ github.sha }}

- name: Create release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: Release ${{ github.ref }}
tag_name: ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Upload Linux artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./flatfab.flatpak
asset_name: flatfab.flatpak
asset_content_type: application/vnd.flatpak
20 changes: 1 addition & 19 deletions .github/workflows/linux_release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Linux Release
name: Linux Compilation

on:
push:
Expand All @@ -20,7 +20,6 @@ defaults:
env:
SOURCE_DIR: ${{ github.workspace }}
QT_VERSION: 5.15.2
ARTIFACT: FlatFab.AppImage

jobs:
build:
Expand All @@ -37,7 +36,6 @@ jobs:
uses: jurplel/install-qt-action@v4
with:
version: ${{ env.QT_VERSION }}
modules: qtwebengine
setup-python: false

- name: Install other dependencies
Expand All @@ -52,19 +50,3 @@ jobs:
qmake -r ${{ env.SOURCE_DIR }}/FlatFab.pro
make

# TODO:
#- name: AppImage
# working-directory: ${{ env.SOURCE_DIR }}/build
# run: |
# wget -O deploy.AppImage https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
# chmod +x deploy.AppImage
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ github.workspace }}/Qt/5.15.2/gcc_64/lib/
# cp ${{ env.SOURCE_DIR }}/linux/* .
# ./deploy.AppImage FlatFab.desktop -appimage -no-translations -extra-plugins=renderers
# mv FlatFab*.AppImage ${{ env.ARTIFACT }}
#
#- name: Linux artefact
# uses: actions/upload-artifact@v4
# with:
# name: ${{ env.ARTIFACT }}
# path: ${{ env.SOURCE_DIR }}/build/${{ env.ARTIFACT }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ Eigen/*
*.txt
!icons/icon-license.txt
!example_models/*.txt
.flatpak-builder/
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

find_package(Qt5 COMPONENTS Core Gui OpenGL Widgets Network WebEngineWidgets REQUIRED)
find_package(Qt5 COMPONENTS Core Gui OpenGL Widgets REQUIRED)

find_package(Eigen3 REQUIRED NO_MODULE)
find_package(OpenGL REQUIRED)
Expand Down Expand Up @@ -77,8 +77,6 @@ target_link_libraries(${PROJECT_NAME}
Qt5::Gui
Qt5::OpenGL
Qt5::Widgets
Qt5::Network
Qt5::WebEngineWidgets
OpenGL::GL
${GLU_LIBRARY})

Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,21 @@ You need Qt5 (tested on Ubuntu 24.10 with QtCreator 13; any previous release sho
- install `libeigen3-dev` and `libglu1-mesa-dev`
- open `FlatFab.pro` from QtCreator
- press Build and enjoy!

#### Flatpak

Uses the latest Qt 5.15 runtime; builds manually Eigen and GLU.

To build:

- install `flatpak` and `flatpak-builder`
- `flatpak install org.kde.Sdk/x86_64/5.15-24.08`
- `flatpak install org.kde.Platform/x86_64/5.15-24.08`
- `cd flatpak && flatpak-builder --force-clean --install --user build-flatpak edu.toronto.dgp.FlatFab.yml`

You can then test your freshly generated flatpak with:

- `flatpak run edu.toronto.dgp.FlatFab`



10 changes: 10 additions & 0 deletions flatpak/app/share/applications/edu.toronto.dgp.FlatFab.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Desktop Entry]
Type=Application

Name=FlatFab
Comment=flatfab is software that helps you design and fabricate 3D objects. We imagine in 3D but ideate and draw in 2D. flatfab seamlessly does both.
Categories=Graphics;Engineering;

Icon=edu.toronto.dgp.FlatFab
Exec=FlatFab
Terminal=false
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions flatpak/app/share/metainfo/edu.toronto.dgp.FlatFab.metainfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>edu.toronto.dgp.FlatFab</id>

<name>FlatFab</name>
<summary>flatfab is software that helps you design and fabricate 3D objects. We imagine in 3D but ideate and draw in 2D. flatfab seamlessly does both. </summary>

<metadata_license>CC-BY-SA-4.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>

<description>
<p>
flatfab marries digital modeling and traditional craftsmanship. 3D printing in new-age materials is great for small complex objects, but prohibitive in time and money for anything bigger than your fist. flatfab enables designers and hobbyists to use their own skills working with common tools and materials, anything that is reasonably flat and can be cut: paper, plastic, wood, steel, even stone.
</p>
<p>
The flatfab way - Create your design fluidly, using connected planar parts - Print your design as 2D curves, ready to cut - Cut your design, with a digital cutter or by hand - Pack it flat, if you need to transport it - Assemble the parts together, there are no tools required!
</p>
</description>

<launchable type="desktop-id">edu.toronto.dgp.FlatFab.desktop</launchable>
<screenshots>
<screenshot type="default">
<image>https://www.dgp.toronto.edu/~mccrae/projects/flatfitfab/gallery-images/ff_software_win2.jpg</image>
</screenshot>
<screenshot>
<image>https://www.dgp.toronto.edu/~mccrae/projects/flatfitfab/gallery-images/ff_software_win1.jpg</image>
</screenshot>
<screenshot>
<image>https://www.dgp.toronto.edu/~mccrae/projects/flatfitfab/gallery-images/elephant_fab.jpg</image>
</screenshot>
</screenshots>

<releases>
<release version="0.8.4" date="2024-12-09" />
</releases>
</component>
41 changes: 41 additions & 0 deletions flatpak/edu.toronto.dgp.FlatFab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
id: edu.toronto.dgp.FlatFab
runtime: org.kde.Platform
runtime-version: '5.15-24.08'
sdk: org.kde.Sdk
command: flatfab-launch.sh
finish-args:
- --share=ipc
- --socket=fallback-x11
- --socket=wayland
- --device=dri # GPU acceleration
- --filesystem=xdg-documents # to save/load local files
modules:
- name: eigen
buildsystem: cmake
builddir: true
sources:
- type: archive
url: https://gitlab.com/libeigen/eigen/-/archive/3.3.9/eigen-3.3.9.zip
sha512: 3b06da583037649ad42190bd018ddf40b85179ad0877ebd7c1ca7b8498a1453eed25919de27d3bb737754086e1513408e7de4a2110d51912f2e5503e1ab7d838
- name: glu
buildsystem: meson
sources:
- type: archive
url: https://archive.mesa3d.org/glu/glu-9.0.3.tar.xz
sha256: bd43fe12f374b1192eb15fe20e45ff456b9bc26ab57f0eee919f96ca0f8a330f
cleanup: [ /include, /lib/*.a, /lib/*.la, /lib/pkgconfig ]
- name: flatfab
buildsystem: cmake-ninja
config-opts:
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
sources:
- type: dir
path: ../
- name: flatfab-launch
buildsystem: simple
build-commands:
- "install -D flatfab-launch.sh /app/bin/flatfab-launch.sh"
- "chmod +x /app/bin/flatfab-launch.sh"
sources:
- type: file
path: flatfab-launch.sh
5 changes: 5 additions & 0 deletions flatpak/flatfab-launch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

export LD_LIBRARY_PATH=/app/lib64:/app/lib:$LD_LIBRARY_PATH
exec /app/bin/FlatFab "$@"