Skip to content

Commit

Permalink
Migrate to Qt6.5 + add WASM build (#274)
Browse files Browse the repository at this point in the history
* Migrate to Qt6 + WASM

* format

* wasm

* bump ubuntu version
  • Loading branch information
mortbopet committed Apr 16, 2023
1 parent 17e6946 commit 057adf5
Show file tree
Hide file tree
Showing 43 changed files with 356 additions and 171 deletions.
30 changes: 13 additions & 17 deletions .github/workflows/linux-release.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: Ubuntu 18.04 / Qt 5.15
name: Ubuntu 20.04 / Qt 6.5.0
on:
workflow_run:
workflows: ["Release setup"]
types: [completed]

jobs:
buildUbuntuXenial:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
env:
CC: gcc-9
CXX: g++-9

strategy:
strateg
matrix:
build-type: [Release, Debug]

Expand All @@ -33,22 +33,18 @@ jobs:
libxcb-xinerama0 libxcb-composite0 libxcb-cursor0 libxcb-damage0 \
libxcb-dpms0 libxcb-dri2-0 libxcb-dri3-0 libxcb-ewmh2 libxcb-glx0 \
libxcb-present0 libxcb-randr0 libxcb-record0 libxcb-render0 libxcb-res0 \
libxcb-screensaver0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-util1
libxcb-screensaver0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-util1 libegl1
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
path: ../Qt
key: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}

- name: install Qt
uses: jurplel/install-qt-action@v2
with:
version: '5.15.2'
modules: 'qtcharts qtsvg'
install-deps: false
cached: ${{ steps.cache-qt.outputs.cache-hit }}
aqtversion: '==3.1.*'
py7zrversion: '>=0.20.2'
version: '6.5.0'
host: 'linux'
target: 'desktop'
arch: 'gcc_64'
modules: 'qtcharts'

- name: checkout sources
uses: actions/checkout@v2
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/mac-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Mac / Qt 5.15
name: Mac / Qt 6.5.0
on:
workflow_run:
workflows: ["Release setup"]
Expand All @@ -22,20 +22,16 @@ jobs:
- name: setup Homebrew
run: brew install autoconf automake libtool xz pkg-config libgit2 libjpg libpng libmtp svg2png

- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
path: ../Qt
key: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}

- name: install Qt
uses: jurplel/install-qt-action@v2
with:
version: '5.15.2'
modules: 'qtcharts qtsvg'
install-deps: false
cached: ${{ steps.cache-qt.outputs.cache-hit }}
aqtversion: '==3.1.*'
py7zrversion: '>=0.20.2'
version: '6.5.0'
host: 'mac'
target: 'desktop'
arch: 'clang_64'
modules: 'qtcharts'

- name: build Ripes
run: |
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest, ubuntu-18.04]
os: [ubuntu-latest, macos-latest, windows-latest, ubuntu-20.04]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -57,18 +57,18 @@ jobs:
# Qt installation
- if: "!contains(matrix.os, 'windows')"
name: install Qt
uses: jurplel/install-qt-action@v2
uses: jurplel/install-qt-action@v3
with:
version: '5.15.2'
modules: 'qtcharts qtsvg'
version: '6.5.0'
modules: 'qtcharts'
install-deps: false

- if: contains( matrix.os, 'windows')
name: install Qt (Windows)
uses: jurplel/install-qt-action@v2
uses: jurplel/install-qt-action@v3
with:
version: '5.15.2'
modules: 'qtcharts qtsvg'
version: '6.5.0'
modules: 'qtcharts'
install-deps: false
arch: win64_msvc2019_64

Expand Down
107 changes: 107 additions & 0 deletions .github/workflows/wasm-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: WASM / Qt 6.5.0
on:
push:
branches:
- '*'

jobs:
buildUbuntuXenial:
runs-on: ubuntu-20.04
env:
CC: emcc
CXX: em++

strategy:
matrix:
build-type: [Release]

steps:

- name: Job info
run: |
echo "GitHub Ref: ${{ github.ref }}"
echo "Event: ${{ github.event }}"
- name: get container ready for build
run: |
sudo apt-get update
sudo apt-get upgrade -y
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y -q --force-yes \
automake cmake git wget libfuse2 desktop-file-utils tree \
build-essential libgl1-mesa-dev libxkbcommon-x11-0 libpulse-dev \
libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 \
libxcb-xinerama0 libxcb-composite0 libxcb-cursor0 libxcb-damage0 \
libxcb-dpms0 libxcb-dri2-0 libxcb-dri3-0 libxcb-ewmh2 libxcb-glx0 \
libxcb-present0 libxcb-randr0 libxcb-record0 libxcb-render0 libxcb-res0 \
libxcb-screensaver0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-util1 libegl1 libegl1-mesa-dev
- name: checkout sources
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0

