rules_qt: Build Qt applications in Bazel

580 views
Skip to first unread message

Xavier Bonaventura

unread,
Dec 22, 2020, 2:52:24 PM12/22/20
to bazel-dev
Hi,

I just wanted to start this thread to talk about Bazel rules for Qt. Would someone be interested on contributing? There are several rules around and would be nice if we could unify some effort.
I would separate the goals in 2, focusing on the first one first:
- Be able to compile Qt applications with Bazel given a precompiled Qt
- Be able to compile Qt applications with Bazel building Qt from source

Bests,

Xavi

Tony Aiuto

unread,
Dec 23, 2020, 11:33:46 PM12/23/20
to Xavier Bonaventura, bazel-dev
Qt. Now that is something I have not done in a long time.

On Tue, Dec 22, 2020 at 2:52 PM Xavier Bonaventura <xavibon...@gmail.com> wrote:
Hi,

I just wanted to start this thread to talk about Bazel rules for Qt. Would someone be interested on contributing? There are several rules around and would be nice if we could unify some effort.
 
I would separate the goals in 2, focusing on the first one first:
- Be able to compile Qt applications with Bazel given a precompiled Qt

That would be a good first step. That would get the basics of a toolchain for moc (was that the name of their layout compiler?) and possibly auto-finding installed libraries.
 
- Be able to compile Qt applications with Bazel building Qt from source

IIRC, qmake was fairly simple. It may be reasonable to create a qmake to BUILD generator.

Good luck.


Bests,

Xavi

--
You received this message because you are subscribed to the Google Groups "bazel-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-dev/e17dc4ab-e2e9-4a1e-9ee9-2f010bcf187bn%40googlegroups.com.

Xavier Bonaventura

unread,
Dec 24, 2020, 4:58:28 AM12/24/20
to Tony Aiuto, bazel-dev
The autofinding would be a good idea, I did not consider that, I guess that I could take a look to see how the autofinding for toolchains works.

For the moment I found some rules already around, all of them being forks of https://github.com/bbreslauer/qt-bazel-example.
The one that to me looks more up to date is the one from https://github.com/justbuchanan/bazel_rules_qt. It already has some support for Linux and misses the Windows part.
I extended them to also support windows and for the tests that I have seems to work for Windows and Linux. They can be found here: https://github.com/limdor/bazel_rules_qt.
However my plan is to backport it to the repo from  justbuchanan and ideally have at some point one repo that could be taken as a reference.

For the moment they work with small projects, not sure what would happen with big and complex projects.

Missatge de Tony Aiuto <ai...@google.com> del dia dj., 24 de des. 2020 a les 5:33:

Tony Aiuto

unread,
Dec 27, 2020, 4:23:07 PM12/27/20
to Xavier Bonaventura, bazel-dev
The  community needs a good cookbook example of auto finding. I recently did a small case of it for rules_pkg. It just looks for a binary and crates a toolchain to use it. If I have some free tim maybe I can turn that into one.

Xavier Bonaventura

unread,
Dec 29, 2020, 3:28:29 PM12/29/20
to Tony Aiuto, bazel-dev
Is it already available the case that you did for rules_pkg? I could not find it.
I wanted to took a look the cc toolchain but it is in Java I guess and not as Starlark.
I would like to have separated the two parts, one the discovery of the tools, and the other the creation of the toolchain.
Not sure if in Qt is so needed but in C++ would be very useful. A lot of times I would like to be able to use the autodetected tools but in my own toolchain.

Missatge de Tony Aiuto <ai...@google.com> del dia dg., 27 de des. 2020 a les 22:23:

Xavier Bonaventura

unread,
Dec 30, 2020, 7:10:42 AM12/30/20
to Tony Aiuto, bazel-dev
I think that I found the starting point, I see that here is taking place the discovery of the c++ toolchain for windows
And I see that the entry point is the cc_configure from the WORKSPACE file.

Missatge de Xavier Bonaventura <xavibon...@gmail.com> del dia dt., 29 de des. 2020 a les 21:28:

Tony Aiuto

unread,
Jan 2, 2021, 11:30:24 PM1/2/21
to Xavier Bonaventura, bazel-dev
Whoops. my bad.  The work is in https://github.com/bazelbuild/rules_pkg/pull/254  but not merged.
I was waiting on the Bazel 4.0 release and put it aside until then.

Julian Amann

unread,
Nov 10, 2022, 2:11:58 PM11/10/22
to bazel-dev
This post is already quite old but anyways I want to mention https://github.com/Vertexwahn/rules_qt6 here ;)
Reply all
Reply to author
Forward
0 new messages