__init__.py 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. from devtools.yamaker import fileutil
  2. from devtools.yamaker.modules import GLOBAL, Linkable, Switch
  3. from devtools.yamaker.project import CMakeNinjaNixProject
  4. def post_install(self):
  5. with self.yamakes["."] as libre2:
  6. # TString support will be added by patches
  7. libre2.NO_UTIL = False
  8. libre2.before("SRCS", Switch(WITH_VALGRIND=Linkable(CFLAGS=[GLOBAL("-DRE2_ON_VALGRIND")])))
  9. libre2.PEERDIR.add("library/cpp/sanitizer/include")
  10. with self.yamakes["re2/testing"] as test:
  11. test.module = "GTEST"
  12. test.GTEST = ""
  13. # fmt: off
  14. test.PEERDIR = [
  15. peerdir
  16. for peerdir in test.PEERDIR
  17. if "contrib/restricted/googletest" not in peerdir
  18. ]
  19. # fmt: on
  20. fileutil.re_sub_dir(
  21. f"{self.dstdir}/re2/testing",
  22. "util/test.h",
  23. "library/cpp/testing/gtest/gtest.h",
  24. )
  25. test.EXPLICIT_DATA = True
  26. re2 = CMakeNinjaNixProject(
  27. owners=["g:cpp-contrib"],
  28. nixattr="re2",
  29. arcdir="contrib/libs/re2",
  30. ignore_targets=[
  31. "exhaustive_test",
  32. "exhaustive1_test",
  33. "exhaustive2_test",
  34. "exhaustive3_test",
  35. "random_test",
  36. "regexp_benchmark",
  37. ],
  38. # merge all tests together and put ya.make into re2/testing
  39. # We will change test framework to GTEST during post_install
  40. put={
  41. "re2": ".",
  42. "testing": "re2/testing",
  43. },
  44. put_with={
  45. "testing": [
  46. "charclass_test",
  47. "compile_test",
  48. "dfa_test",
  49. "filtered_re2_test",
  50. "mimics_pcre_test",
  51. "parse_test",
  52. "possible_match_test",
  53. "re2_arg_test",
  54. "re2_test",
  55. "regexp_test",
  56. "required_prefix_test",
  57. "search_test",
  58. "set_test",
  59. "simplify_test",
  60. "string_generator_test",
  61. ],
  62. },
  63. use_provides=[
  64. "contrib/restricted/abseil-cpp/.yandex_meta",
  65. ],
  66. post_install=post_install,
  67. # Default re2 cmake build provides TARGET_INCLUDE_DIRECTORIES
  68. # which yamaker handles by default, exposing entire contrib/libs/re2 via ADDINCL GLOBAL.
  69. #
  70. # We do not want this to happen, hence we disable this option handling and inclink target headers into include/ directory instead,
  71. # which we then expose by the means of ADDINCL GLOBAL.
  72. addincl_global={
  73. ".": ["./include"],
  74. },
  75. inclink={
  76. "include/re2": [
  77. "re2/re2.h",
  78. "re2/stringpiece.h",
  79. ],
  80. "include/util": [
  81. "util/logging.h",
  82. "util/utf.h",
  83. ],
  84. },
  85. disable_includes=[
  86. # ifdef USEPCRE
  87. "pcre.h",
  88. # ifdef RE2_USE_ICU
  89. "unicode/",
  90. ],
  91. write_public_incs=False,
  92. )