Skip to content

Commit

Permalink
Wasm with qt6.2 (#2308)
Browse files Browse the repository at this point in the history
  • Loading branch information
bakulf authored Nov 18, 2021
1 parent 4634825 commit bc988a8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 32 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/wasm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ jobs:
shell: bash
run: |
python3 -m pip install aqtinstall
python3 -m aqt install --outputdir /opt 5.15.0 linux desktop wasm_32 -m qtcharts
# qt6.2.1 for wasm needs the desktop linux installation
python3 -m aqt install --outputdir /opt 6.2.1 linux desktop -m qtcharts qtwebsockets
python3 -m aqt install --outputdir /opt 6.2.1 linux desktop wasm_32 -m qtcharts qtwebsockets
- name: Patching Qt
shell: bash
run: |
# see: https://wiki.qt.io/Qt_6.2_Known_Issues#WebAssembly
sed '/sse/,+5 d' /opt/6.2.1/wasm_32/mkspecs/features/wasm/wasm.prf > /tmp/wasm.prf
mv /tmp/wasm.prf /opt/6.2.1/wasm_32/mkspecs/features/wasm/wasm.prf
- name: Install python dependencies
shell: bash
Expand All @@ -44,7 +53,8 @@ jobs:
- name: Compiling
shell: bash
run: |
./scripts/wasm_compile.sh /opt/5.15.0/wasm_32/bin
export PATH=/opt/6.2.1/wasm_32/bin:/opt/6.2.1/gcc_64/bin:$PATH
./scripts/wasm_compile.sh
- name: Uploading
uses: actions/upload-artifact@v1
Expand Down
32 changes: 2 additions & 30 deletions scripts/wasm_compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ if [ -f .env ]; then
. .env
fi

WASM_QT_PATH=

helpFunction() {
print G "Usage:"
print N "\t$0 <qt/wasm/path>"
Expand All @@ -22,25 +20,6 @@ helpFunction() {
print N "This script compiles MozillaVPN for WebAssembly"
print N ""

while [[ $# -gt 0 ]]; do
key="$1"

case $key in
*)
if [[ "$WASM_QT_PATH" ]]; then
helpFunction
fi

WASM_QT_PATH=$1
shift
;;
esac
done

if ! [ -d "$WASM_QT_PATH" ]; then
helpFunction
fi

if ! [ -d "src" ] || ! [ -d "wasm" ]; then
die "This script must be executed at the root of the repository."
fi
Expand All @@ -50,19 +29,12 @@ SHORTVERSION=$(cat version.pri | grep VERSION | grep defined | cut -d= -f2 | tr
FULLVERSION=$(echo $SHORTVERSION | cut -d. -f1).$(date +"%Y%m%d%H%M")
print G "$SHORTVERSION - $FULLVERSION"

QMAKE=$WASM_QT_PATH/qmake
[ -f "$QMAKE" ] || die "Unable to find qmake at the path $QMAKE"

printn Y "Setting PATH var... "
export PATH=$PATH:$WASM_QT_PATH
print G "done."

printn Y "Checking emscripten... "
em++ --version &>/dev/null || die "em++ not found. Have you forgotten to load emsdk_env.sh?"
em++ --version 2>&1 | grep 1.39.8 &>/dev/null || die "em++ doesn't match the required version: 1.39.8"
print G "done."

$QMAKE -v &>/dev/null || die "qmake doesn't exist or it fails"
qmake -v &>/dev/null || die "qmake doesn't exist or it fails"

print Y "Importing translation files..."
git submodule update --remote --depth 1 i18n || die "Failed to fetch newest translation files"
Expand All @@ -72,7 +44,7 @@ print Y "Generating glean samples..."
python3 scripts/generate_glean.py || die "Failed to generate glean samples"

print Y "Configuring the project via qmake..."
$QMAKE CONFIG-=debug CONFIG-=debug_and_release CONFIG+=release BUILD_ID=$FULLVERSION || die "Compilation failed"
qmake CONFIG-=debug CONFIG-=debug_and_release CONFIG+=release BUILD_ID=$FULLVERSION || die "Compilation failed"

print Y "Compiling..."
make -j8 || die "Compilation failed"
Expand Down

0 comments on commit bc988a8

Please sign in to comment.