diff --git a/MODULE.bazel b/MODULE.bazel index f01891c..51e8c22 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -5,7 +5,7 @@ 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() @@ -13,6 +13,7 @@ use_repo( qt, "qt_linux_x86_64", "qt_windows_x86_64", + "qt_mac_aarch64", ) register_toolchains( "@rules_qt//tools:all", diff --git a/fetch_qt.bzl b/fetch_qt.bzl index ee6fb6d..f978b5c 100644 --- a/fetch_qt.bzl +++ b/fetch_qt.bzl @@ -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", + ) diff --git a/qt_libraries.bzl b/qt_libraries.bzl index 2217f41..d7bfa76 100644 --- a/qt_libraries.bzl +++ b/qt_libraries.bzl @@ -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"]), diff --git a/qt_mac_aarch64.BUILD b/qt_mac_aarch64.BUILD index ea95817..2751343 100644 --- a/qt_mac_aarch64.BUILD +++ b/qt_mac_aarch64.BUILD @@ -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"], ) @@ -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"], ) diff --git a/qt_mac_x86_64.BUILD b/qt_mac_x86_64.BUILD deleted file mode 100644 index e292cf0..0000000 --- a/qt_mac_x86_64.BUILD +++ /dev/null @@ -1,62 +0,0 @@ -load("@rules_qt//:qt_libraries.bzl", "QT_LIBRARIES") - -[ - cc_library( - name = "qt_%s_mac" % name, - hdrs = glob(["include/%s/**" % include_folder]), # allow_empty = True - includes = [ - "include", - "include/%s" % include_folder, - ], - linkopts = ["-F/usr/local/opt/qt@6/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 - ], - target_compatible_with = ["@platforms//os:osx"], - visibility = ["//visibility:public"], - ) - for name, include_folder, library_name, _ in QT_LIBRARIES -] - -cc_library( - name = "qt_hdrs", - hdrs = glob(["include/**"]), - includes = [ - "include", - ], - visibility = ["//visibility:public"], -) - -filegroup( - name = "uic", - srcs = ["share/qt/libexec/uic"], - visibility = ["//visibility:public"], -) - -filegroup( - name = "moc", - srcs = ["share/qt/libexec/moc"], - visibility = ["//visibility:public"], -) - -filegroup( - name = "rcc", - srcs = ["share/qt/libexec/rcc"], - visibility = ["//visibility:public"], -) - -filegroup( - name = "plugin_files", - srcs = glob(["share/qt/plugins/**/*"]), - visibility = ["//visibility:public"], -) - -filegroup( - name = "qml_files", - srcs = glob(["qml/**/*"]), - visibility = ["//visibility:public"], -) - -exports_files( - ["qml", "plugins", "lib"], - visibility = ["//visibility:public"], -) diff --git a/tests/.bazelrc b/tests/.bazelrc index 247910a..3dae9b5 100644 --- a/tests/.bazelrc +++ b/tests/.bazelrc @@ -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 diff --git a/tests/MODULE.bazel b/tests/MODULE.bazel index 00bb183..05aa256 100644 --- a/tests/MODULE.bazel +++ b/tests/MODULE.bazel @@ -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, +) diff --git a/tests/WORKSPACE.bazel b/tests/WORKSPACE.bazel index 63e9c6c..e69de29 100644 --- a/tests/WORKSPACE.bazel +++ b/tests/WORKSPACE.bazel @@ -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()