Skip to content

Commit

Permalink
Produce a minimal Qt application.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgiven committed Jan 7, 2024
1 parent 75446de commit 8abe02a
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
path: 'fluxengine-testdata'
- name: apt
run: |
sudo apt install libudev-dev libsqlite3-dev protobuf-compiler libwxgtk3.0-gtk3-dev libfmt-dev libprotobuf-dev wx-common
sudo apt install libudev-dev libsqlite3-dev protobuf-compiler libwxgtk3.0-gtk3-dev libfmt-dev libprotobuf-dev wx-common libqtbase5-dev
- name: make
run: CXXFLAGS="-Wp,-D_GLIBCXX_ASSERTIONS" make -j`nproc` -C fluxengine

Expand Down
1 change: 1 addition & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@
items={
"fluxengine$(EXT)": "src+fluxengine",
"fluxengine-gui$(EXT)": "src/gui",
"fluxengine-gui2$(EXT)": "src/gui2",
"brother120tool$(EXT)": "tools+brother120tool",
"brother240tool$(EXT)": "tools+brother240tool",
"upgrade-flux-file$(EXT)": "tools+upgrade-flux-file",
Expand Down
72 changes: 72 additions & 0 deletions src/gui2/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
from build.ab import emit, normalrule
from build.c import cxxprogram
from build.pkg import package
import config

package(name="Qt5Widgets", package="Qt5Widgets")

cxxprogram(
name="gui2",
srcs=[
"./main.cc",
],
cflags=["$(WX_CFLAGS)", "-fPIC"],
ldflags=["$(WX_LDFLAGS)"],
deps=[
"+fl2_proto_lib",
"+protocol",
"dep/adflib",
"dep/fatfs",
"dep/hfsutils",
"dep/libusbp",
"extras+icons",
"+lib",
"lib+config_proto_lib",
"src/formats",
"src/gui/drivetypes",
"+z_lib",
"+fmt_lib",
"+protobuf_lib",
".+Qt5Widgets",
],
)

if config.osx:
normalrule(
name="fluxengine_pkg",
ins=[".+fluxengine_app"],
outs=["FluxEngine.pkg"],
commands=[
"pkgbuild --quiet --install-location /Applications --component {ins[0]} {outs[0]}"
],
label="PKGBUILD",
)

normalrule(
name="fluxengine_app",
ins=[
".+gui",
"extras+fluxengine_icns",
"extras/FluxEngine.app.template/",
],
outs=["FluxEngine.app"],
commands=[
"rm -rf {outs[0]}",
"cp -a {ins[2]} {outs[0]}",
"touch {outs[0]}",
"cp {ins[0]} {outs[0]}/Contents/MacOS/fluxengine-gui",
"mkdir -p {outs[0]}/Contents/Resources",
"cp {ins[1]} {outs[0]}/Contents/Resources/FluxEngine.icns",
"dylibbundler -of -x {outs[0]}/Contents/MacOS/fluxengine-gui -b -d {outs[0]}/Contents/libs -cd > /dev/null",
"cp $$(brew --prefix wxwidgets)/README.md $@/Contents/libs/wxWidgets.md",
"cp $$(brew --prefix protobuf)/LICENSE $@/Contents/libs/protobuf.txt",
"cp $$(brew --prefix fmt)/LICENSE.rst $@/Contents/libs/fmt.rst",
"cp $$(brew --prefix libpng)/LICENSE $@/Contents/libs/libpng.txt",
"cp $$(brew --prefix libjpeg)/README $@/Contents/libs/libjpeg.txt",
"cp $$(brew --prefix abseil)/LICENSE $@/Contents/libs/abseil.txt",
"cp $$(brew --prefix libtiff)/LICENSE.md $@/Contents/libs/libtiff.txt",
"cp $$(brew --prefix zstd)/LICENSE $@/Contents/libs/zstd.txt",
],
label="MKAPP",
)

12 changes: 12 additions & 0 deletions src/gui2/main.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <QApplication>
#include <QPushButton>

int main(int argc, char **argv)
{
QApplication app (argc, argv);

QPushButton button ("Hello world !");
button.show();

return app.exec();
}

0 comments on commit 8abe02a

Please sign in to comment.