Skip to content

Commit

Permalink
Merge pull request #131 from mappu/miqt-mingw-qt6-docker
Browse files Browse the repository at this point in the history
Add mingw-w64-x86_64 Qt 6 docker container, test in CI
  • Loading branch information
mappu authored Jan 11, 2025
2 parents 33596d9 + 408e6f5 commit 3d864cd
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 11 deletions.
42 changes: 40 additions & 2 deletions .github/workflows/miqt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,25 @@ jobs:
- name: Linux64 bindings compile
run: docker run -v ~/.cache/go-build:/root/.cache/go-build -v $PWD:/src -w /src miqt/linux64:qt68 /bin/bash -c 'cd qt6 && go build'

miqt_win32_qt5:
runs-on: ubuntu-24.04

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Cache GOCACHE
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: win32-gocache

- name: Win32 docker build
run: docker build -t miqt/win32:qt5 -f docker/win32-cross-go1.23-qt5.15-static.Dockerfile .

- name: Win32 bindings compile
run: docker run -v ~/.cache/go-build:/root/.cache/go-build -v $PWD:/src -w /src miqt/win32:qt5 /bin/bash -c 'cd qt && go build'

miqt_win64_qt5:
runs-on: ubuntu-24.04

Expand All @@ -100,7 +119,26 @@ jobs:
key: win64-gocache

- name: Win64 docker build
run: docker build -t miqt/win64:latest -f docker/win64-cross-go1.23-qt5.15-static.Dockerfile .
run: docker build -t miqt/win64:qt5 -f docker/win64-cross-go1.23-qt5.15-static.Dockerfile .

- name: Win64 bindings compile
run: docker run -v ~/.cache/go-build:/root/.cache/go-build -v $PWD:/src -w /src miqt/win64:qt5 /bin/bash -c 'cd qt && go build'

miqt_win64_qt68:
runs-on: ubuntu-24.04

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Cache GOCACHE
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: win64-gocache

- name: Win64 docker build
run: docker build -t miqt/win64:qt68 -f docker/win64-cross-go1.23-qt6.8-dynamic.Dockerfile .

- name: Win64 bindings compile
run: docker run -v ~/.cache/go-build:/root/.cache/go-build -v $PWD:/src -w /src miqt/win64:latest /bin/bash -c 'cd qt && go build'
run: docker run -v ~/.cache/go-build:/root/.cache/go-build -v $PWD:/src -w /src miqt/win64:qt68 /bin/bash -c 'cd qt6 && go build'
8 changes: 8 additions & 0 deletions cmd/genbindings/config-allowlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,14 @@ func AllowMethod(className string, mm CppMethod) error {
return ErrTooComplex
}

if className == "QHashSeed" && mm.MethodName == "operator unsigned long" {
// Not present in Qt 5, is present in Qt 6.4 and 6.8, but in the C++
// header file it is written as `operator size_t()`
// Clang is early-converting size_t to unsigned long, which is invalid for mingw-w64-x86_64 platforms
// A proper fix here would be to avoid evaluating typedefs
return ErrTooComplex
}

return nil // OK, allow
}

Expand Down
13 changes: 13 additions & 0 deletions docker/win64-cross-go1.23-qt6.8-dynamic.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM fedora:41

RUN dnf -y --setopt=install_weak_deps=False install \
mingw64-qt6-qtbase.x86_64 \
mingw64-gcc.x86_64 \
mingw64-gcc-c++.x86_64 \
golang.x86_64

ENV CC=x86_64-w64-mingw32-gcc
ENV CXX=x86_64-w64-mingw32-g++
ENV PKG_CONFIG_PATH=/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig/
ENV GOOS=windows
ENV CGO_ENABLED=1
4 changes: 0 additions & 4 deletions qt6/gen_qhashfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ QHashSeed* QHashSeed_new2(size_t d) {
return new QHashSeed(static_cast<size_t>(d));
}

size_t QHashSeed_ToUnsignedLong(const QHashSeed* self) {
return self->operator unsigned long();
}

QHashSeed* QHashSeed_GlobalSeed() {
return new QHashSeed(QHashSeed::globalSeed());
}
Expand Down
4 changes: 0 additions & 4 deletions qt6/gen_qhashfunctions.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ func NewQHashSeed2(d uint64) *QHashSeed {
return ret
}

func (this *QHashSeed) ToUnsignedLong() uint64 {
return (uint64)(C.QHashSeed_ToUnsignedLong(this.h))
}

func QHashSeed_GlobalSeed() *QHashSeed {
_goptr := newQHashSeed(C.QHashSeed_GlobalSeed())
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
Expand Down
1 change: 0 additions & 1 deletion qt6/gen_qhashfunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ typedef struct QHashSeed QHashSeed;

QHashSeed* QHashSeed_new();
QHashSeed* QHashSeed_new2(size_t d);
size_t QHashSeed_ToUnsignedLong(const QHashSeed* self);
QHashSeed* QHashSeed_GlobalSeed();
void QHashSeed_SetDeterministicGlobalSeed();
void QHashSeed_ResetRandomGlobalSeed();
Expand Down

0 comments on commit 3d864cd

Please sign in to comment.