Skip to content

Commit

Permalink
Fix webengine deployment for appimage and Windows build
Browse files Browse the repository at this point in the history
Closes #489
  • Loading branch information
streetpea committed Dec 1, 2024
1 parent ae5ec34 commit d393574
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 15 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build-appimage-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ jobs:
- name: Add QmlWebEngine Import
working-directory: chiaki-ng
run: |
echo "import QtWebEngine; WebEngineView {}" > "$PWD/gui/src/qml/qtwebengine_import.qml"
cp scripts/qtwebengine_import.qml /gui/src/qml/
- name: Run build script
working-directory: chiaki-ng/scripts
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-macos-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Deploy chiaki-ng
run: |
cp -a build/gui/chiaki.app chiaki-ng.app
echo "import QtWebEngine; WebEngineView {}" > "$PWD/gui/src/qml/qtwebengine_import.qml"
cp scripts/qtwebengine_import.qml gui/src/qml/
$(brew --prefix)/opt/qt@6/bin/macdeployqt chiaki-ng.app -qmldir="$PWD/gui/src/qml" -libpath=$(brew --prefix)/lib
mkdir -p chiaki-ng.app/Contents/Resources/vulkan/icd.d
wget https://github.com/KhronosGroup/MoltenVK/releases/download/v1.2.9/MoltenVK-macos.tar && tar xf MoltenVK-macos.tar
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-macos-x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Deploy chiaki-ng
run: |
cp -a build/gui/chiaki.app chiaki-ng.app
echo "import QtWebEngine; WebEngineView {}" > "$PWD/gui/src/qml/qtwebengine_import.qml"
cp scripts/qtwebengine_import.qml gui/src/qml/
$(brew --prefix)/opt/qt@6/bin/macdeployqt chiaki-ng.app -qmldir="$PWD/gui/src/qml" -libpath=$(brew --prefix)/lib
mkdir -p chiaki-ng.app/Contents/Resources/vulkan/icd.d
wget https://github.com/KhronosGroup/MoltenVK/releases/download/v1.2.9/MoltenVK-macos.tar && tar xf MoltenVK-macos.tar
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Deploy chiaki-ng
run: |
cp -a build/gui/chiaki.app chiaki-ng.app
echo "import QtWebEngine; WebEngineView {}" > "$PWD/gui/src/qml/qtwebengine_import.qml"
cp scripts/qtwebengine_import.qml gui/src/qml/
$(brew --prefix)/opt/qt@6/bin/macdeployqt chiaki-ng.app -qmldir="$PWD/gui/src/qml" -libpath=$(brew --prefix)/lib
mkdir -p chiaki-ng.app/Contents/Resources/vulkan/icd.d
wget https://github.com/KhronosGroup/MoltenVK/releases/download/v1.2.9/MoltenVK-macos.tar && tar xf MoltenVK-macos.tar
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-msys2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ jobs:
cp /mingw64/bin/libpsl-*.dll chiaki-ng-Win/
cp /mingw64/bin/libjson-c-*.dll chiaki-ng-Win/
cp /mingw64/bin/swresample-*.dll chiaki-ng-Win/
echo "import QtWebEngine; WebEngineView {}" > "$PWD/gui/src/qml/qtwebengine_import.qml"
cp scripts/qtwebengine_import.qml gui/src/qml/
/mingw64/bin/windeployqt6.exe --no-translations --qmldir=$PWD/gui/src/qml --release chiaki-ng-Win/chiaki.exe
cp -R /mingw64/share/qt6/qml/QtQuick chiaki-ng-Win/qml/
cp -R /mingw64/share/qt6/qml/QtQml/WorkerScript/ chiaki-ng-Win/qml/QtQml/
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build-weekly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
version: "6.7.*"
host: 'windows'
target: 'desktop'
modules: 'qtwebengine qtpositioning qtwebchannel qtwebsockets'
modules: 'qtwebengine qtpositioning qtwebchannel qtwebsockets qtserialport'