- name: Install Qt (Host)
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
py7zrversion: '>=0.20.2'
version: '6.5.0'
host: 'linux'
target: 'desktop'
arch: 'gcc_64'
cache: 'true'
cache-key-prefix: 'install-qt-host-6.5.0'
modules: 'qtcharts'

- name: Install Qt (Emscripten)
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
py7zrversion: '>=0.20.2'
version: '6.5.0'
host: 'linux'
target: 'desktop'
arch: 'wasm_multithread'
modules: 'qtcharts'
cache: 'true'
cache-key-prefix: 'install-qt-emscripten-6.5.0'

- name: install Emscripten
run: |
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest 3.1.25
./emsdk activate 3.1.25
- name: build Ripes
run: |
echo "building desktop"
source emsdk/emsdk_env.sh
export QT_HOST_PATH=$(pwd)/../Qt/6.5.0/gcc_64/
find ${QT_HOST_PATH}
cmake \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DRIPES_WITH_QPROCESS=OFF \
-DEMSCRIPTEN=1 \
-DQT_HOST_PATH="${QT_HOST_PATH}" \
-DCMAKE_TOOLCHAIN_FILE=$(pwd)/../Qt/6.5.0/wasm_multithread/lib/cmake/Qt6/qt.toolchain.cmake \
-DCMAKE_PREFIX_PATH=$(pwd)/../Qt/6.5.0/wasm_multithread/ \
-DEMSCRIPTEN_FORCE_COMPILERS=ON \
.
make -j $(nproc)
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.build-type }}_wasm
path: |
Ripes.wasm
Ripes.js
Ripes.worker.js
qtloader.js
# Dispatch the publish.yml workflow over at mortbopet.github.io
- run: |
gh workflow run publish.yml -R mortbopet/mortbopet.github.io --ref master
env:
GH_TOKEN: ${{ secrets.MORTBOPET_GITHUB_IO_TOKEN }}
25 changes: 10 additions & 15 deletions .github/workflows/windows-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Windows / Qt 5.15
name: Windows / Qt 6.5.0
on:
workflow_run:
workflows: ["Release setup"]
Expand All @@ -17,21 +17,16 @@ jobs:
uses: ilammy/msvc-dev-cmd@v1
- uses: seanmiddleditch/gha-setup-ninja@master

- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
path: ../Qt
key: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}

- name: install Qt
uses: jurplel/install-qt-action@v2
with:
version: '5.15.2'
modules: 'qtcharts qtsvg'
install-deps: false
arch: win64_msvc2019_64
cached: ${{ steps.cache-qt.outputs.cache-hit }}
aqtversion: '==3.1.*'
py7zrversion: '>=0.20.2'
version: '6.5.0'
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'
modules: 'qtcharts'

- name: checkout sources
uses: actions/checkout@v2
Expand Down
42 changes: 28 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.13)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

message(status "QT_HOST_PATH = ${QT_HOST_PATH}")


find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
Expand Down Expand Up @@ -42,24 +46,27 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

set(RIPES_WITH_QPROCESS ON CACHE BOOL "Build with QProcess-related utilities")
# Add as a C++ definition
if(RIPES_WITH_QPROCESS)
add_definitions(-DRIPES_WITH_QPROCESS)
endif()

# Find required Qt packages
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets CONFIG REQUIRED)
find_package(Qt5Svg REQUIRED)
find_package(Qt5Charts CONFIG REQUIRED)
find_package(Qt6 COMPONENTS Core Widgets Svg Charts REQUIRED)

# Finding Qt includes
include_directories(${Qt5Widgets_INCLUDE_DIRS})
include_directories(${Qt5Core_INCLUDE_DIRS})
include_directories(${Qt5Charts_INCLUDE_DIRS})
include_directories(${Qt6Widgets_INCLUDE_DIRS})
include_directories(${Qt6Core_INCLUDE_DIRS})
include_directories(${Qt6Charts_INCLUDE_DIRS})

