Skip to content

Commit

Permalink
feat: add iceoryx2
Browse files Browse the repository at this point in the history
Signed-off-by: wep21 <[email protected]>
  • Loading branch information
wep21 committed Dec 25, 2024
1 parent 7664af6 commit 28d55dc
Show file tree
Hide file tree
Showing 6 changed files with 197 additions and 0 deletions.
68 changes: 68 additions & 0 deletions modules/iceoryx2/0.5.0/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Copyright (c) 2024 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache Software License 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
# which is available at https://opensource.org/licenses/MIT.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT

module(
name = "iceoryx2",
version = "0.5.0",
bazel_compatibility = [">=7.2.1"],
)

bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "googletest", version = "1.15.2")
bazel_dep(name = "iceoryx", version = "2.95.3")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_cc", version = "0.1.0")
bazel_dep(name = "rules_rust", version = "0.56.0")

rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
edition = "2021",
)
use_repo(rust, "rust_toolchains")

register_toolchains("@rust_toolchains//:all")

crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
crate.from_cargo(
name = "crate_index",
cargo_lockfile = "//:Cargo.lock",
generate_binaries = True,
manifests = [
"//:Cargo.toml",
"//benchmarks/event:Cargo.toml",
"//benchmarks/publish-subscribe:Cargo.toml",
"//benchmarks/queue:Cargo.toml",
"//:examples/Cargo.toml",
"//iceoryx2:Cargo.toml",
"//iceoryx2-bb/container:Cargo.toml",
"//iceoryx2-bb/derive-macros:Cargo.toml",
"//iceoryx2-bb/elementary:Cargo.toml",
"//iceoryx2-bb/lock-free:Cargo.toml",
"//iceoryx2-bb/log:Cargo.toml",
"//iceoryx2-bb/memory:Cargo.toml",
"//iceoryx2-bb/posix:Cargo.toml",
"//iceoryx2-bb/system-types:Cargo.toml",
"//iceoryx2-bb/testing:Cargo.toml",
"//iceoryx2-bb/threadsafe:Cargo.toml",
"//iceoryx2-bb/trait-tests:Cargo.toml",
"//iceoryx2-cal:Cargo.toml",
"//iceoryx2-cli:Cargo.toml",
"//iceoryx2-ffi/ffi:Cargo.toml",
"//iceoryx2-ffi/ffi-macros:Cargo.toml",
"//iceoryx2-pal/concurrency-sync:Cargo.toml",
"//iceoryx2-pal/configuration:Cargo.toml",
"//iceoryx2-pal/posix:Cargo.toml",
],
)
use_repo(crate, "crate_index")

bazel_dep(name = "rules_rust_bindgen", version = "0.56.0")
1 change: 1 addition & 0 deletions modules/iceoryx2/0.5.0/overlay/MODULE.bazel
66 changes: 66 additions & 0 deletions modules/iceoryx2/0.5.0/patches/bindgen.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
diff --git iceoryx2-ffi/ffi/BUILD.bazel iceoryx2-ffi/ffi/BUILD.bazel
index f2738f81..a4e27e63 100644
--- iceoryx2-ffi/ffi/BUILD.bazel
+++ iceoryx2-ffi/ffi/BUILD.bazel
@@ -20,9 +20,10 @@ filegroup(
srcs = glob(["**"]),
)