- name: Setup ffmpeg
run: |
Expand Down Expand Up @@ -174,6 +174,7 @@ jobs:
run: |
mkdir chiaki-ng-Win
cp build\gui\chiaki.exe chiaki-ng-Win
cp scripts\qtwebengine_import.qml gui\src\qml\
cp "${{ github.workspace }}\vcpkg_installed\${{ env.triplet }}\bin\libcrypto-*-x64.dll" chiaki-ng-Win
cp "${{ github.workspace }}\vcpkg_installed\${{ env.triplet }}\bin\libssl-*-x64.dll" chiaki-ng-Win
cp "${{ github.workspace }}\vcpkg_installed\${{ env.triplet }}\bin\SDL2.dll" chiaki-ng-Win
Expand All @@ -191,8 +192,7 @@ jobs:
cp "${{ github.workspace }}\${{ env.dep_folder }}\bin\libplacebo-*.dll" chiaki-ng-Win
cp "${{ github.workspace }}\${{ env.dep_folder }}\bin\shaderc_shared.dll" chiaki-ng-Win
cp "${{ github.workspace }}\${{ env.dep_folder }}\bin\spirv-cross-c-shared.dll" chiaki-ng-Win
echo "import QtWebEngine; WebEngineView {}" > "$PWD/gui/src/qml/qtwebengine_import.qml"
windeployqt.exe --no-translations --qmldir=gui/src/qml/ chiaki-ng-Win\chiaki.exe
windeployqt.exe --no-translations --qmldir=gui\src\qml --release chiaki-ng-Win\chiaki.exe
- name: Compile .ISS to .EXE Installer
uses: Minionguyjpro/[email protected]
Expand Down Expand Up @@ -245,7 +245,7 @@ jobs:
- name: Deploy chiaki-ng
run: |
cp -a build/gui/chiaki.app chiaki-ng.app
echo "import QtWebEngine; WebEngineView {}" > "$PWD/gui/src/qml/qtwebengine_import.qml"
cp scripts/qtwebengine_import.qml gui/src/qml/
$(brew --prefix)/opt/qt@6/bin/macdeployqt chiaki-ng.app -qmldir="$PWD/gui/src/qml" -libpath=$(brew --prefix)/lib
mkdir -p chiaki-ng.app/Contents/Resources/vulkan/icd.d
wget https://github.com/KhronosGroup/MoltenVK/releases/download/v1.2.9/MoltenVK-macos.tar && tar xf MoltenVK-macos.tar
Expand Down Expand Up @@ -289,7 +289,7 @@ jobs:
- name: Add QmlWebEngine Import
working-directory: chiaki-ng
run: |
echo "import QtWebEngine; WebEngineView {}" > "$PWD/gui/src/qml/qtwebengine_import.qml"
cp scripts/qtwebengine_import.qml gui/src/qml/
- name: Run build script
working-directory: chiaki-ng/scripts
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
version: "6.7.*"
host: 'windows'
target: 'desktop'
modules: 'qtwebengine qtpositioning qtwebchannel qtwebsockets'
modules: 'qtwebengine qtpositioning qtwebchannel qtwebsockets qtserialport'

- name: Setup ffmpeg
run: |
Expand Down Expand Up @@ -153,6 +153,7 @@ jobs:
run: |
mkdir chiaki-ng-Win
cp build\gui\chiaki.exe chiaki-ng-Win
cp scripts\qtwebengine_import.qml gui\src\qml\
cp "${{ github.workspace }}\vcpkg_installed\${{ env.triplet }}\bin\libcrypto-*-x64.dll" chiaki-ng-Win
cp "${{ github.workspace }}\vcpkg_installed\${{ env.triplet }}\bin\libssl-*-x64.dll" chiaki-ng-Win
cp "${{ github.workspace }}\vcpkg_installed\${{ env.triplet }}\bin\SDL2.dll" chiaki-ng-Win
Expand All @@ -170,8 +171,7 @@ jobs:
cp "${{ github.workspace }}\${{ env.dep_folder }}\bin\libplacebo-*.dll" chiaki-ng-Win
cp "${{ github.workspace }}\${{ env.dep_folder }}\bin\shaderc_shared.dll" chiaki-ng-Win
cp "${{ github.workspace }}\${{ env.dep_folder }}\bin\spirv-cross-c-shared.dll" chiaki-ng-Win
echo "import QtWebEngine; WebEngineView {}" > "$PWD/gui/src/qml/qtwebengine_import.qml"
windeployqt.exe --no-translations --qmldir=gui/src/qml/ chiaki-ng-Win\chiaki.exe
windeployqt.exe --no-translations --qmldir=gui\src\qml --release chiaki-ng-Win\chiaki.exe
- name: Compile .ISS to .EXE Installer
uses: Minionguyjpro/[email protected]
Expand Down
5 changes: 5 additions & 0 deletions gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ if(APPLE)
endif()

