Skip to content

Commit

Permalink
Merge pull request #241 from kovzol/master
Browse files Browse the repository at this point in the history
Minor fixes to fine tune 4.3 builds
  • Loading branch information
kovzol authored Oct 6, 2023
2 parents 24330cb + 8df8e48 commit c054ae9
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 7 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,18 @@ jobs:
run: qmake
- name: make
run: make

# This requires too much disk space (more than 40 GB), so it is disabled for now:

# wasm:
#
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v1
# - name: prerequisites
# run: sudo apt update && sudo apt install build-essential libclang-13-dev cmake ninja-build libgl-dev libegl-dev libfontconfig-dev
# - name: compile-qt-web
# run: cd tools && ./compile-qt-web
# - name: compile-xaos-web
# run: cd tools && ./compile-xaos-web
2 changes: 1 addition & 1 deletion XaoS.pro
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ wasm{
executable.files = bin/xaos
executable.path = $$PREFIX/bin
examples.path = $$PREFIX/share/XaoS/examples
examples.extra = find examples -name \'*.xpf\' -exec cp {} $$PREFIX/share/XaoS/examples \;
examples.extra = find examples -name \'*.xpf\' -exec cp {} $(INSTALL_ROOT)$$PREFIX/share/XaoS/examples \;
catalogs.files = catalogs/*.cat
catalogs.path = $$PREFIX/share/XaoS/catalogs
tutorial.files = tutorial/*.x?f
Expand Down
10 changes: 7 additions & 3 deletions src/util/xstdio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,14 @@ xio_file xio_getrandomexample(xio_path name)
};

// Select a random sub dir and then random example to fix load random example issue

// if ../examples exists, add its subdirectories to example_path_taken, otherwise do nothing:
QStringList sub_names = get_immediate_subdirectory_names(".." XIO_PATHSEPSTR "examples");
int randomIndex = QRandomGenerator::global()->bounded(sub_names.length());
QString randomElement = sub_names.at(randomIndex);
example_paths_taken.append(".." XIO_PATHSEPSTR "examples/"+randomElement);
if (sub_names.length() > 0) {
int randomIndex = QRandomGenerator::global()->bounded(sub_names.length());
QString randomElement = sub_names.at(randomIndex);
example_paths_taken.append(".." XIO_PATHSEPSTR "examples/"+randomElement);
}
char *paths[example_paths_taken.size()];
convertQStringListToArray(example_paths_taken, paths);

Expand Down
10 changes: 10 additions & 0 deletions tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,21 @@ Before running the script `deploy-win.bat` from command line you need to
add the path of tools `windeployqt.exe` and `binarycreator.exe` to the
environmental system variable PATH.

Important: `windeployqt.exe` will use the first C++ compiler from the path.
To avoid getting the wrong DLLs (because of availability of multiple compilers
on your system) make sure that the used compiler is found as first one.
If you use the wrong DLLs, XaoS will not start.

See also https://stackoverflow.com/questions/43397609/qt-deployment-for-windows-copies-incorrect-dll-for-mingw

To avoid problems with finding certain files, you should make sure that
there is no special character in the full path of the `XaoS` folder.
Otherwise some files may be missing from the installation bundle (for
example, the .cat files).

To create the .zip file, simply copy the bin folder in it and also the
folders catalog/, examples/ and tutorial/.

MacOS
-----

Expand Down
46 changes: 46 additions & 0 deletions tools/compile-qt-web
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

# This script compiles Qt6 to be able to build XaoS for WebAssembly.
# Make sure that you have enough disk space. At least 45 GB is recommended.

# See also https://doc.qt.io/qt-6.5/wasm.html and https://wiki.qt.io/Building_Qt_6_from_Git.

QT6_VERSION=6.5.3
EMSDK_VERSION=3.1.25
PARALLEL=4

QT6_HOST_PATH=`pwd`/qt6-host-install

set -e

# Get emscripten:
test -x emsdk || git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
git pull
./emsdk install $EMSDK_VERSION
./emsdk activate --embedded $EMSDK_VERSION
cd ..

# Get Qt:
git clone git://code.qt.io/qt/qt5.git qt6
cd qt6
git switch $QT6_VERSION
perl init-repository

# Compile Qt for the Linux host
cd ..
mkdir qt6-host-build
cd qt6-host-build
../qt6/configure -prefix $QT6_HOST_PATH
cmake --build . --parallel $PARALLEL
cmake --install .

# Compile Qt for WebAssembly
cd ..
mkdir qt6-wasm-build
cd qt6-wasm-build
. ../emsdk/emsdk_env.sh
../qt6/configure -xplatform wasm-emscripten -nomake examples -prefix $PWD/qtbase \
-opensource -confirm-license -qt-host-path $QT6_HOST_PATH -device-option QT_EMSCRIPTEN_ASYNCIFY=1
cmake --build . --parallel $PARALLEL -t qtbase -t qtdeclarative -t qtimageformats -t qsvgicon -t qsvg
cd ..
16 changes: 16 additions & 0 deletions tools/compile-xaos-web
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# This script compiles XaoS for WebAssembly.

set -e

QT6_WASM_BUILD=`pwd`/qt6-wasm-build
test -x $QT6_WASM_BUILD || {
echo "Run compile-qt-web first."
exit 1
}

. emsdk/emsdk_env.sh
cd ..
$QT6_WASM_BUILD/qtbase/bin/qmake
make || true
6 changes: 3 additions & 3 deletions tools/create-deb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

# This script creates a .deb package of XaoS 4.0 and above.
# Make sure you build the program first ("qmake PREFIX=/usr && make -j4").
# This script creates a .deb package of XaoS 4.3 and above.
# Make sure you build the program first ("qmake6 PREFIX=/usr && make -j4").
# Required packages before running this script:
# lynx pandoc git-extras lintian

Expand Down Expand Up @@ -55,7 +55,7 @@ Upstream-Name: xaos
Source: https://github.com/xaos-project/XaoS
Files: *
Copyright: 2020 The XaoS Project
Copyright: 2023 The XaoS Project
License: GPL-1" > "$DOCDIR/copyright"

git-changelog -x > "$DOCDIR/changelog"
Expand Down

0 comments on commit c054ae9

Please sign in to comment.