######################################################################
## Resources setup
######################################################################
qt5_add_resources(ICONS_SRC ${CMAKE_SOURCE_DIR}/resources/icons/icons.qrc)
qt5_add_resources(EXAMPLES_SRC ${CMAKE_SOURCE_DIR}/examples/examples.qrc)
qt5_add_resources(LAYOUTS_SRC ${CMAKE_SOURCE_DIR}/src/processors/layouts.qrc)
qt5_add_resources(FONTS_SRC ${CMAKE_SOURCE_DIR}/resources/fonts/fonts.qrc)
qt6_add_resources(ICONS_SRC ${CMAKE_SOURCE_DIR}/resources/icons/icons.qrc)
qt6_add_resources(EXAMPLES_SRC ${CMAKE_SOURCE_DIR}/examples/examples.qrc)
qt6_add_resources(LAYOUTS_SRC ${CMAKE_SOURCE_DIR}/src/processors/layouts.qrc)
qt6_add_resources(FONTS_SRC ${CMAKE_SOURCE_DIR}/resources/fonts/fonts.qrc)

######################################################################
## Library setup
Expand Down Expand Up @@ -109,12 +116,19 @@ if(RIPES_BUILD_TESTS)
endif()

set(APP_NAME Ripes)
add_executable(${APP_NAME} ${SYSTEM_FLAGS} ${ICONS_SRC} ${EXAMPLES_SRC} ${LAYOUTS_SRC} ${FONTS_SRC} main.cpp)
qt_add_executable(${APP_NAME} ${SYSTEM_FLAGS} ${ICONS_SRC} ${EXAMPLES_SRC} ${LAYOUTS_SRC} ${FONTS_SRC} main.cpp)

# Link Qt libraries
target_link_libraries(${APP_NAME} Qt5::Core Qt5::Widgets)
target_link_libraries(${APP_NAME} PUBLIC Qt6::Core Qt6::Widgets)
# Link Ripes library
target_link_libraries(${APP_NAME} ${RIPES_LIB})
target_link_libraries(${APP_NAME} PUBLIC ${RIPES_LIB})

if(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
# https://doc.qt.io/qt-6/wasm.html#asyncify
target_link_options(${RIPES_LIB} PUBLIC -sASYNCIFY -Os)
target_link_options(${APP_NAME} PUBLIC -sASYNCIFY -Os)
endif()


if(UNIX AND NOT APPLE) #Define the LINUX variable before testing it
set(LINUX TRUE)
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Ripes
[![Windows / Qt 5.15](https://github.com/mortbopet/Ripes/actions/workflows/windows-release.yml/badge.svg)](https://github.com/mortbopet/Ripes/actions/workflows/windows-release.yml)
[![Mac release / Qt 5.15](https://github.com/mortbopet/Ripes/actions/workflows/mac-release.yml/badge.svg)](https://github.com/mortbopet/Ripes/actions/workflows/mac-release.yml)
[![Ubuntu release 16.04 / Qt 5.15](https://github.com/mortbopet/Ripes/actions/workflows/linux-release.yml/badge.svg)](https://github.com/mortbopet/Ripes/actions/workflows/linux-release.yml)
[![Windows / Qt 6.5.0](https://github.com/mortbopet/Ripes/actions/workflows/windows-release.yml/badge.svg)](https://github.com/mortbopet/Ripes/actions/workflows/windows-release.yml)
[![Mac release / Qt 6.5.0](https://github.com/mortbopet/Ripes/actions/workflows/mac-release.yml/badge.svg)](https://github.com/mortbopet/Ripes/actions/workflows/mac-release.yml)
[![Ubuntu release 16.04 / Qt 6.5.0](https://github.com/mortbopet/Ripes/actions/workflows/linux-release.yml/badge.svg)](https://github.com/mortbopet/Ripes/actions/workflows/linux-release.yml)
[![Ripes CI tests](https://github.com/mortbopet/Ripes/actions/workflows/test.yml/badge.svg)](https://github.com/mortbopet/Ripes/actions/workflows/test.yml)
[![Gitter](https://badges.gitter.im/Ripes-VSRTL/Ripes.svg)](https://gitter.im/Ripes-VSRTL/)

Expand Down Expand Up @@ -40,8 +40,9 @@ For Windows, the C++ runtime library must be available (if not, a msvcp140.dll e

## Building
Initially, the following dependencies must be made available:
- A recent (>=5.15) version of [Qt](https://www.qt.io/download) + Qt Charts (**not** bundled with Qt by default, but can be selected during Qt installation)
- A recent (>=6.5.0) version of [Qt](https://www.qt.io/download) + Qt Charts (**not** bundled with Qt by default, but can be selected during Qt installation)
- [CMake](https://cmake.org/)
- `sudo apt-get install libegl1-mesa-dev`

Then, Ripes can be checked out and built as a standard CMake project:
```
Expand Down
Loading

0 comments on commit 057adf5

Please sign in to comment.