Skip to content

Commit

Permalink
upgrade qt to 6.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Sayter99 committed Oct 17, 2024
1 parent f5368af commit 6c0124f
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 155 deletions.
3 changes: 2 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ module(
)

bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")

qt = use_extension("@rules_qt//:extensions.bzl", "qt")
qt.fetch()
use_repo(
qt,
"qt_linux_x86_64",
"qt_windows_x86_64",
"qt_mac_aarch64",
)
register_toolchains(
"@rules_qt//tools:all",
Expand Down
50 changes: 14 additions & 36 deletions fetch_qt.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,28 @@ def fetch_qt6():
http_archive(
name = "qt_windows_x86_64",
urls = [
"https://dl.dropboxusercontent.com/scl/fi/5u79o4iqx7ija38h075rd/qt_6.7.3_windows_msvc2022_64_gamepad.zip?rlkey=c3gg9a4xw5s8ewyrnqz5gh82p&dl=0",
"https://dl.dropboxusercontent.com/scl/fi/a75eyqtu0542t203eyie2/qt_6.8.0_windows_msvc2022_64_gamepad.zip?rlkey=l2ucxa4by8c8tp3xioqoamm89&dl=0",
],
sha256 = "6cfec811307a9dea55fc11d24f6c6f828a8cacf39e12ff13740efb0b227cb2c1",
sha256 = "59aa42d34a1b5f15dfc915830a1dbebd90c7b418cf1b726eff8d0fa2766d9827",
build_file = "@rules_qt//:qt_windows_x86_64.BUILD",
)

#native.new_local_repository(
# name = "qt_windows_x86_64",
# path = "C:\\Qt\\6.4.0\\msvc2019_64",
# build_file = "@rules_qt//:qt_windows_x86_64.BUILD",
#)

http_archive(
name = "qt_linux_x86_64",
urls = [
"https://dl.dropboxusercontent.com/scl/fi/0qf3lcph52a3dfsf9gszb/qt_6.7.3_linux_desktop_gcc_64_gamepad.tar.xz?rlkey=aya7qoj1354ep1iunddgu8f6m&dl=0",
"https://dl.dropboxusercontent.com/scl/fi/n5aelrs4qg6lweuitb795/qt_6.8.0_linux_desktop_gcc_64_gamepad.tar.xz?rlkey=miuhkfeat53z7xk85y8abi7o3&dl=0",
],
sha256 = "101dfab81e1b41d582476df5bf27c355871754b94597a72ad3eefe711aea43af",
strip_prefix = "Qt-6.7.3",
sha256 = "fc18569262fa23c19009a66cfe39ce5761c8e99bc161820cb971be0beec0bb8b",
strip_prefix = "Qt-6.8.0",
build_file = "@rules_qt//:qt_linux_x86_64.BUILD",
)

#http_archive(
# name = "qt_mac_x86_64",
# urls = ["https://vertexwahn.de/lfs/v1/qt_mac_x86_64.zip"],
# sha256 = "9543aa178a6fe6aa138e4319fb07a106375b7fef11be150d154d5c1b8a321721",
# strip_prefix = "6.2.4/macos",
# build_file = "@rules_qt////:qt_mac_x86_64.BUILD",
#)

# On macOS we make use of an system installed Qt6
# installation works via:
# $ brew install qt@6
# $ brew link qt@6

# Check if path exists
# native.new_local_repository(
# name = "qt_mac_x86_64",
# path = "/usr/local/opt/qt@6", #"/usr/local/opt/qt@6",
# build_file = "@rules_qt//:qt_mac_x86_64.BUILD",
# )

# native.new_local_repository(
# name = "qt_mac_aarch64",
# path = "/opt/homebrew/", # after brew link, is't ok just use /opt/homebrew
# build_file = "@rules_qt//:qt_mac_aarch64.BUILD",
# )
http_archive(
name = "qt_mac_aarch64",
urls = [
"https://dl.dropboxusercontent.com/scl/fi/8io4wc9cx2kd2vfwswjmg/qt_6.8.0_mac_aarch64_gamepad.tar.xz?rlkey=afkk9qrub9i1gmelv7vktgtci&dl=0",
],
sha256 = "07be3436bfb31b3a2e629907ca39a8652febe563046094cdc7373b7ff28228c4",
strip_prefix = "Qt-6.8.0",
build_file = "@rules_qt//:qt_mac_aarch64.BUILD",
)
1 change: 1 addition & 0 deletions qt_libraries.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ QT_LIBRARIES = [
("qml_remote_objects", "QtRemoteObjectsQml", "Qt6RemoteObjectsQml", [":qt_remote_objects", ":qt_qml", ":qt_core"]),
("qml_scxml", "QtScxmlQml", "Qt6ScxmlQml", [":qt_scxml", ":qt_qml", ":qt_core"]),
("qml_state_machine", "QtStateMachineQml", "Qt6StateMachineQml", [":qt_state_machine", ":qt_qml", ":qt_core"]),
("qml_meta", "QtQmlMeta", "Qt6QmlMeta", [":qt_qml"]),
## qt quick
("quick", "QtQuick", "Qt6Quick", [":qt_gui", ":qt_qml"]),
# ("quick_pdf", "QtPdfQuick", "Qt6PdfQuick", [":qt_quick", ":qt_pdf", ":qt_gui", ":qt_qml", ":qt_core"]),
Expand Down
19 changes: 11 additions & 8 deletions qt_mac_aarch64.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ load("@rules_qt//:qt_libraries.bzl", "QT_LIBRARIES")
[
cc_library(
name = "qt_%s_mac" % name,
hdrs = glob(["include/%s/**" % include_folder]), # allow_empty = True
hdrs = glob(["lib/%s.framework/Headers/**" % include_folder]), # allow_empty = True
includes = [
"include",
"include/%s" % include_folder,
"lib/%s.framework/Headers" % include_folder,
],
linkopts = ["-F/opt/homebrew/lib"] + [
additional_linker_inputs = [":lib"],
linkopts = ["-F $(location :lib)"] + [
"-framework %s" % library_name.replace("6", ""), # macOS qt libs do not contain a 6 - e.g. instead of Qt6Core the lib is called QtCore
"-rpath $(location :lib)",
],
include_prefix = "%s" % include_folder,
strip_include_prefix = "lib/%s.framework/Headers" % include_folder,
target_compatible_with = ["@platforms//os:osx"],
visibility = ["//visibility:public"],
)
Expand All @@ -28,25 +31,25 @@ cc_library(

filegroup(
name = "uic",
srcs = ["share/qt/libexec/uic"],
srcs = ["libexec/uic"],
visibility = ["//visibility:public"],
)

filegroup(
name = "moc",
srcs = ["share/qt/libexec/moc"],
srcs = ["libexec/moc"],
visibility = ["//visibility:public"],
)

filegroup(
name = "rcc",
srcs = ["share/qt/libexec/rcc"],
srcs = ["libexec/rcc"],
visibility = ["//visibility:public"],
)

filegroup(
name = "plugin_files",
srcs = glob(["share/qt/plugins/**/*"]),
srcs = glob(["plugins/**/*"]),
visibility = ["//visibility:public"],
)

Expand Down
62 changes: 0 additions & 62 deletions qt_mac_x86_64.BUILD

This file was deleted.

50 changes: 20 additions & 30 deletions tests/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
# Setup compiler flags - required for Qt6 is at least C++17
build:gcc9 --cxxopt=-std=c++2a
build:gcc9 --cxxopt=-Wall
build:gcc9 --cxxopt=-Werror
# GCC
build:gccd --cxxopt=-std=c++20
build:gccd --cxxopt=-Wall
build:gccd --cxxopt=-Werror
build:gccd --compilation_mode=dbg

# GCC 11.2
#build:gcc11 --cxxopt=-std=c++23 # blocked by emsdk
build:gcc11 --cxxopt=-std=c++20
build:gcc11 --cxxopt=-Wall
#build:gcc11 --cxxopt=-Werror
#build:gcc11 --cxxopt=-Wno-error=volatile # blocked by emsdk
##build:gcc11 --cxxopt=-Wextra

# Visual Studio 2019
build:vs2019 --cxxopt=/std:c++20
build:vs2019 --cxxopt=/Zc:__cplusplus # Untested
build:vs2019 --enable_runfiles # https://github.com/bazelbuild/bazel/issues/8843
build:vs2019 --define compiler=vs2019
build:vs2019 --copt=-DWIN32_LEAN_AND_MEAN
build:vs2019 --copt=-DNOGDI
build:vs2019 --host_copt=-DWIN32_LEAN_AND_MEAN
build:vs2019 --host_copt=-DNOGDI
# GCC
build:gcc --cxxopt=-std=c++20
build:gcc --cxxopt=-Wall
build:gcc --cxxopt=-Werror
build:gcc --compilation_mode=opt

# Visual Studio 2022
build:vs2022 --cxxopt=/std:c++20
build:vs2022 --cxxopt=/Zc:__cplusplus
build:vs2022 --enable_runfiles # https://github.com/bazelbuild/bazel/issues/8843
build:vs2022 --define compiler=vs2022
build:vs2022 --copt=-DWIN32_LEAN_AND_MEAN
build:vs2022 --copt=-DNOGDI
build:vs2022 --host_copt=-DWIN32_LEAN_AND_MEAN
build:vs2022 --host_copt=-DNOGDI
build:vs --cxxopt=/std:c++20
build:vs --cxxopt=/Zc:__cplusplus
build:vs --enable_runfiles # https://github.com/bazelbuild/bazel/issues/8843
build:vs --define compiler=vs2022
build:vs --copt=-DWIN32_LEAN_AND_MEAN
build:vs --copt=-DNOGDI
build:vs --host_copt=-DWIN32_LEAN_AND_MEAN
build:vs --host_copt=-DNOGDI

# macOS (e.g. Clang 12.0.0)
build:macos --cxxopt=-std=c++2a
build:macos --cxxopt=-std=c++20
build:macos --cxxopt=-Wall
build:macos --repo_env=CC=clang
24 changes: 18 additions & 6 deletions tests/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
###############################################################################
# Bazel now uses Bzlmod by default to manage external dependencies.
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
#
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
###############################################################################
bazel_dep(name = "rules_qt")
local_path_override(
module_name = "rules_qt",
path = "..",
)

qt = use_extension("@rules_qt//:extensions.bzl", "qt")
qt.fetch()
use_repo(
qt,
"qt_linux_x86_64",
"qt_windows_x86_64",
"qt_mac_aarch64",
)
register_toolchains(
"@rules_qt//tools:all",
dev_dependency = True,
)
12 changes: 0 additions & 12 deletions tests/WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -1,12 +0,0 @@
local_repository(
name = "rules_qt",
path = "..",
)

load("@rules_qt//:fetch_qt.bzl", "fetch_qt6")

fetch_qt6()

load("@rules_qt//tools:qt_toolchain.bzl", "register_qt_toolchains")

register_qt_toolchains()

0 comments on commit 6c0124f

Please sign in to comment.