BUILD.bazel 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
  2. expand_template(
  3. name = "catch_user_config",
  4. out = "catch2/catch_user_config.hpp",
  5. substitutions = {
  6. "@CATCH_CONFIG_CONSOLE_WIDTH@": "80",
  7. "@CATCH_CONFIG_DEFAULT_REPORTER@": "console",
  8. "#cmakedefine CATCH_CONFIG_ANDROID_LOGWRITE": "",
  9. "#cmakedefine CATCH_CONFIG_BAZEL_SUPPORT": "#define CATCH_CONFIG_BAZEL_SUPPORT",
  10. "#cmakedefine CATCH_CONFIG_COLOUR_WIN32": "",
  11. "#cmakedefine CATCH_CONFIG_COUNTER": "",
  12. "#cmakedefine CATCH_CONFIG_CPP11_TO_STRING": "",
  13. "#cmakedefine CATCH_CONFIG_CPP17_BYTE": "",
  14. "#cmakedefine CATCH_CONFIG_CPP17_OPTIONAL": "",
  15. "#cmakedefine CATCH_CONFIG_CPP17_STRING_VIEW": "",
  16. "#cmakedefine CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS": "",
  17. "#cmakedefine CATCH_CONFIG_CPP17_VARIANT": "",
  18. "#cmakedefine CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER": "",
  19. "#cmakedefine CATCH_CONFIG_DISABLE_EXCEPTIONS": "",
  20. "#cmakedefine CATCH_CONFIG_DISABLE_STRINGIFICATION": "",
  21. "#cmakedefine CATCH_CONFIG_DISABLE": "",
  22. "#cmakedefine CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS": "",
  23. "#cmakedefine CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER": "",
  24. "#cmakedefine CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER": "",
  25. "#cmakedefine CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER": "",
  26. "#cmakedefine CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER": "",
  27. "#cmakedefine CATCH_CONFIG_EXPERIMENTAL_REDIRECT": "",
  28. "#cmakedefine CATCH_CONFIG_FALLBACK_STRINGIFIER @CATCH_CONFIG_FALLBACK_STRINGIFIER@": "",
  29. "#cmakedefine CATCH_CONFIG_FAST_COMPILE": "",
  30. "#cmakedefine CATCH_CONFIG_GLOBAL_NEXTAFTER": "",
  31. "#cmakedefine CATCH_CONFIG_NO_ANDROID_LOGWRITE": "",
  32. "#cmakedefine CATCH_CONFIG_NO_COLOUR_WIN32": "",
  33. "#cmakedefine CATCH_CONFIG_NO_COUNTER": "",
  34. "#cmakedefine CATCH_CONFIG_NO_CPP11_TO_STRING": "",
  35. "#cmakedefine CATCH_CONFIG_NO_CPP17_BYTE": "",
  36. "#cmakedefine CATCH_CONFIG_NO_CPP17_OPTIONAL": "",
  37. "#cmakedefine CATCH_CONFIG_NO_CPP17_STRING_VIEW": "",
  38. "#cmakedefine CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS": "",
  39. "#cmakedefine CATCH_CONFIG_NO_CPP17_VARIANT": "",
  40. "#cmakedefine CATCH_CONFIG_NO_GLOBAL_NEXTAFTER": "",
  41. "#cmakedefine CATCH_CONFIG_NO_POSIX_SIGNALS": "",
  42. "#cmakedefine CATCH_CONFIG_NO_USE_ASYNC": "",
  43. "#cmakedefine CATCH_CONFIG_NO_WCHAR": "",
  44. "#cmakedefine CATCH_CONFIG_NO_WINDOWS_SEH": "",
  45. "#cmakedefine CATCH_CONFIG_NOSTDOUT": "",
  46. "#cmakedefine CATCH_CONFIG_POSIX_SIGNALS": "",
  47. "#cmakedefine CATCH_CONFIG_PREFIX_ALL": "",
  48. "#cmakedefine CATCH_CONFIG_SHARED_LIBRARY": "",
  49. "#cmakedefine CATCH_CONFIG_USE_ASYNC": "",
  50. "#cmakedefine CATCH_CONFIG_WCHAR": "",
  51. "#cmakedefine CATCH_CONFIG_WINDOWS_CRTDBG": "",
  52. "#cmakedefine CATCH_CONFIG_WINDOWS_SEH": "",
  53. },
  54. template = "src/catch2/catch_user_config.hpp.in",
  55. )
  56. # Generated header library, modifies the include prefix to account for
  57. # generation path so that we can include <catch2/catch_user_config.hpp>
  58. # correctly.
  59. cc_library(
  60. name = "catch2_generated",
  61. hdrs = ["catch2/catch_user_config.hpp"],
  62. include_prefix = ".", # to manipulate -I of dependenices
  63. visibility = ["//visibility:public"],
  64. )
  65. # Static library, without main.
  66. cc_library(
  67. name = "catch2",
  68. srcs = glob(
  69. ["src/catch2/**/*.cpp"],
  70. exclude = ["src/catch2/internal/catch_main.cpp"],
  71. ),
  72. hdrs = glob(["src/catch2/**/*.hpp"]),
  73. includes = ["src/"],
  74. linkstatic = True,
  75. visibility = ["//visibility:public"],
  76. deps = [":catch2_generated"],
  77. )
  78. # Static library, with main.
  79. cc_library(
  80. name = "catch2_main",
  81. srcs = ["src/catch2/internal/catch_main.cpp"],
  82. includes = ["src/"],
  83. linkstatic = True,
  84. visibility = ["//visibility:public"],
  85. deps = [":catch2"],
  86. )