ya.make 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. LIBRARY()
  2. SET(antlr_output ${ARCADIA_BUILD_ROOT}/${MODDIR})
  3. SET(antlr_templates ${antlr_output}/org/antlr/codegen/templates)
  4. SET(sql_grammar ${antlr_output}/SQLv1.g)
  5. SET(ANTLR_PACKAGE_NAME NSQLv1Generated)
  6. CONFIGURE_FILE(${ARCADIA_ROOT}/yql/essentials/parser/proto_ast/org/antlr/codegen/templates/protobuf/protobuf.stg.in ${antlr_templates}/protobuf/protobuf.stg)
  7. IF(EXPORT_CMAKE)
  8. MANUAL_GENERATION(${sql_grammar})
  9. ELSE()
  10. # For exporting CMake this vars fill in epilogue.cmake
  11. SET(GRAMMAR_STRING_CORE_SINGLE "\"~(QUOTE_SINGLE | BACKSLASH) | (BACKSLASH .)\"")
  12. SET(GRAMMAR_STRING_CORE_DOUBLE "\"~(QUOTE_DOUBLE | BACKSLASH) | (BACKSLASH .)\"")
  13. SET(GRAMMAR_MULTILINE_COMMENT_CORE "\".\"")
  14. CONFIGURE_FILE(${ARCADIA_ROOT}/yql/essentials/sql/v1/SQLv1.g.in ${sql_grammar})
  15. ENDIF()
  16. RUN_ANTLR(
  17. ${sql_grammar}
  18. -lib .
  19. -fo ${antlr_output}
  20. -language protobuf
  21. IN ${sql_grammar} ${antlr_templates}/protobuf/protobuf.stg
  22. OUT_NOAUTO SQLv1Parser.proto
  23. CWD ${antlr_output}
  24. )
  25. IF (USE_VANILLA_PROTOC)
  26. SET(PROTOC_PATH contrib/tools/protoc_std)
  27. PEERDIR(contrib/libs/protobuf_std)
  28. ELSE()
  29. SET(PROTOC_PATH contrib/tools/protoc/bin)
  30. PEERDIR(contrib/libs/protobuf)
  31. ENDIF()
  32. RUN_PROGRAM(
  33. $PROTOC_PATH -I=${CURDIR} -I=${ARCADIA_ROOT} -I=${ARCADIA_BUILD_ROOT} -I=${ARCADIA_ROOT}/contrib/libs/protobuf/src
  34. --cpp_out=${ARCADIA_BUILD_ROOT} --cpp_styleguide_out=${ARCADIA_BUILD_ROOT}
  35. --plugin=protoc-gen-cpp_styleguide=contrib/tools/protoc/plugins/cpp_styleguide
  36. SQLv1Parser.proto
  37. IN SQLv1Parser.proto
  38. TOOL contrib/tools/protoc/plugins/cpp_styleguide
  39. OUT_NOAUTO SQLv1Parser.pb.h SQLv1Parser.pb.cc
  40. CWD ${antlr_output}
  41. )
  42. RUN_PYTHON3(
  43. ${ARCADIA_ROOT}/yql/essentials/parser/proto_ast/gen/multiproto.py SQLv1Parser
  44. IN SQLv1Parser.pb.h
  45. IN SQLv1Parser.pb.cc
  46. OUT_NOAUTO
  47. SQLv1Parser.pb.code0.cc
  48. SQLv1Parser.pb.code1.cc
  49. SQLv1Parser.pb.code2.cc
  50. SQLv1Parser.pb.code3.cc
  51. SQLv1Parser.pb.code4.cc
  52. SQLv1Parser.pb.code5.cc
  53. SQLv1Parser.pb.code6.cc
  54. SQLv1Parser.pb.code7.cc
  55. SQLv1Parser.pb.code8.cc
  56. SQLv1Parser.pb.code9.cc
  57. SQLv1Parser.pb.data.cc
  58. SQLv1Parser.pb.classes.h
  59. SQLv1Parser.pb.main.h
  60. CWD ${antlr_output}
  61. )
  62. SRCS(
  63. SQLv1Parser.pb.code0.cc
  64. SQLv1Parser.pb.code1.cc
  65. SQLv1Parser.pb.code2.cc
  66. SQLv1Parser.pb.code3.cc
  67. SQLv1Parser.pb.code4.cc
  68. SQLv1Parser.pb.code5.cc
  69. SQLv1Parser.pb.code6.cc
  70. SQLv1Parser.pb.code7.cc
  71. SQLv1Parser.pb.code8.cc
  72. SQLv1Parser.pb.code9.cc
  73. SQLv1Parser.pb.data.cc
  74. )
  75. END()