find_package(Qt6 REQUIRED COMPONENTS Core Gui Concurrent Svg Qml Quick)
find_package(Qt6 COMPONENTS WebEngineQuick)
find_package(Qt6 COMPONENTS DBus)

if(WIN32)
Expand Down Expand Up @@ -97,6 +98,10 @@ if (${Qt6DBus_FOUND} AND NOT WIN32)
target_link_libraries(chiaki Qt::DBus)
target_compile_definitions(chiaki PRIVATE CHIAKI_HAVE_DBUS)
endif()
if (${Qt6WebEngineQuick_FOUND})
target_link_libraries(chiaki Qt::WebEngineQuick)
target_compile_definitions(chiaki PRIVATE CHIAKI_HAVE_WEBENGINE)
endif()
target_link_libraries(chiaki SDL2::SDL2)
if(CHIAKI_ENABLE_SPEEX)
target_link_libraries(chiaki PkgConfig::SpeexDSP)
Expand Down
7 changes: 7 additions & 0 deletions gui/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ int main(int argc, char *argv[]) { return real_main(argc, argv); }
#include <stdio.h>
#include <string.h>

#ifdef CHIAKI_HAVE_WEBENGINE
#include <QtWebEngineQuick>
#endif

#include <QCommandLineParser>
#include <QMap>
#include <QSurfaceFormat>
Expand Down Expand Up @@ -98,6 +102,9 @@ int real_main(int argc, char *argv[])
}

QGuiApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
#ifdef CHIAKI_HAVE_WEBENGINE
QtWebEngineQuick::initialize();
#endif
QGuiApplication app(argc, argv);

#ifdef Q_OS_MACOS
Expand Down
7 changes: 6 additions & 1 deletion scripts/Dockerfile.qt6
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ RUN sudo apt-get -y install \
libgl1-mesa-dev \
nasm \
libudev-dev \
librsvg2-dev \
gobject-introspection \
libva-dev \
fuse \
appstream \
Expand All @@ -38,7 +40,10 @@ RUN sudo apt-get -y install \
RUN sudo pip3 install protobuf==3.19.5
RUN sudo pip3 install meson==1.3.0
RUN sudo pip3 install aqtinstall==3.1.18
RUN sudo aqt install-qt -O ${QT_PATH} linux desktop ${QT_VERSION} linux_gcc_64 -m qtwebengine qtpositioning qtwebchannel qtwebsockets
RUN sudo aqt install-qt -O ${QT_PATH} linux desktop ${QT_VERSION} linux_gcc_64 -m qtwebengine qtpositioning qtwebchannel qtwebsockets qtserialport
RUN curl -LO https://raw.githubusercontent.com/state-of-the-art/qt6-docker/refs/heads/master/6.7-gcc-aqt/install_packages.sh
RUN chmod +x install_packages.sh
RUN sudo "${PWD}/install_packages.sh"
RUN (curl -L https://apt.kitware.com/kitware-archive.sh | sudo bash) && sudo apt-get -y install cmake

RUN wget https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.3.287.tar.gz && \
Expand Down
1 change: 1 addition & 0 deletions scripts/qtwebengine_import.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import QtWebEngine; WebEngineView {}

0 comments on commit d393574

Please sign in to comment.