Skip to content

Commit

Permalink
Merge pull request #26 from Vertexwahn/bzlmod2
Browse files Browse the repository at this point in the history
Bzlmod2
  • Loading branch information
Vertexwahn authored Jan 11, 2025
2 parents 5e1081b + 7ae5c9a commit 0a024d9
Show file tree
Hide file tree
Showing 21 changed files with 275 additions and 228 deletions.
138 changes: 51 additions & 87 deletions .github/workflows/bazel_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,43 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3

- name: Mount bazel cache
uses: actions/cache@v3
with:
path: "/home/runner/.cache/bazel"
key: bazel
- uses: actions/[email protected]

- name: Build
run: |
cd tests
bazelisk build --config=gcc9 //...
build_and_test_ubuntu22:
name: Linux Ubuntu 22.04 build <GCC 11.3.0>
name: Linux Ubuntu 22.04 build <GCC 11.4.0>
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Mount bazel cache
uses: actions/cache@v3
with:
path: "/home/runner/.cache/bazel"
key: bazel-ubuntu22
- uses: actions/[email protected]

- name: Build
run: |
cd tests
bazelisk build --config=gcc11 //...
build_and_test_ubuntu24:
name: Linux Ubuntu 24.04 build <GCC 13.2.0>
runs-on: ubuntu-24.04

steps:
- uses: actions/[email protected]

- name: Build
run: |
cd tests
bazelisk build --config=gcc13 //...
build_and_test_windows10:
name: Windows Server 2019 build <Visual Studio 2019>
runs-on: windows-2019

steps:
- uses: actions/checkout@v3

- name: Mount bazel cache
uses: actions/cache@v3
with:
path: "/home/runner/.cache/bazel"
key: bazel
- uses: actions/[email protected]

- name: Build
run: |
Expand All @@ -64,87 +58,59 @@ jobs:
runs-on: windows-2022

steps:
- uses: actions/checkout@v3

- name: Mount bazel cache
uses: actions/cache@v3
with:
path: "/home/runner/.cache/bazel"
key: bazel
- uses: actions/[email protected]

- name: Build
run: |
cd tests
bazelisk build --config=vs2022 //...
build_and_test_macos11:
name: macOS 11 Bazel build <Apple Clang13>
runs-on: macOS-11
build_and_test_macos13:
name: macOS 13 Bazel build <Apple Clang14>
runs-on: macOS-13

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.2.2

- name: Mount bazel cache
uses: actions/cache@v3
with:
path: "/home/runner/.cache/bazel"
key: bazel
- name: Print info
run: |
echo "OS info:"
sw_vers
uname
echo "Compiler info:"
clang --version
- name: Print info
run: |
echo "OS info:"
sw_vers
uname
echo "Compiler info:"
clang --version
- name: Build
run: |
brew install qt@6
#brew link qt@6
cd tests
bazelisk build --config=macos //...
- name: Build
run: |
cd tests
bazelisk build --config=macos //...
build_and_test_macos12:
name: macOS 12 Bazel build <Apple Clang14>
runs-on: macOS-12
build_and_test_macos14:
name: macOS 14 Bazel build <Apple Clang14>
runs-on: macOS-14

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.2.2

- name: Mount bazel cache
uses: actions/cache@v3
with:
path: "/home/runner/.cache/bazel"
key: bazel
- name: Print info
run: |
echo "OS info:"
sw_vers
uname
echo "Compiler info:"
clang --version
- name: Print info
run: |
echo "OS info:"
sw_vers
uname
echo "Compiler info:"
clang --version
- name: Build
run: |
brew install qt@6
#brew link qt@6
cd tests
bazelisk build --config=macos //...
- name: Build
run: |
cd tests
bazelisk build --config=macos //...
build_and_test_macos13:
name: macOS 13 Bazel build <Apple Clang14>
runs-on: macOS-13
build_and_test_macos15:
name: macOS 15 Bazel build <Apple Clang14>
runs-on: macOS-15

steps:
- uses: actions/checkout@v3

- name: Mount bazel cache
uses: actions/cache@v3
with:
path: "/home/runner/.cache/bazel"
key: bazel
- uses: actions/[email protected]

- name: Print info
run: |
Expand All @@ -156,7 +122,5 @@ jobs:
- name: Build
run: |
brew install qt@6
#brew link qt@6
cd tests
bazelisk build --config=macos //...
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bazel-*
.vscode
*.bazel.lock
23 changes: 23 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module(
name = "rules_qt",
version = "1.0.0",
compatibility_level = 1,
)

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

qt = use_extension("@rules_qt//:extensions.bzl", "qt")
qt.fetch()
use_repo(
qt,
"qt_linux_x86_64",
"qt_mac_aarch64",
"qt_windows_x86_64",
)

register_toolchains(
"@rules_qt//tools:all",
dev_dependency = True,
)
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The following tools should be installed:
*All platforms:*

```shell
git clone https://github.com/Vertexwahn/rules_qt6 &&
git clone https://github.com/Vertexwahn/rules_qt6
cd rules_qt6/tests
```

Expand Down Expand Up @@ -59,6 +59,12 @@ bazel run --config=gcc9 //hello_world:hello_world
bazel run --config=gcc11 //hello_world:hello_world
```

*Run Hello World demo with Ubuntu 24.04:*

```shell
bazel run --config=gcc13 //hello_world:hello_world
```

*Run Hello World demo with macOS 11/12:*

```shell
Expand Down
1 change: 0 additions & 1 deletion WORKSPACE.bazel

This file was deleted.

15 changes: 15 additions & 0 deletions extensions.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
load("@rules_qt//:fetch_qt.bzl", "fetch_qt6")

def _qt_impl(ctx):
for mod in ctx.modules:
if mod.name == "rules_qt":
fetch_qt6()

_fetch = tag_class(attrs = {})

qt = module_extension(
implementation = _qt_impl,
tag_classes = {
"fetch": _fetch,
},
)
34 changes: 6 additions & 28 deletions fetch_qt.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ def fetch_qt6():
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 = [
Expand All @@ -32,28 +26,12 @@ def fetch_qt6():
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(
http_archive(
name = "qt_mac_aarch64",
path = "/opt/homebrew/", # after brew link, is't ok just use /opt/homebrew
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",
)
Loading

0 comments on commit 0a024d9

Please sign in to comment.