mirror of
https://github.com/bazel-contrib/rules_foreign_cc
synced 2024-11-25 17:31:25 +00:00
Build rules for interfacing with "foreign" (non-Bazel) build systems (CMake, configure-make, GNU Make, boost, ninja, Meson)
https://bazel-contrib.github.io/rules_foreign_cc/
0fd3a22fbc
* external build framework macro and cmake_external rule * declare deps headers as inputs as well; correct sed expression * use symlinking instead of copying, filter duplicates * correct detect root * corrections for copying tools and include directories * correct review comments * provide a way to pass modified attributes to the framework function create a function that creates a dict from ctx.attr, replaces/adds values and creates a resulting struct; have mandatory attributes as mandatory parameters to this function * correct review comments * correct detect_root * introduce parameter for passing user defined link options * add documentation, define default static library to be built * correct/improve documentation * more correct gathering headers and include directories from dependencies * correct review comments * correct passing transitive link options |
||
---|---|---|
.bazelci | ||
cc_configure_make | ||
examples/cc_configure_make | ||
framework_example/cmake | ||
tools/build_defs | ||
AUTHORS | ||
CONTRIBUTING.md | ||
LICENSE | ||
README.md | ||
WORKSPACE |
rules_foreign_cc
Rules for building projects using foreign build systems inside Bazel projects.
- Experimental - API will most definitely change.
- This is not an officially supported Google product (meaning, support and/or new releases may be limited.)
./configure && make
NOTE: this requires building Bazel from head after 060b1624e4
Example:
- In
WORKSPACE
, we use anew_http_archive
to download tarballs with the libraries we use. - In
BUILD
, we instantiate acc_configure_make_library
macro which behaves similarly to acc_library
, which can then be used in a C++ rule (cc_binary
in this case).
In WORKSPACE
, put
new_http_archive(
name = "libevent",
build_file_content = """filegroup(name = "all", srcs = glob(["**"]), visibility = ["//visibility:public"])""",
strip_prefix = "libevent-2.1.8-stable",
urls = ["https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz"],
)
and in BUILD
, put
cc_configure_make(
name = "libevent",
src = "@libevent//:all",
configure_flags = [
"--enable-shared=no",
"--disable-libevent-regress",
"--disable-openssl",
],
out_lib_path = "lib/libevent.a",
)
cc_binary(
name = "libevent_echosrv1",
srcs = ["libevent_echosrv1.c"],
deps = [":libevent"],
)
then build as usual:
$ devbazel build //:libevent_echosrv1