justbuchanan / bazel_rules_qt Goto Github PK
View Code? Open in Web Editor NEWBazel rules for Qt5
License: Apache License 2.0
Bazel rules for Qt5
License: Apache License 2.0
More than a bug is a issue to share issue and ideas, not sure if you ever intended to make the rules work with Windows.
With the examples and the proposed solution I did not manage to make it work with windows, but maybe I am just missing something.
In Windows the concept of installing libraries you don't have it and it is not so easy to make it work with the cc_library targets that are in https://github.com/justbuchanan/bazel_rules_qt/blob/master/qt.BUILD
The best way that I found for the moment is to have them as cc_import https://github.com/limdor/quoniam/blob/master/dependencies/qt/BUILD.qt (for each there is two rules because of this bug bazelbuild/bazel#4748)
The advantage with that is that you point to the root of the Qt installation, not just the include (https://github.com/limdor/quoniam/blob/master/WORKSPACE#L12) and then you could use the specific uic without the need of having it in the path.
This would also give the benefit that you can have two different installations of Qt for example 5.5 and 5.12 and just change the line in the workspace file being independent of what you have in your path.
Not sure my approach how would be to make it with linux in a unified way but I'll keep you posted.
Hi, would you be open to creating an initial release for these rules? For example, v0.1.0
I have currently trouble to setup a QML demo using those rules - it seems that this worked in the past -> https://github.com/justbuchanan/graph-algorithms-qt
Is it possible to provide a minimal demo/test that makes use of QML?
I would like to generate the .cc files for my .ui file using the qt_cc_library rule. It states
If a UI file is provided, then it is also compiled with UIC.
I am not sure what arguments to put where - I have successfully generated the header file with qt_ui_library, though.
Hi, thank you for working on this project. I find the name for the environment variable QT_DIR to be confusing. It is very similar to the existing environment variable QTDIR. Its purpose is to override the path to the QT installation in the Bazel build, so I propose it to be renamed to BAZEL_RULES_QT_DIR. This makes it easier for someone reading e.g. a CI configuration to find out what the purpose of the environment variable is. Also, it does not conflict with any existing environment variables.
If you are open to this change, I can open a Pull Request.
I installed on my Windows 10 x64 (Version 20H2) system Qt via:
python -m aqt install --outputdir C:\Qt 5.9.9 windows desktop win64_msvc2017_64
When doing
git clone https://github.com/justbuchanan/bazel_rules_qt.git
cd bazel_rules_qt
bazel build //...
I get the following error message:
ERROR: G:/dev/bazel_rules_qt/tests/qt_ui_library/BUILD:3:14: Action tests/qt_ui_library/ui_mainwindow.h failed: (Exit -1): uic failed: error executing command uic tests/qt_ui_library/mainwindow.ui -o bazel-out/x64_windows-fastbuild/bin/tests/qt_ui_library/ui_mainwindow.h. Note: Remote connection/protocol failed with: execution failed
Action failed to execute: java.io.IOException: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("uic" tests/qt_ui_library/mainwindow.ui -o bazel-out/x64_windows-fastbuild/bin/tests/qt_ui_library/ui_mainwindow.h): Das System kann die angegebene Datei nicht finden.
(error: 2)
I guess I have to add uic to the PATH environment variable.
Would be nice if this would work without adding uic to the environment variable
Hello! Thanks for this wonderful build rule.
I am currently using it, but part of my project needs to "#include ", but it seems that it's not included in this build rule. Is there a way I can do so?
When I compiled the code, it says could not file the QColor. And I actually cannot readily modify the source code as it's a third party dependency. What else could I do?
Thanks!
In order to use bazel_rules_qt in a bazel project, this must be added to the WORKSPACE fiile:
git_repository(
name = "com_justbuchanan_rules_qt",
remote = "https://github.com/justbuchanan/bazel_rules_qt",
branch = "master",
path = "QT_PATH",
)
On debian, QT_PATH should be "/usr/include/x86_64-linux-gnu/qt5" and on arch linux, QT_PATH is "/usr/include/qt". It's unfortunate that the WORKSPACE file must be modified depending on which system you're trying to build your app on. It would be nice to have bazel auto-detect this somehow.
If you want to use those rules you have to install Qt on every developer machine and configure your CI to pre-install Qt. For instance, when using Azure you have to do something similar as described here
The requirement of a pre-installed Qt version is really anyoing.
Get rid of this!
Fetch a pre-build version of Qt via Bazel.
I used qt_resource function in BUILD to add .rc file and set icon,but failed.
These rules don't seem to work on mac since the libraries are distributed as frameworks. Switching the linkopts to use frameworks like "-framework QtCore"
and adding build --linkopt=-F/usr/local/opt/qt5/lib
to .bazelrc
makes it work.
My toolchain is using a hermetic sysroot. I think I'll need to point to a few other system dependencies.
Do you know where it would make sense to add that?
...
In file included from external/qt/QtQuick/qsggeometry.h:44:
external/qt/QtGui/qopengl.h:141:13: fatal error: 'GL/gl.h' file not found
# include <GL/gl.h>
Hi, I use next options on ubuntu 18.04, x86_64:
Bazel version - tried 2.2.0 and 4.0.0 (using bazelisk)
WORKSPACE:
git_repository(
name = "com_justbuchanan_rules_qt",
remote = "https://github.com/justbuchanan/bazel_rules_qt.git",
commit = "7665177f47bf514176d5f8575a7334f030203e3d"
)
new_local_repository(
name = "qt",
build_file = "@com_justbuchanan_rules_qt//:qt.BUILD",
path = "/usr/include/x86_64-linux-gnu/qt5"
)
BUILD
load("@com_justbuchanan_rules_qt//:qt.bzl", "qt_cc_library", "qt_ui_library", "qt_resource")
qt_cc_library(
name = "Test",
srcs = ["test.cpp"],
hdrs = ["test.h"],
deps = ["@qt//:qt_core"],
)cc_binary(
name = "cpp-last",
srcs = glob(
["main.cpp", "test.h"]
),
linkopts = ["-lpthread"],
copts = [
"-fpic",
],
deps = [
"@qt//:qt_core",
":Test"
]
)
test.h file just include QObject
Every time I get this error:
fatal error: QObject: No such file or directory
but in /usr/include/x86_64-linux-gnu/qt5/QtCore path the file is present.
Could you please help me?
Due to bazelbuild/bazelisk#206 the CI is no longer working
Would be nice if there would be Qt6 support for those rules.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.