-filegroup(
- name = "cbindgen-cli",
- srcs = ["@cbindgen//file"],
+alias(
+ name = "cbindgen",
+ actual = "@crate_index//:cbindgen__cbindgen",
+ tags = ["manual"],
)

genrule(
@@ -31,11 +32,11 @@ genrule(
"//:all_srcs",
"Cargo.toml",
"cbindgen.toml",
- ":cbindgen-cli",
+ ":cbindgen",
],
outs = ["include/iox2/iceoryx2.h"],
# this is actually just 'cbindgen iceoryx2-ffi/ffi --quiet --config iceoryx2-ffi/ffi/cbindgen.toml --output include/iox2/iceoryx2.h'
- cmd = "$(execpath :cbindgen-cli) $$(dirname $(location Cargo.toml)) --quiet --config $(location cbindgen.toml) --output $(OUTS)",
+ cmd = "$(execpath :cbindgen) $$(dirname $(location Cargo.toml)) --quiet --config $(location cbindgen.toml) --output $(OUTS)",
)

rust_shared_library(
diff --git iceoryx2-pal/posix/BUILD.bazel iceoryx2-pal/posix/BUILD.bazel
index 031247b8..b40f7db1 100644
--- iceoryx2-pal/posix/BUILD.bazel
+++ iceoryx2-pal/posix/BUILD.bazel
@@ -15,6 +15,7 @@ package(default_visibility = ["//visibility:public"])
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_rust//cargo:defs.bzl", "cargo_build_script")
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test_suite")
+load("@rules_rust_bindgen//:defs.bzl", "rust_bindgen")

filegroup(
name = "all_srcs",
@@ -36,14 +37,14 @@ cc_library(
)

# Generate the Rust binding file
-genrule(
- name = "iceoryx2-pal-posix-bindgen",
- srcs = [
- "src/c/posix.h",
- "@bindgen//:bindgen-cli",
+rust_bindgen(
+ name = "posix_generated",
+ cc_lib = ":iceoryx2-pal-posix-c-lib",
+ header = "src/c/posix.h",
+ bindgen_flags = [
+ "--use-core",
+ "--blocklist-type=max_align_t",
],
- outs = ["posix_generated.rs"],
- cmd = "$(execpath @bindgen//:bindgen-cli) --use-core --blocklist-type max_align_t $(location src/c/posix.h) --output $(OUTS)",
)

cargo_build_script(
33 changes: 33 additions & 0 deletions modules/iceoryx2/0.5.0/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
matrix:
platform:
- debian11
- macos
- macos_arm64
- ubuntu2004
- ubuntu2204
- ubuntu2404
bazel: [7.x, 8.x, rolling]
tasks:
verify_targets:
name: Verify build targets
platform: ${{ platform }}
bazel: ${{ bazel }}
build_flags:
- "--enable_bzlmod"
- "--incompatible_disallow_empty_glob=false"
- "--cxxopt=-std=c++17"
- "--@iceoryx//:feature_acl=off"
build_targets:
- "@iceoryx//..."
verify_debian10_targets:
name: Verify build targets
platform: debian10
bazel: ${{ bazel }}
build_flags:
- "--enable_bzlmod"
- "--incompatible_disallow_empty_glob=false"
- "--cxxopt=-std=c++17"
- "--linkopt=-lstdc++fs"
- "--@iceoryx//:feature_acl=off"
build_targets:
- "@iceoryx//..."
12 changes: 12 additions & 0 deletions modules/iceoryx2/0.5.0/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"integrity": "sha256-DoY1ttMS86nEzk+CNObm+NHSKdouRCjaoB4L03CaUdg=",
"strip_prefix": "iceoryx2-0.5.0",
"url": "https://github.com/eclipse-iceoryx/iceoryx2/archive/refs/tags/v0.5.0.tar.gz",
"patch_strip": 0,
"overlay": {
"MODULE.bazel": "sha256-gBc3qU0l1MjmDlrfQpxwRPzBsYuE5fl22aj9JfvtldM="
},
"patches": {
"bindgen.patch": "sha256-zfVmYHek57gazE0HtgskaXUZOTiN/ktoigqHhL3DhLw="
}
}
17 changes: 17 additions & 0 deletions modules/iceoryx2/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"homepage": "https://github.com/eclipse-iceoryx/iceoryx2.git",
"maintainers": [
{
"email": "[email protected]",
"github": "wep21",
"name": "Daisuke Nishimatsu"
}
],
"repository": [
"github:eclipse-iceoryx/iceoryx2"
],
"versions": [
"0.5.0"
],
"yanked_versions": {}
}

0 comments on commit 28d55dc

Please sign in to comment.