Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iox-#2372: Depend on @ncurses when building with Bazel #2373

Merged
merged 3 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ bazel_dep(
dev_dependency = True,
)
bazel_dep(name = "googletest", version = "1.15.2", dev_dependency = True)

bazel_dep(name = "ncurses", version = "6.4.20221231")
10 changes: 10 additions & 0 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,13 @@ load_repositories()
load("//bazel:setup_repositories.bzl", "setup_repositories")

setup_repositories()

load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")

# This sets up some common toolchains for building targets. For more details, please see
# https://bazelbuild.github.io/rules_foreign_cc/0.12.0/flatten.html#rules_foreign_cc_dependencies
rules_foreign_cc_dependencies()

load("@bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()
2 changes: 2 additions & 0 deletions bazel/load_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ load("//bazel/bazelbuild:repositories.bzl", "load_com_github_bazelbuild_rules_cc
load("//bazel/buildifier_prebuilt:repositories.bzl", "load_buildifier_prebuilt_repositories")
load("//bazel/cpptoml:repositories.bzl", "load_cpptoml_repositories")
load("//bazel/googletest:repositories.bzl", "load_googletest_repositories")
load("//bazel/ncurses:repositories.bzl", "load_ncurses_repositories")
load("//bazel/skylib:repositories.bzl", "load_bazel_skylib_repositories")

def load_repositories():
Expand All @@ -31,3 +32,4 @@ def load_repositories():
load_buildifier_prebuilt_repositories()
load_googletest_repositories()
load_cpptoml_repositories()
load_ncurses_repositories()
Empty file added bazel/ncurses/BUILD.bazel
Empty file.
39 changes: 39 additions & 0 deletions bazel/ncurses/ncurses.BUILD
elBoberido marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright (c) 2024 by Fernride GmbH. 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_foreign_cc//foreign_cc:defs.bzl", "configure_make")

filegroup(
name = "all_srcs",
srcs = glob(["**"]),
)

configure_make(
name = "ncurses",
args = ["-j"],
configure_options = [
"--without-debug",
"--without-ada",
"--without-tests",
"--enable-overwrite",
],
lib_source = ":all_srcs",
out_static_libs = [
"libncurses.a",
"libcurses.a",
],
visibility = ["//visibility:public"],
)
37 changes: 37 additions & 0 deletions bazel/ncurses/repositories.bzl
elBoberido marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (c) 2024 by Fernride GmbH. 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 prepares the ncurses dependency."""

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

def load_ncurses_repositories():
maybe(
http_archive,
name = "rules_foreign_cc",
sha256 = "a2e6fb56e649c1ee79703e99aa0c9d13c6cc53c8d7a0cbb8797ab2888bbc99a3",
strip_prefix = "rules_foreign_cc-0.12.0",
url = "https://github.com/bazelbuild/rules_foreign_cc/releases/download/0.12.0/rules_foreign_cc-0.12.0.tar.gz",
)
maybe(
http_archive,
name = "ncurses",
url = "https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.3.tar.gz",
sha256 = "97fc51ac2b085d4cde31ef4d2c3122c21abc217e9090a43a30fc5ec21684e059",
strip_prefix = "ncurses-6.3",
build_file = "//bazel/ncurses:ncurses.BUILD",
)
1 change: 1 addition & 0 deletions doc/website/release-notes/iceoryx-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
- ssize_t: redefinition; different basic types [#2209](https://github.com/eclipse-iceoryx/iceoryx/issues/2209)
- Fix bazel build on macos [#2345](https://github.com/eclipse-iceoryx/iceoryx/issues/2345)
- Fix Bzlmod module name typo [#2364](https://github.com/eclipse-iceoryx/iceoryx/issues/2364)
- Depend on @ncurses when building with Bazel [#2372](https://github.com/eclipse-iceoryx/iceoryx/issues/2372)

**Refactoring:**

Expand Down
2 changes: 1 addition & 1 deletion tools/introspection/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ cc_library(
"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({
Expand All @@ -33,6 +32,7 @@ cc_library(
visibility = ["//visibility:public"],
deps = [
"//iceoryx_posh",
"@ncurses",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include "iceoryx_platform/getopt.hpp"
#include "iceoryx_posh/popo/subscriber.hpp"

#include <curses.h>
#include <map>
#include <ncurses.h>
#include <vector>

namespace iox
Expand Down