diff --git a/.bazelignore b/.bazelignore new file mode 100644 index 0000000000..567609b123 --- /dev/null +++ b/.bazelignore @@ -0,0 +1 @@ +build/ diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 0000000000..18a777b5fc --- /dev/null +++ b/.bazelrc @@ -0,0 +1 @@ +build --cxxopt="-std=c++14" diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index b85cfe5125..f23972cae5 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -124,6 +124,28 @@ jobs: - uses: actions/checkout@v3 - run: ./tools/ci/build-test-ubuntu-with-gcc54.sh + # Bazel sanitiy check + build-test-ubuntu-bazel: + runs-on: ubuntu-latest + needs: pre-flight-check + steps: + - uses: actions/checkout@v3 + - run: sudo apt-get update && sudo apt-get install -y libacl1-dev libncurses5-dev + - uses: bazelbuild/setup-bazelisk@v2 + - name: Mount bazel cache + uses: actions/cache@v3 + with: + path: "~/.cache/bazel" + key: bazel + - name: Bazel Linting + Build + Test + run: | + # Run linter on complete bazel code + bazel run //:buildifier_lint_check + # Build everything including stresstests + bazel build //... + # We exclude the sofi stresstest in CI since we cannot set the CPU Affinity in the GitHub Action Runners + bazel test //... --deleted_packages=iceoryx_hoofs/test/stresstests + coverage-and-docs: runs-on: ubuntu-20.04 needs: pre-flight-check diff --git a/.gitignore b/.gitignore index c6ff55f553..131c71f53c 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ doc/website/API-reference/ tools/website/generated/ *.project __pycache__ +/bazel-* diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000000..a5c7ebd867 --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,73 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier") + +exports_files(["VERSION"]) + +alias( + name = "iceoryx_hoofs", + actual = "//iceoryx_hoofs", + visibility = ["//visibility:public"], +) + +alias( + name = "iceoryx_posh", + actual = "//iceoryx_posh", + visibility = ["//visibility:public"], +) + +alias( + name = "iceoryx_binding_c", + actual = "//iceoryx_binding_c", + visibility = ["//visibility:public"], +) + +alias( + name = "roudi", + actual = "//iceoryx_posh:iox-roudi", + visibility = ["//visibility:public"], +) + +# Execute `bazel run //:buildifier` to fix formating of all starlark files in the workspace +buildifier( + name = "buildifier", + verbose = True, +) + +# Execute `bazel run //:buildifier_test` to check all starlark files for correctness +buildifier( + name = "buildifier_test", + mode = "check", + verbose = True, +) + +# Execute `bazel run //:buildifier_lint` to reformat and run the linter on all starlark files +buildifier( + name = "buildifier_lint", + lint_mode = "fix", + lint_warnings = ["all"], + verbose = True, +) + +# Execute `bazel run //:buildifier_lint_check` to reformat and run the linter on all starlark files +buildifier( + name = "buildifier_lint_check", + lint_mode = "warn", + lint_warnings = ["all"], + mode = "check", + verbose = True, +) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3b3d6ca67b..5024b73dee 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -119,6 +119,8 @@ codebase follows these rules, things are work in progress. See [error-handling.md](./doc/design/error-handling.md) for additional information about logging and error handling. +For formatting and linting rules on Bazel files see the [installation guide for contributors](./doc/website/advanced/installation-guide-for-contributors.md#bazel). + ### Naming conventions * File names with `lower_snake_case`: `my_thing.hpp` diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel new file mode 100644 index 0000000000..136a69f31d --- /dev/null +++ b/WORKSPACE.bazel @@ -0,0 +1,27 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +workspace(name = "org_eclipse_iceoryx") + +# Load dependency googletest +load("//bazel:load_repositories.bzl", "load_repositories") + +load_repositories() + +# Load dependency cpptoml +load("//bazel:setup_repositories.bzl", "setup_repositories") + +setup_repositories() diff --git a/bazel/BUILD.bazel b/bazel/BUILD.bazel new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bazel/bazelbuild/BUILD.bazel b/bazel/bazelbuild/BUILD.bazel new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bazel/bazelbuild/repositories.bzl b/bazel/bazelbuild/repositories.bzl new file mode 100644 index 0000000000..654687c02c --- /dev/null +++ b/bazel/bazelbuild/repositories.bzl @@ -0,0 +1,73 @@ +""" +Copyright (c) 2022 by Apex.AI Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 + +Loads dependent repositories from https://github.com/bazelbuild +""" + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") + +BAZELBUILD_RULES_CC_VERSION = "0.0.1" + +def load_com_github_bazelbuild_rules_cc_repositories(): + maybe( + name = "bazelbuild_rules_cc", + repo_rule = http_archive, + sha256 = "4dccbfd22c0def164c8f47458bd50e0c7148f3d92002cdb459c2a96a68498241", + urls = [ + "https://github.com/bazelbuild/rules_cc/releases/download/{version}/rules_cc-{version}.tar.gz".format(version = BAZELBUILD_RULES_CC_VERSION), + ], + ) + +COM_GITHUB_BAZELBUILD_BUILDTOOLS_VERSION = "5.1.0" + +def load_com_github_bazelbuild_buildtools_repositories(): + maybe( + name = "com_github_bazelbuild_buildtools", + repo_rule = http_archive, + sha256 = "e3bb0dc8b0274ea1aca75f1f8c0c835adbe589708ea89bf698069d0790701ea3", + strip_prefix = "buildtools-{version}".format(version = COM_GITHUB_BAZELBUILD_BUILDTOOLS_VERSION), + urls = [ + "https://github.com/bazelbuild/buildtools/archive/refs/tags/{version}.tar.gz".format(version = COM_GITHUB_BAZELBUILD_BUILDTOOLS_VERSION), + ], + ) + +IO_BAZEL_RULES_GO_VERSION = "0.29.0" + +def load_io_bazel_rules_go_repositories(): + maybe( + name = "io_bazel_rules_go", + repo_rule = http_archive, + sha256 = "2b1641428dff9018f9e85c0384f03ec6c10660d935b750e3fa1492a281a53b0f", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v{version}/rules_go-v{version}.zip".format(version = IO_BAZEL_RULES_GO_VERSION), + "https://github.com/bazelbuild/rules_go/releases/download/v{version}/rules_go-v{version}.zip".format(version = IO_BAZEL_RULES_GO_VERSION), + ], + ) + +COM_GOOGLE_PROTOBUF_VERSION = "3.13.0" + +def load_com_google_protobuf_repositories(): + maybe( + name = "com_google_protobuf", + repo_rule = http_archive, + sha256 = "9b4ee22c250fe31b16f1a24d61467e40780a3fbb9b91c3b65be2a376ed913a1a", + strip_prefix = "protobuf-{version}".format(version = COM_GOOGLE_PROTOBUF_VERSION), + urls = [ + "https://github.com/protocolbuffers/protobuf/archive/v{version}.tar.gz".format(version = COM_GOOGLE_PROTOBUF_VERSION), + ], + ) diff --git a/bazel/bazelbuild/setup.bzl b/bazel/bazelbuild/setup.bzl new file mode 100644 index 0000000000..4dcc07e104 --- /dev/null +++ b/bazel/bazelbuild/setup.bzl @@ -0,0 +1,29 @@ +""" +Copyright (c) 2022 by Apex.AI Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 + +Macro for setting the dependencies for the buildtools of bazel +""" + +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") +load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") + +def setup_go_protobuf_for_bazelbuild(): + go_rules_dependencies() + + go_register_toolchains(version = "1.17.2") + + protobuf_deps() diff --git a/bazel/configure_file.bzl b/bazel/configure_file.bzl new file mode 100644 index 0000000000..9f15bed069 --- /dev/null +++ b/bazel/configure_file.bzl @@ -0,0 +1,42 @@ +""" +Copyright (c) 2022 by Apex.AI Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 + +The configure_file rule imitates the similar CMake function for template expansion: https://cmake.org/cmake/help/latest/command/configure_file.html +""" + +def _configure_file_impl(ctx): + ctx.actions.expand_template( + template = ctx.file.src, + output = ctx.outputs.out, + substitutions = { + "@" + k + "@": v + for k, v in ctx.attr.config.items() + }, + ) + files = depset(direct = [ctx.outputs.out]) + runfiles = ctx.runfiles(files = [ctx.outputs.out]) + return [DefaultInfo(files = files, runfiles = runfiles)] + +configure_file = rule( + implementation = _configure_file_impl, + provides = [DefaultInfo], + attrs = { + "config": attr.string_dict(mandatory = True), + "out": attr.output(mandatory = True), + "src": attr.label(mandatory = True, allow_single_file = True), + }, +) diff --git a/bazel/configure_version.bzl b/bazel/configure_version.bzl new file mode 100644 index 0000000000..c54ccc686d --- /dev/null +++ b/bazel/configure_version.bzl @@ -0,0 +1,67 @@ +""" +Copyright (c) 2022 by Apex.AI Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 + +This module set compile-time variables and set them accordingly in generated files +""" + +SCRIPT = """#!/bin/bash + +set -e + +version_file="{version_file}" +input_file="{input_file}" +output_file="{output_file}" + +IFS="-" read version_number version_suffix <<< $(<"$version_file") +IFS="." read major_version minor_version patch_version tweak_version <<< $version_number +[ -z "$version_suffix" ] && version_delim="" || version_delim="-" + +data="$(<"$input_file")" +data=${{data/@PROJECT_VERSION_MAJOR@/${{major_version:-0}}}} +data=${{data/@PROJECT_VERSION_MINOR@/${{minor_version:-0}}}} +data=${{data/@PROJECT_VERSION_PATCH@/${{patch_version:-0}}}} +data=${{data/@IOX_VERSION_TWEAK@/${{tweak_version:-0}}}} +data=${{data/@PROJECT_VERSION@/${{version_number}}}} +data=${{data/@IOX_VERSION_SUFFIX@/${{version_delim}}${{version_suffix}}}} +data=${{data/@ICEORYX_BUILDDATE@/builddate_not_set}} +data=${{data/@ICEORYX_SHA1@/sha1_not_set}} + +echo "$data" > $output_file +""" + +def _configure_version_impl(ctx): + ctx.actions.run_shell( + command = SCRIPT.format( + version_file = ctx.files.version_from[0].path, + input_file = ctx.files.src[0].path, + output_file = ctx.outputs.out.path, + ), + inputs = ctx.files.src + ctx.files.version_from, + outputs = [ctx.outputs.out], + ) + files = depset(direct = [ctx.outputs.out]) + return [DefaultInfo(files = files)] + +configure_version = rule( + implementation = _configure_version_impl, + provides = [DefaultInfo], + attrs = { + "out": attr.output(mandatory = True), + "src": attr.label(mandatory = True, allow_single_file = True), + "version_from": attr.label(mandatory = True, allow_single_file = True), + }, +) diff --git a/bazel/cpptoml/BUILD.bazel b/bazel/cpptoml/BUILD.bazel new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bazel/cpptoml/cpptoml.BUILD b/bazel/cpptoml/cpptoml.BUILD new file mode 100644 index 0000000000..e7fe3a407f --- /dev/null +++ b/bazel/cpptoml/cpptoml.BUILD @@ -0,0 +1,24 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_library") + +cc_library( + name = "cpptoml", + hdrs = ["include/cpptoml.h"], + strip_include_prefix = "include", + visibility = ["//visibility:public"], +) diff --git a/bazel/cpptoml/repositories.bzl b/bazel/cpptoml/repositories.bzl new file mode 100644 index 0000000000..f58b1a9487 --- /dev/null +++ b/bazel/cpptoml/repositories.bzl @@ -0,0 +1,34 @@ +""" +Copyright (c) 2022 by Apex.AI Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 + +This module downloads the cpptoml project: https://github.com/skystrife/cpptoml +""" + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") + +CPPTOML_VERSION = "0.1.1" + +def load_cpptoml_repositories(): + maybe( + name = "cpptoml", + repo_rule = http_archive, + sha256 = "23af72468cfd4040984d46a0dd2a609538579c78ddc429d6b8fd7a10a6e24403", + url = "https://github.com/skystrife/cpptoml/archive/refs/tags/v{version}.tar.gz".format(version = CPPTOML_VERSION), + strip_prefix = "cpptoml-{version}".format(version = CPPTOML_VERSION), + build_file = "//bazel/cpptoml:cpptoml.BUILD", + ) diff --git a/bazel/googletest/BUILD.bazel b/bazel/googletest/BUILD.bazel new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bazel/googletest/repositories.bzl b/bazel/googletest/repositories.bzl new file mode 100644 index 0000000000..98d0a09039 --- /dev/null +++ b/bazel/googletest/repositories.bzl @@ -0,0 +1,33 @@ +""" +Copyright (c) 2022 by Apex.AI Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 + +Loads https://github.com/google/googletest +""" + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") + +GOOGLETEST_VERSION = "1.11.0" + +def load_googletest_repositories(): + maybe( + name = "googletest", + repo_rule = http_archive, + urls = ["https://github.com/google/googletest/archive/refs/tags/release-{version}.zip".format(version = GOOGLETEST_VERSION)], + sha256 = "353571c2440176ded91c2de6d6cd88ddd41401d14692ec1f99e35d013feda55a", + strip_prefix = "googletest-release-{version}".format(version = GOOGLETEST_VERSION), + ) diff --git a/bazel/load_repositories.bzl b/bazel/load_repositories.bzl new file mode 100644 index 0000000000..b258c85353 --- /dev/null +++ b/bazel/load_repositories.bzl @@ -0,0 +1,32 @@ +""" +Copyright (c) 2022 by Apex.AI Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 +""" + +load("//bazel/bazelbuild:repositories.bzl", "load_com_github_bazelbuild_buildtools_repositories", "load_com_github_bazelbuild_rules_cc_repositories", "load_com_google_protobuf_repositories", "load_io_bazel_rules_go_repositories") +load("//bazel/cpptoml:repositories.bzl", "load_cpptoml_repositories") +load("//bazel/googletest:repositories.bzl", "load_googletest_repositories") + +def load_repositories(): + """ + Loads repositories for iceoryx dependencies + """ + load_com_github_bazelbuild_rules_cc_repositories() + load_io_bazel_rules_go_repositories() + load_com_google_protobuf_repositories() + load_com_github_bazelbuild_buildtools_repositories() + load_googletest_repositories() + load_cpptoml_repositories() diff --git a/bazel/setup_repositories.bzl b/bazel/setup_repositories.bzl new file mode 100644 index 0000000000..7dc1e3cab6 --- /dev/null +++ b/bazel/setup_repositories.bzl @@ -0,0 +1,25 @@ +""" +Copyright (c) 2022 by Apex.AI Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +SPDX-License-Identifier: Apache-2.0 +""" + +load("//bazel/bazelbuild:setup.bzl", "setup_go_protobuf_for_bazelbuild") + +def setup_repositories(): + """ + Loads repositories for iceoryx dependencies + """ + setup_go_protobuf_for_bazelbuild() diff --git a/doc/website/advanced/installation-guide-for-contributors.md b/doc/website/advanced/installation-guide-for-contributors.md index e579f899df..7ebc4079d2 100644 --- a/doc/website/advanced/installation-guide-for-contributors.md +++ b/doc/website/advanced/installation-guide-for-contributors.md @@ -142,10 +142,41 @@ machine. With `./tools/scripts/ice_env.sh` one can create a docker container with preinstalled dependencies and a configuration similar to the CI target container. -When for instance the target ubuntu 18.04 fails we can start the container with +When for instance the target Ubuntu 18.04 fails we can start the container with ```sh ./tools/scripts/ice_env.sh enter ubuntu:18.04 ``` which enters the environment automatically and one can start debugging. + +## Bazel + +When working with Bazel, additional tools can help the developer to maintain +a consistent codebase similar to the Clang Tools (clang-format and clang-tidy) for C++. +The [Buildifier Tool](https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md) +offers formatting and linting for Bazel files. + +The formatting is based on rules given by Buildifier and the linting is based on +a list of [warnings](https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md). + +To check formatting of the Bazel files the following command needs to run in the iceoryx +workspace. + +```bash +cd iceoryx +bazel run //:buildifier +``` + +Buildifier automatically reformat the code. + +For formatting and linting this command will do the job: + +```bash +cd iceoryx +bazel run //:buildifier_lint +``` + +The CI will check for the correct formatting and linting. +See the `BUILD.bazel` file +in iceoryx workspace for available commands. diff --git a/doc/website/getting-started/installation.md b/doc/website/getting-started/installation.md index aa57f49162..127c070eab 100644 --- a/doc/website/getting-started/installation.md +++ b/doc/website/getting-started/installation.md @@ -224,3 +224,65 @@ colcon build ``` This build method makes the most sense in combination with [rmw_iceoryx](https://github.com/ros2/rmw_iceoryx.git) + +## Build with Bazel + +A second option is to build iceoryx with [Bazel](https://bazel.build/) as an alternative build and test tool. +In comparison to CMake it offers an easier syntax with better performance and a hermetic build mode for reproducible builds. + +To install Bazel you can use [Bazelisk](https://bazel.build/install/bazelisk). +Bazel uses workspaces and BUILD files to set up the infrastructure. You will notice +that in the root directory of iceoryx a `WORKSPACE` is added that defines the workspace folder. +In general, a Bazel workspace contains the project-specific source code and build outputs. +In the corresponding iceoryx modules (e.g. iceoryx_hoofs) you will find `BUILD` files +that contain instructions for Bazel to build and test targets.[[1]] + +[1]: https://bazel.build/install/bazelisk + +To build a specific target with Bazel you can use the `bazel build` command: + +```bash +cd iceoryx +bazel build //iceoryx_posh:iox-roudi +``` + +The `//iceoryx_posh` argument is the location of the BUILD file for the package. +BUILD files can be seen similar to CMakeLists.txt files where the build targets are defined. +The `iox-roudi` separated by a colon is the actual target defined in the BUILD file. + +!!! tip + Using `bazel build //...` will build all Bazel targets. + +!!! note + The names for iceoryx targets like libraries, applications and test are the same as in the CMake build system. + +You will notice that four additional `bazel-*` folders are created in the iceoryx root folder. +They contain the build artifacts and test log. Bazel compiles the libraries always static and +dynamic and place them into the `bazel-out` folder. + +Executing tests with Bazel is similar like building: + +```bash +cd iceoryx +bazel test //iceoryx_hoofs/test:hoofs_moduletests +``` + +!!! tip + Using `bazel test //...` will run all tests defined in Bazel. + +!!! note + Logs and generated XML files with the results are automatically created and + stored within the `bazel-testlogs` folder. + +Bazel offers the possibility to execute binaries: + +```bash +cd iceoryx +bazel run //iceoryx_posh:iox-roudi +``` + +!!! tip + Calling `bazel test` or `bazel run` directly without a previous `bazel build` is possible and will build the necessary targets automatically. + +The support for Bazel in iceoryx is work in progress but the most important libraries and applications are covered. +Ideas and Remarks are always welcome, feel free to create an issue or discussion on the GitHub repository. diff --git a/doc/website/release-notes/iceoryx-unreleased.md b/doc/website/release-notes/iceoryx-unreleased.md index 234b6afeb1..5bd318a544 100644 --- a/doc/website/release-notes/iceoryx-unreleased.md +++ b/doc/website/release-notes/iceoryx-unreleased.md @@ -26,6 +26,7 @@ - Create convenience macro for `NewType` [\#1425](https://github.com/eclipse-iceoryx/iceoryx/issues/1425) - Add posix thread wrapper [\#1365](https://github.com/eclipse-iceoryx/iceoryx/issues/1365) - Apps send only the heartbeat when monitoring is enabled in roudi [\#1436](https://github.com/eclipse-iceoryx/iceoryx/issues/1436) +- Support [Bazel](https://bazel.build/) as optional build system [\#1542](https://github.com/eclipse-iceoryx/iceoryx/issues/1542) **Bugfixes:** diff --git a/iceoryx_binding_c/BUILD.bazel b/iceoryx_binding_c/BUILD.bazel new file mode 100644 index 0000000000..515205f5b2 --- /dev/null +++ b/iceoryx_binding_c/BUILD.bazel @@ -0,0 +1,26 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_library") + +cc_library( + name = "iceoryx_binding_c", + srcs = glob(["source/**"]), + hdrs = glob(["include/**"]), + strip_include_prefix = "include", + visibility = ["//visibility:public"], + deps = ["//iceoryx_posh"], +) diff --git a/iceoryx_binding_c/test/BUILD.bazel b/iceoryx_binding_c/test/BUILD.bazel new file mode 100644 index 0000000000..39e0e0bbd7 --- /dev/null +++ b/iceoryx_binding_c/test/BUILD.bazel @@ -0,0 +1,48 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_test") + +cc_test( + name = "binding_c_moduletests", + srcs = glob([ + "moduletests/*.cpp", + "moduletests/*.hpp", + "mocks/*.hpp", + "*.hpp", + ]), + includes = [ + ".", + "mocks", + "moduletests", + ], + linkopts = select({ + "//iceoryx_hoofs/platform:linux": ["-ldl"], + "//iceoryx_hoofs/platform:mac": ["-ldl"], + "//iceoryx_hoofs/platform:qnx": [], + "//iceoryx_hoofs/platform:unix": [], + "//iceoryx_hoofs/platform:win": [], + "//conditions:default": ["-ldl"], + }), + tags = ["exclusive"], + visibility = ["//visibility:private"], + deps = [ + "//iceoryx_binding_c", + "//iceoryx_hoofs:iceoryx_hoofs_testing", + "//iceoryx_posh", + "//iceoryx_posh:iceoryx_posh_testing", + ], +) diff --git a/iceoryx_examples/callbacks/BUILD.bazel b/iceoryx_examples/callbacks/BUILD.bazel new file mode 100644 index 0000000000..8dc2d886dd --- /dev/null +++ b/iceoryx_examples/callbacks/BUILD.bazel @@ -0,0 +1,55 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") + +cc_library( + name = "topic_data", + hdrs = ["topic_data.hpp"], +) + +cc_binary( + name = "iox-cpp-callbacks-publisher", + srcs = [ + "ice_callbacks_publisher.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-callbacks-subscriber", + srcs = [ + "ice_callbacks_subscriber.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-callbacks-listener-as-class-member", + srcs = [ + "ice_callbacks_listener_as_class_member.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) diff --git a/iceoryx_examples/callbacks_in_c/BUILD.bazel b/iceoryx_examples/callbacks_in_c/BUILD.bazel new file mode 100644 index 0000000000..0c8507a142 --- /dev/null +++ b/iceoryx_examples/callbacks_in_c/BUILD.bazel @@ -0,0 +1,63 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") + +cc_library( + name = "topic_data", + hdrs = ["topic_data.h"], +) + +cc_library( + name = "sleep_for", + hdrs = ["sleep_for.h"], +) + +cc_binary( + name = "iox-c-callbacks-publisher", + srcs = [ + "ice_c_callbacks_publisher.c", + ], + deps = [ + ":sleep_for", + ":topic_data", + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-callbacks-subscriber", + srcs = [ + "ice_c_callbacks_subscriber.c", + ], + deps = [ + ":sleep_for", + ":topic_data", + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-callbacks-with-context-data", + srcs = [ + "ice_c_callbacks_with_context_data.c", + ], + deps = [ + ":sleep_for", + ":topic_data", + "//iceoryx_binding_c", + ], +) diff --git a/iceoryx_examples/complexdata/BUILD.bazel b/iceoryx_examples/complexdata/BUILD.bazel new file mode 100644 index 0000000000..bcc696442b --- /dev/null +++ b/iceoryx_examples/complexdata/BUILD.bazel @@ -0,0 +1,66 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") + +cc_library( + name = "topic_data", + hdrs = ["topic_data.hpp"], +) + +cc_binary( + name = "iox-cpp-publisher-vector", + srcs = [ + "iox_publisher_vector.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-subscriber-vector", + srcs = [ + "iox_subscriber_vector.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-publisher-complexdata", + srcs = [ + "iox_publisher_complexdata.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-subscriber-complexdata", + srcs = [ + "iox_subscriber_complexdata.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) diff --git a/iceoryx_examples/ice_access_control/BUILD.bazel b/iceoryx_examples/ice_access_control/BUILD.bazel new file mode 100644 index 0000000000..4f83eab867 --- /dev/null +++ b/iceoryx_examples/ice_access_control/BUILD.bazel @@ -0,0 +1,66 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") + +cc_library( + name = "topic_data", + hdrs = ["topic_data.hpp"], +) + +cc_binary( + name = "iox-cpp-radar", + srcs = [ + "iox_radar_app.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-display", + srcs = [ + "iox_display_app.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-cheeky", + srcs = [ + "iox_cheeky_app.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-roudi-static-segments", + srcs = [ + "roudi_main_static_segments.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh:iceoryx_posh_roudi", + ], +) diff --git a/iceoryx_examples/icedelivery/BUILD.bazel b/iceoryx_examples/icedelivery/BUILD.bazel new file mode 100644 index 0000000000..654fa9872a --- /dev/null +++ b/iceoryx_examples/icedelivery/BUILD.bazel @@ -0,0 +1,66 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") + +cc_library( + name = "topic_data", + hdrs = ["topic_data.hpp"], +) + +cc_binary( + name = "iox-cpp-publisher", + srcs = [ + "iox_publisher.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-publisher-untyped", + srcs = [ + "iox_publisher_untyped.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-subscriber", + srcs = [ + "iox_subscriber.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-subscriber-untyped", + srcs = [ + "iox_subscriber_untyped.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) diff --git a/iceoryx_examples/icedelivery_in_c/BUILD.bazel b/iceoryx_examples/icedelivery_in_c/BUILD.bazel new file mode 100644 index 0000000000..b4dbe44f3c --- /dev/null +++ b/iceoryx_examples/icedelivery_in_c/BUILD.bazel @@ -0,0 +1,45 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary") + +topic_data_h = "topic_data.h" + +sleep_for_h = "sleep_for.h" + +cc_binary( + name = "iox-c-publisher", + srcs = [ + "ice_c_publisher.c", + topic_data_h, + sleep_for_h, + ], + deps = [ + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-subscriber", + srcs = [ + "ice_c_subscriber.c", + topic_data_h, + sleep_for_h, + ], + deps = [ + "//iceoryx_binding_c", + ], +) diff --git a/iceoryx_examples/icediscovery/BUILD.bazel b/iceoryx_examples/icediscovery/BUILD.bazel new file mode 100644 index 0000000000..8e1d85e0e4 --- /dev/null +++ b/iceoryx_examples/icediscovery/BUILD.bazel @@ -0,0 +1,79 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") + +cc_binary( + name = "iox-cpp-offer-service", + srcs = [ + "iox_offer_service.cpp", + ], + deps = [ + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-find-service", + srcs = [ + "iox_find_service.cpp", + ], + deps = [ + "//iceoryx_posh", + ], +) + +cc_library( + name = "discovery_blocking", + srcs = ["src/discovery_blocking.cpp"], + hdrs = ["include/discovery_blocking.hpp"], + strip_include_prefix = "include", + deps = [ + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-wait-for-service", + srcs = [ + "iox_wait_for_service.cpp", + ], + deps = [ + ":discovery_blocking", + "//iceoryx_posh", + ], +) + +cc_library( + name = "discovery_monitor", + srcs = ["src/discovery_monitor.cpp"], + hdrs = ["include/discovery_monitor.hpp"], + strip_include_prefix = "include", + deps = [ + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-discovery-monitor", + srcs = [ + "iox_discovery_monitor.cpp", + ], + deps = [ + ":discovery_monitor", + "//iceoryx_posh", + ], +) diff --git a/iceoryx_examples/icediscovery_in_c/BUILD.bazel b/iceoryx_examples/icediscovery_in_c/BUILD.bazel new file mode 100644 index 0000000000..833c571537 --- /dev/null +++ b/iceoryx_examples/icediscovery_in_c/BUILD.bazel @@ -0,0 +1,41 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary") + +sleep_for_h = "sleep_for.h" + +cc_binary( + name = "iox-c-offer-service", + srcs = [ + "iox_c_offer_service.c", + sleep_for_h, + ], + deps = [ + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-find-service", + srcs = [ + "iox_c_find_service.c", + sleep_for_h, + ], + deps = [ + "//iceoryx_binding_c", + ], +) diff --git a/iceoryx_examples/icehello/BUILD.bazel b/iceoryx_examples/icehello/BUILD.bazel new file mode 100644 index 0000000000..dd9c28f4c2 --- /dev/null +++ b/iceoryx_examples/icehello/BUILD.bazel @@ -0,0 +1,44 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") + +cc_library( + name = "topic_data", + hdrs = ["topic_data.hpp"], +) + +cc_binary( + name = "iox-cpp-publisher-helloworld", + srcs = [ + "iox_publisher_helloworld.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-subscriber-helloworld", + srcs = [ + "iox_subscriber_helloworld.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) diff --git a/iceoryx_examples/iceoptions/BUILD.bazel b/iceoryx_examples/iceoptions/BUILD.bazel new file mode 100644 index 0000000000..c3fc3d5de7 --- /dev/null +++ b/iceoryx_examples/iceoptions/BUILD.bazel @@ -0,0 +1,44 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") + +cc_library( + name = "topic_data", + hdrs = ["topic_data.hpp"], +) + +cc_binary( + name = "iox-cpp-publisher-with-options", + srcs = [ + "iox_publisher_with_options.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-subscriber-with-options", + srcs = [ + "iox_subscriber_with_options.cpp", + ], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], +) diff --git a/iceoryx_examples/iceperf/BUILD.bazel b/iceoryx_examples/iceperf/BUILD.bazel new file mode 100644 index 0000000000..6f9b419cb4 --- /dev/null +++ b/iceoryx_examples/iceperf/BUILD.bazel @@ -0,0 +1,77 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") + +cc_library( + name = "iceperf_base", + srcs = [ + "base.cpp", + "iceoryx.cpp", + "iceoryx_c.cpp", + "mq.cpp", + "uds.cpp", + ], + hdrs = [ + "base.hpp", + "example_common.hpp", + "iceoryx.hpp", + "iceoryx_c.hpp", + "mq.hpp", + "topic_data.hpp", + "uds.hpp", + ], + visibility = ["//visibility:private"], + deps = [ + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iceperf-bench-leader", + srcs = [ + "iceperf_leader.cpp", + "iceperf_leader.hpp", + "main_leader.cpp", + ], + includes = ["."], + deps = [ + ":iceperf_base", + ], +) + +cc_binary( + name = "iceperf-bench-follower", + srcs = [ + "iceperf_follower.cpp", + "iceperf_follower.hpp", + "main_follower.cpp", + ], + includes = ["."], + deps = [ + ":iceperf_base", + ], +) + +cc_binary( + name = "iceperf-roudi", + srcs = [ + "roudi_main_static_config.cpp", + ], + deps = [ + "//iceoryx_posh:iceoryx_posh_roudi", + ], +) diff --git a/iceoryx_examples/request_response/BUILD.bazel b/iceoryx_examples/request_response/BUILD.bazel new file mode 100644 index 0000000000..a3da5eae12 --- /dev/null +++ b/iceoryx_examples/request_response/BUILD.bazel @@ -0,0 +1,94 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") + +cc_library( + name = "request_response_types", + hdrs = ["request_and_response_types.hpp"], +) + +## C++ untyped API client +cc_binary( + name = "iox-cpp-request-response-untyped-client", + srcs = [ + "client_cxx_untyped.cpp", + ], + deps = [ + ":request_response_types", + "//iceoryx_posh", + ], +) + +## C++ untyped API server +cc_binary( + name = "iox-cpp-request-response-untyped-server", + srcs = [ + "server_cxx_untyped.cpp", + ], + deps = [ + ":request_response_types", + "//iceoryx_posh", + ], +) + +## C++ typed API client +cc_binary( + name = "iox-cpp-request-response-basic-client", + srcs = [ + "client_cxx_basic.cpp", + ], + deps = [ + ":request_response_types", + "//iceoryx_posh", + ], +) + +## C++ typed API client with WaitSet +cc_binary( + name = "iox-cpp-request-response-waitset-client", + srcs = [ + "client_cxx_waitset.cpp", + ], + deps = [ + ":request_response_types", + "//iceoryx_posh", + ], +) + +## C++ typed API server +cc_binary( + name = "iox-cpp-request-response-basic-server", + srcs = [ + "server_cxx_basic.cpp", + ], + deps = [ + ":request_response_types", + "//iceoryx_posh", + ], +) + +## C++ typed API server with Listener +cc_binary( + name = "iox-cpp-request-response-listener-server", + srcs = [ + "server_cxx_listener.cpp", + ], + deps = [ + ":request_response_types", + "//iceoryx_posh", + ], +) diff --git a/iceoryx_examples/request_response_in_c/BUILD.bazel b/iceoryx_examples/request_response_in_c/BUILD.bazel new file mode 100644 index 0000000000..63c0f6c5b1 --- /dev/null +++ b/iceoryx_examples/request_response_in_c/BUILD.bazel @@ -0,0 +1,62 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary") + +additional_c_header = [ + "sleep_for.h", + "request_and_response_c_types.h", +] + +cc_binary( + name = "iox-c-request-response-client-basic", + srcs = [ + "client_c_basic.c", + ] + additional_c_header, + deps = [ + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-request-response-client-waitset", + srcs = [ + "client_c_waitset.c", + ] + additional_c_header, + deps = [ + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-request-response-server-basic", + srcs = [ + "server_c_basic.c", + ] + additional_c_header, + deps = [ + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-request-response-server-listener", + srcs = [ + "server_c_listener.c", + ] + additional_c_header, + deps = [ + "//iceoryx_binding_c", + ], +) diff --git a/iceoryx_examples/singleprocess/BUILD.bazel b/iceoryx_examples/singleprocess/BUILD.bazel new file mode 100644 index 0000000000..e6a944a40d --- /dev/null +++ b/iceoryx_examples/singleprocess/BUILD.bazel @@ -0,0 +1,28 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary") + +cc_binary( + name = "single_process", + srcs = [ + "single_process.cpp", + ], + deps = [ + "//iceoryx_posh", + "//iceoryx_posh:iceoryx_posh_roudi", + ], +) diff --git a/iceoryx_examples/user_header/BUILD.bazel b/iceoryx_examples/user_header/BUILD.bazel new file mode 100644 index 0000000000..d67f97c425 --- /dev/null +++ b/iceoryx_examples/user_header/BUILD.bazel @@ -0,0 +1,91 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") + +cc_binary( + name = "iox-cpp-user-header-publisher", + srcs = [ + "publisher_cxx_api.cpp", + "user_header_and_payload_types.hpp", + ], + deps = [ + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-user-header-untyped-publisher", + srcs = [ + "publisher_untyped_cxx_api.cpp", + "user_header_and_payload_types.hpp", + ], + deps = [ + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-user-header-subscriber", + srcs = [ + "subscriber_cxx_api.cpp", + "user_header_and_payload_types.hpp", + ], + deps = [ + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-cpp-user-header-untyped-subscriber", + srcs = [ + "subscriber_untyped_cxx_api.cpp", + "user_header_and_payload_types.hpp", + ], + deps = [ + "//iceoryx_posh", + ], +) + +cc_library( + name = "additional_c_header", + hdrs = [ + "sleep_for.h", + "user_header_and_payload_types.h", + ], +) + +cc_binary( + name = "iox-c-user-header-publisher", + srcs = [ + "publisher_c_api.c", + ], + deps = [ + ":additional_c_header", + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-user-header-subscriber", + srcs = [ + "subscriber_c_api.c", + ], + deps = [ + ":additional_c_header", + "//iceoryx_binding_c", + ], +) diff --git a/iceoryx_examples/waitset/BUILD.bazel b/iceoryx_examples/waitset/BUILD.bazel new file mode 100644 index 0000000000..347a61ecc8 --- /dev/null +++ b/iceoryx_examples/waitset/BUILD.bazel @@ -0,0 +1,44 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") + +cc_library( + name = "topic_data", + hdrs = ["topic_data.hpp"], +) + +waitset_types = [ + "publisher", + "gateway", + "grouping", + "individual", + "timer_driven_execution", + "trigger", + "basic", +] + +[ + cc_binary( + name = "iox-cpp-waitset-" + type, + srcs = ["ice_waitset_" + type + ".cpp"], + deps = [ + ":topic_data", + "//iceoryx_posh", + ], + ) + for type in waitset_types +] diff --git a/iceoryx_examples/waitset_in_c/BUILD.bazel b/iceoryx_examples/waitset_in_c/BUILD.bazel new file mode 100644 index 0000000000..ad3c8e67b8 --- /dev/null +++ b/iceoryx_examples/waitset_in_c/BUILD.bazel @@ -0,0 +1,80 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") + +cc_library( + name = "additional_c_header", + hdrs = [ + "sleep_for.h", + "topic_data.h", + ], +) + +cc_binary( + name = "iox-c-waitset-publisher", + srcs = [ + "ice_c_waitset_publisher.c", + ], + deps = [ + ":additional_c_header", + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-waitset-gateway", + srcs = [ + "ice_c_waitset_gateway.c", + ], + deps = [ + ":additional_c_header", + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-waitset-grouping", + srcs = [ + "ice_c_waitset_grouping.c", + ], + deps = [ + ":additional_c_header", + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-waitset-individual", + srcs = [ + "ice_c_waitset_individual.c", + ], + deps = [ + ":additional_c_header", + "//iceoryx_binding_c", + ], +) + +cc_binary( + name = "iox-c-waitset-timer-driven-execution", + srcs = [ + "ice_c_waitset_timer_driven_execution.c", + ], + deps = [ + ":additional_c_header", + "//iceoryx_binding_c", + ], +) diff --git a/iceoryx_hoofs/BUILD.bazel b/iceoryx_hoofs/BUILD.bazel new file mode 100644 index 0000000000..7b627da20d --- /dev/null +++ b/iceoryx_hoofs/BUILD.bazel @@ -0,0 +1,53 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_library") + +cc_library( + name = "iceoryx_hoofs", + srcs = glob([ + "source/**/*.cpp", + "source/**/*.hpp", + ]), + hdrs = glob(["include/**"]), + linkopts = select({ + "//iceoryx_hoofs/platform:linux-clang": [ + "-latomic", + "-lacl", + ], + "//iceoryx_hoofs/platform:linux-gcc": ["-lacl"], + "//iceoryx_hoofs/platform:mac": [], + "//iceoryx_hoofs/platform:qnx": [], + "//iceoryx_hoofs/platform:unix": [], + "//iceoryx_hoofs/platform:win": [], + "//conditions:default": ["-lacl"], + }), + strip_include_prefix = "include", + visibility = ["//visibility:public"], + deps = ["//iceoryx_hoofs/platform:iceoryx_platform"], +) + +cc_library( + name = "iceoryx_hoofs_testing", + srcs = glob(["testing/**/*.cpp"]), + hdrs = glob(["testing/include/**"]), + strip_include_prefix = "testing/include", + visibility = ["//visibility:public"], + deps = [ + ":iceoryx_hoofs", + "@googletest//:gtest", + ], +) diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/cxx/string.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/cxx/string.hpp index bbb088b592..8153b4860b 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/cxx/string.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/cxx/string.hpp @@ -17,9 +17,9 @@ #ifndef IOX_HOOFS_CXX_STRING_HPP #define IOX_HOOFS_CXX_STRING_HPP +#include "iceoryx_hoofs/cxx/optional.hpp" #include "iceoryx_hoofs/cxx/type_traits.hpp" #include "iceoryx_hoofs/internal/cxx/string_internal.hpp" -#include "optional.hpp" #include #include diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/buffer.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/buffer.hpp index ba4c6a97eb..ed222c7ad5 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/buffer.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/buffer.hpp @@ -61,6 +61,6 @@ class Buffer } // namespace concurrent } // namespace iox -#include "buffer.inl" +#include "iceoryx_hoofs/internal/concurrent/lockfree_queue/buffer.inl" #endif // IOX_HOOFS_CONCURRENT_LOCKFREE_QUEUE_BUFFER_HPP diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/cyclic_index.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/cyclic_index.hpp index b84c65c0be..45c8dac649 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/cyclic_index.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/cyclic_index.hpp @@ -90,6 +90,6 @@ class CyclicIndex } // namespace concurrent } // namespace iox -#include "cyclic_index.inl" +#include "iceoryx_hoofs/internal/concurrent/lockfree_queue/cyclic_index.inl" #endif // IOX_HOOFS_LOCKFREE_QUEUE_CYCLIC_INDEX_HPP diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/index_queue.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/index_queue.hpp index b3c2e78271..74a0e278ff 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/index_queue.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/lockfree_queue/index_queue.hpp @@ -148,6 +148,6 @@ class IndexQueue } // namespace concurrent } // namespace iox -#include "index_queue.inl" +#include "iceoryx_hoofs/internal/concurrent/lockfree_queue/index_queue.inl" #endif // IOX_HOOFS_LOCKFREE_QUEUE_INDEX_QUEUE_HPP diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/base_relative_pointer.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/base_relative_pointer.hpp index e75dbc56c8..d847cbda03 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/base_relative_pointer.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/base_relative_pointer.hpp @@ -18,7 +18,7 @@ #ifndef IOX_HOOFS_RELOCATABLE_POINTER_BASE_RELATIVE_POINTER_HPP #define IOX_HOOFS_RELOCATABLE_POINTER_BASE_RELATIVE_POINTER_HPP -#include "pointer_repository.hpp" +#include "iceoryx_hoofs/internal/relocatable_pointer/pointer_repository.hpp" #include diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/relative_pointer.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/relative_pointer.hpp index 4ef03a23b4..d92aca1ad8 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/relative_pointer.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/relocatable_pointer/relative_pointer.hpp @@ -18,7 +18,7 @@ #ifndef IOX_HOOFS_RELOCATABLE_POINTER_RELATIVE_POINTER_HPP #define IOX_HOOFS_RELOCATABLE_POINTER_RELATIVE_POINTER_HPP -#include "base_relative_pointer.hpp" +#include "iceoryx_hoofs/internal/relocatable_pointer/base_relative_pointer.hpp" #include #include diff --git a/iceoryx_hoofs/platform/BUILD.bazel b/iceoryx_hoofs/platform/BUILD.bazel new file mode 100644 index 0000000000..d771e6eee1 --- /dev/null +++ b/iceoryx_hoofs/platform/BUILD.bazel @@ -0,0 +1,91 @@ +load("@rules_cc//cc:defs.bzl", "cc_library") + +# +# Config & Platform support +# +config_setting( + name = "linux", + constraint_values = ["@platforms//os:linux"], +) + +config_setting( + name = "qnx", + constraint_values = ["@platforms//os:qnx"], +) + +config_setting( + name = "mac", + constraint_values = ["@platforms//os:osx"], +) + +config_setting( + name = "win", + constraint_values = ["@platforms//os:windows"], +) + +config_setting( + name = "unix", + constraint_values = ["@platforms//os:freebsd"], +) + +config_setting( + name = "linux-clang", + constraint_values = ["@platforms//os:linux"], + flag_values = {"@bazel_tools//tools/cpp:compiler": "clang"}, +) + +config_setting( + name = "linux-gcc", + constraint_values = ["@platforms//os:linux"], + flag_values = {"@bazel_tools//tools/cpp:compiler": "gcc"}, +) + +# +# Library: iceoryx_platform +# +cc_library( + name = "iceoryx_platform", + srcs = select({ + ":linux": glob(["linux/source/**"]), + ":mac": glob(["mac/source/**"]), + ":qnx": glob(["qnx/source/**"]), + ":unix": glob(["unix/source/**"]), + ":win": glob(["win/source/**"]), + "//conditions:default": glob(["linux/source/**"]), + }), + hdrs = select({ + ":linux": glob(["linux/include/**"]), + ":mac": glob(["mac/include/**"]), + ":qnx": glob(["qnx/include/**"]), + ":unix": glob(["unix/include/**"]), + ":win": glob(["win/include/**"]), + "//conditions:default": glob(["linux/include/**"]), + }), + includes = select({ + ":linux": ["linux/include"], + ":mac": ["mac/include/**"], + ":qnx": ["qnx/include"], + ":unix": ["unix/include/**"], + ":win": ["win/include/**"], + "//conditions:default": ["linux/include/**"], + }), + linkopts = select({ + ":linux": [ + "-lpthread", + "-lrt", + ], + ":mac": [], + ":qnx": ["-lsocket"], + ":unix": [ + "-lpthread", + "-lrt", + ], + ":win": [], + "//conditions:default": [ + "-lpthread", + "-lrt", + ], + }), + visibility = ["//visibility:public"], + deps = [], +) diff --git a/iceoryx_hoofs/test/BUILD.bazel b/iceoryx_hoofs/test/BUILD.bazel new file mode 100644 index 0000000000..8e8ba241a6 --- /dev/null +++ b/iceoryx_hoofs/test/BUILD.bazel @@ -0,0 +1,65 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_test") + +cc_test( + name = "hoofs_moduletests", + srcs = glob([ + "moduletests/*.cpp", + "moduletests/*.hpp", + "*.hpp", + ]), + includes = [ + ".", + "moduletests", + ], + linkopts = select({ + "//iceoryx_hoofs/platform:linux": ["-ldl"], + "//iceoryx_hoofs/platform:mac": [], + "//iceoryx_hoofs/platform:qnx": [], + "//iceoryx_hoofs/platform:unix": [], + "//iceoryx_hoofs/platform:win": [], + "//conditions:default": ["-ldl"], + }), + tags = ["exclusive"], + visibility = ["//visibility:private"], + deps = ["//iceoryx_hoofs:iceoryx_hoofs_testing"], +) + +cc_test( + name = "hoofs_integrationtests", + srcs = glob([ + "integrationtests/*.cpp", + "integrationtests/*.hpp", + "*.hpp", + ]), + includes = [ + ".", + "integrationtests", + ], + linkopts = select({ + "//iceoryx_hoofs/platform:linux": ["-ldl"], + "//iceoryx_hoofs/platform:mac": [], + "//iceoryx_hoofs/platform:qnx": [], + "//iceoryx_hoofs/platform:unix": [], + "//iceoryx_hoofs/platform:win": [], + "//conditions:default": ["-ldl"], + }), + tags = ["exclusive"], + visibility = ["//visibility:private"], + deps = ["//iceoryx_hoofs:iceoryx_hoofs_testing"], +) diff --git a/iceoryx_hoofs/test/stresstests/BUILD.bazel b/iceoryx_hoofs/test/stresstests/BUILD.bazel new file mode 100644 index 0000000000..cf7ead1630 --- /dev/null +++ b/iceoryx_hoofs/test/stresstests/BUILD.bazel @@ -0,0 +1,33 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_test") + +cc_test( + name = "test_stress_sofi", + srcs = ["test_stress_sofi.cpp"], + linkopts = select({ + "//iceoryx_hoofs/platform:linux": ["-ldl"], + "//iceoryx_hoofs/platform:mac": [], + "//iceoryx_hoofs/platform:qnx": [], + "//iceoryx_hoofs/platform:unix": [], + "//iceoryx_hoofs/platform:win": [], + "//conditions:default": ["-ldl"], + }), + tags = ["exclusive"], + visibility = ["//visibility:private"], + deps = ["//iceoryx_hoofs:iceoryx_hoofs_testing"], +) diff --git a/iceoryx_posh/BUILD.bazel b/iceoryx_posh/BUILD.bazel new file mode 100644 index 0000000000..e32b1e09eb --- /dev/null +++ b/iceoryx_posh/BUILD.bazel @@ -0,0 +1,166 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") +load("//bazel:configure_file.bzl", "configure_file") +load("//bazel:configure_version.bzl", "configure_version") + +# +########## posh core lib ########## +# +configure_file( + name = "iceoryx_posh_deployment_hpp", + src = "cmake/iceoryx_posh_deployment.hpp.in", + out = "include/iceoryx_posh/iceoryx_posh_deployment.hpp", + config = { + # FIXME: for values see "iceoryx_posh/cmake/IceoryxPoshDeployment.cmake" ... for now some nice defaults + "IOX_COMMUNICATION_POLICY": "ManyToManyPolicy", + "IOX_INTERNAL_MAX_NUMBER_OF_NOTIFIERS": "256", + "IOX_MAX_CHUNKS_ALLOCATED_PER_PUBLISHER_SIMULTANEOUSLY": "8", + "IOX_MAX_CHUNKS_HELD_PER_SUBSCRIBER_SIMULTANEOUSLY": "256", + "IOX_MAX_INTERFACE_NUMBER": "4", + "IOX_MAX_PUBLISHERS": "512", + "IOX_MAX_PUBLISHER_HISTORY": "16", + "IOX_MAX_SUBSCRIBERS": "1024", + "IOX_MAX_SUBSCRIBERS_PER_PUBLISHER": "256", + }, +) + +configure_version( + name = "iceoryx_versions_hpp", + src = "cmake/iceoryx_versions.hpp.in", + out = "include/iceoryx_versions.hpp", + version_from = "//:VERSION", +) + +# +########## posh lib ########## +# + +# Special file handling - part 1: Files which are part of "iceoryx_posh" (despite located in "roudi"-subdirectory) +iceory_posh_extra_roudi_files = [ + "source/roudi/service_registry.cpp", +] + +# Special file handling - part 2: Files which are part of "iceoryx_posh_config" +iceory_posh_config_files = [ + "source/log/posh_config_logging.cpp", + "source/gateway/gateway_config.cpp", + "source/gateway/toml_gateway_config_parser.cpp", + "source/roudi/roudi_config_toml_file_provider.cpp", +] + +# Special file handling - part 3: Files which are part of "iox-roudi" executable +iox_roudi_executable_files = [ + "source/roudi/application/roudi_main.cpp", +] + +cc_library( + name = "iceoryx_posh", + srcs = glob( + [ + "source/log/**", + "source/capro/**", + "source/error_handling/**", + "source/mepoo/**", + "source/popo/**", + "source/version/**", + "source/runtime/**", + ], + exclude = iceory_posh_config_files, + ) + + iceory_posh_extra_roudi_files, + hdrs = glob(["include/**"]) + [ + ":iceoryx_posh_deployment_hpp", + ":iceoryx_versions_hpp", + ], + strip_include_prefix = "include", + visibility = ["//visibility:public"], + deps = ["//iceoryx_hoofs"], +) + +# +########## posh lib for gateway support ########## +# +cc_library( + name = "iceoryx_posh_gateway", + srcs = glob( + ["source/gateway/**"], + exclude = iceory_posh_config_files, + ), + strip_include_prefix = "include", + visibility = ["//visibility:public"], + deps = [":iceoryx_posh"], +) + +# +########## posh roudi lib ########## +# + +cc_library( + name = "iceoryx_posh_roudi", + srcs = glob( + ["source/roudi/**"], + exclude = iceory_posh_extra_roudi_files + iceory_posh_config_files + iox_roudi_executable_files, + ), + strip_include_prefix = "include", + visibility = ["//visibility:public"], + deps = [":iceoryx_posh"], +) + +# +######### posh config lib ########## +# +cc_library( + name = "iceoryx_posh_config", + srcs = iceory_posh_config_files, + strip_include_prefix = "include", + visibility = ["//visibility:public"], + deps = [ + ":iceoryx_posh", + "@cpptoml", + ], +) + +# +######### posh roudi daemon ########## +# +cc_binary( + name = "iox-roudi", + srcs = iox_roudi_executable_files, + visibility = ["//visibility:public"], + deps = [ + ":iceoryx_posh_config", + ":iceoryx_posh_roudi", + ], +) + +# +########## build iceoryx posh testing lib ########## +# +cc_library( + name = "iceoryx_posh_testing", + srcs = glob(["testing/**/*.cpp"]), + hdrs = glob(["testing/include/**"]), + strip_include_prefix = "testing/include", + visibility = ["//visibility:public"], + deps = [ + ":iceoryx_posh", + ":iceoryx_posh_roudi", + "//iceoryx_hoofs:iceoryx_hoofs_testing", + "@googletest//:gtest", + ], +) diff --git a/iceoryx_posh/test/BUILD.bazel b/iceoryx_posh/test/BUILD.bazel new file mode 100644 index 0000000000..6117da0c94 --- /dev/null +++ b/iceoryx_posh/test/BUILD.bazel @@ -0,0 +1,91 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_test") +load("//bazel:configure_file.bzl", "configure_file") + +configure_file( + name = "test_input_path_hpp", + src = "moduletests/test_input_path.hpp.in", + out = "iceoryx/tests/posh/moduletests/test_input_path.hpp", + config = { + "POSH_TEST_INPUT_FILES_PATH": "iceoryx_posh/test/input/", + }, +) + +cc_test( + name = "posh_moduletests", + srcs = glob([ + "moduletests/*.cpp", + "moduletests/*.hpp", + "mocks/*.hpp", + "stubs/*.hpp", + "*.hpp", + ]) + [":test_input_path_hpp"], + data = glob(["input/**"]), + includes = [ + ".", + "mocks", + "moduletests", + "stubs", + ], + linkopts = select({ + "//iceoryx_hoofs/platform:linux": ["-ldl"], + "//iceoryx_hoofs/platform:mac": [], + "//iceoryx_hoofs/platform:qnx": [], + "//iceoryx_hoofs/platform:unix": [], + "//iceoryx_hoofs/platform:win": [], + "//conditions:default": ["-ldl"], + }), + tags = ["exclusive"], + visibility = ["//visibility:private"], + deps = [ + "//iceoryx_hoofs:iceoryx_hoofs_testing", + "//iceoryx_posh", + "//iceoryx_posh:iceoryx_posh_config", + "//iceoryx_posh:iceoryx_posh_testing", + "@cpptoml", + ], +) + +cc_test( + name = "posh_integrationtests", + srcs = glob([ + "integrationtests/*.cpp", + "integrationtests/*.hpp", + "*.hpp", + ]), + includes = [ + ".", + "integrationtests", + ], + linkopts = select({ + "//iceoryx_hoofs/platform:linux": ["-ldl"], + "//iceoryx_hoofs/platform:mac": [], + "//iceoryx_hoofs/platform:qnx": [], + "//iceoryx_hoofs/platform:unix": [], + "//iceoryx_hoofs/platform:win": [], + "//conditions:default": ["-ldl"], + }), + tags = ["exclusive"], + visibility = ["//visibility:private"], + deps = [ + "//iceoryx_hoofs:iceoryx_hoofs_testing", + "//iceoryx_posh", + "//iceoryx_posh:iceoryx_posh_gateway", + "//iceoryx_posh:iceoryx_posh_testing", + ], +) diff --git a/tools/introspection/BUILD.bazel b/tools/introspection/BUILD.bazel new file mode 100644 index 0000000000..3a1a136bf3 --- /dev/null +++ b/tools/introspection/BUILD.bazel @@ -0,0 +1,49 @@ +# Copyright (c) 2022 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") + +cc_library( + name = "iceoryx_introspection", + srcs = [ + "source/iceoryx_introspection_app.cpp", + "source/introspection_app.cpp", + ], + hdrs = glob(["include/iceoryx_introspection/**"]), + linkopts = ["-lncurses"], + strip_include_prefix = "include", + #Windows does not offer ncurses, therefore we do not build the lib + target_compatible_with = select({ + "@platforms//os:windows": ["@platforms//:incompatible"], + "//conditions:default": [], + }), + visibility = ["//visibility:public"], + deps = [ + "//iceoryx_posh", + ], +) + +cc_binary( + name = "iox-introspection-client", + srcs = [ + "source/introspection_main.cpp", + ], + visibility = ["//visibility:public"], + deps = [ + ":iceoryx_introspection", + "//iceoryx_posh", + ], +)