mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-02 21:35:40 +02:00
Add default reporter for Bazel integration (#2399)
When the added Bazel configuration flag is enabled, a default JUnit reporter will be added if the XML envrioment variable is defined. Fix include paths for generated config header. Enable Bazel config by default when building with Bazel. Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
This commit is contained in:

committed by
GitHub

parent
4b78157981
commit
cb551b4f6d
36
BUILD.bazel
36
BUILD.bazel
@@ -1,13 +1,14 @@
|
||||
# Load the cc_library rule.
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
|
||||
|
||||
expand_template(
|
||||
name = "catch_user_config.hpp",
|
||||
name = "catch_user_config",
|
||||
out = "catch2/catch_user_config.hpp",
|
||||
substitutions = {
|
||||
"#cmakedefine CATCH_CONFIG_ANDROID_LOGWRITE": "",
|
||||
"#cmakedefine CATCH_CONFIG_BAZEL_SUPPORT": "#define CATCH_CONFIG_BAZEL_SUPPORT",
|
||||
"#cmakedefine CATCH_CONFIG_NO_COLOUR_WIN32": "",
|
||||
"#cmakedefine CATCH_CONFIG_COLOUR_WIN32": "",
|
||||
"#cmakedefine CATCH_CONFIG_COUNTER": "",
|
||||
"#cmakedefine CATCH_CONFIG_CPP11_TO_STRING": "",
|
||||
@@ -55,23 +56,36 @@ expand_template(
|
||||
template = "src/catch2/catch_user_config.hpp.in",
|
||||
)
|
||||
|
||||
# Generated header library, modifies the include prefix to account for
|
||||
# generation path so that we can include <catch2/catch_user_config.hpp>
|
||||
# correctly.
|
||||
cc_library(
|
||||
name = "catch2_generated",
|
||||
hdrs = ["catch2/catch_user_config.hpp"],
|
||||
include_prefix = ".", # to manipulate -I of dependenices
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Static library, without main.
|
||||
cc_library(
|
||||
name = "catch2",
|
||||
hdrs = glob(["src/catch2/**/*.hpp"]) + ["catch_user_config.hpp"],
|
||||
srcs = glob(["src/catch2/**/*.cpp"],
|
||||
exclude=[ "src/catch2/internal/catch_main.cpp"]),
|
||||
visibility = ["//visibility:public"],
|
||||
linkstatic = True,
|
||||
srcs = glob(
|
||||
["src/catch2/**/*.cpp"],
|
||||
exclude = ["src/catch2/internal/catch_main.cpp"],
|
||||
),
|
||||
hdrs = glob(["src/catch2/**/*.hpp"]),
|
||||
includes = ["src/"],
|
||||
linkstatic = True,
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [":catch2_generated"],
|
||||
)
|
||||
|
||||
# Static library, with main.
|
||||
cc_library(
|
||||
name = "catch2_main",
|
||||
srcs = ["src/catch2/internal/catch_main.cpp"],
|
||||
deps = [":catch2"],
|
||||
visibility = ["//visibility:public"],
|
||||
linkstatic = True,
|
||||
includes = ["src/"],
|
||||
)
|
||||
linkstatic = True,
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [":catch2"],
|
||||
)
|
Reference in New Issue
Block a user