ya.make 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. LIBRARY()
  2. PEERDIR (
  3. yql/essentials/parser/proto_ast/gen/v1_proto_split
  4. yql/essentials/parser/proto_ast/antlr4
  5. )
  6. SET(antlr_output ${ARCADIA_BUILD_ROOT}/${MODDIR})
  7. SET(antlr_templates ${antlr_output}/org/antlr/v4/tool/templates/codegen)
  8. SET(sql_grammar ${antlr_output}/SQLv1Antlr4.g)
  9. SET(ANTLR_PACKAGE_NAME NSQLv1Generated)
  10. SET(PROTOBUF_HEADER_PATH yql/essentials/parser/proto_ast/gen/v1_proto_split)
  11. SET(PROTOBUF_SUFFIX_PATH .pb.main.h)
  12. SET(LEXER_PARSER_NAMESPACE NALPDefaultAntlr4)
  13. CONFIGURE_FILE(${ARCADIA_ROOT}/yql/essentials/parser/proto_ast/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg.in ${antlr_templates}/Cpp/Cpp.stg)
  14. CONFIGURE_FILE(${ARCADIA_ROOT}/yql/essentials/parser/proto_ast/org/antlr/v4/tool/templates/codegen/Cpp/Files.stg.in ${antlr_templates}/Cpp/Files.stg)
  15. IF(EXPORT_CMAKE)
  16. MANUAL_GENERATION(${sql_grammar})
  17. ELSE()
  18. # For exporting CMake this vars fill in epilogue.cmake
  19. SET(GRAMMAR_STRING_CORE_SINGLE "\"~(['#BACKSLASH#]) | (BACKSLASH .)\"")
  20. SET(GRAMMAR_STRING_CORE_DOUBLE "\"~([#DOUBLE_QUOTE##BACKSLASH#]) | (BACKSLASH .)\"")
  21. SET(GRAMMAR_MULTILINE_COMMENT_CORE "\".\"")
  22. CONFIGURE_FILE(${ARCADIA_ROOT}/yql/essentials/sql/v1/SQLv1Antlr4.g.in ${sql_grammar})
  23. ENDIF()
  24. NO_COMPILER_WARNINGS()
  25. ADDINCL(
  26. GLOBAL contrib/libs/antlr4_cpp_runtime/src
  27. )
  28. INCLUDE(${ARCADIA_ROOT}/yql/essentials/parser/proto_ast/org/antlr/v4/tool/templates/codegen/ya.make.incl)
  29. RUN_ANTLR4(
  30. ${sql_grammar}
  31. -no-listener
  32. -package NALPDefaultAntlr4
  33. -lib .
  34. -o ${antlr_output}
  35. IN ${sql_grammar} ${antlr_templates}/Cpp/Cpp.stg ${antlr_templates}/Cpp/Files.stg
  36. OUT SQLv1Antlr4Parser.cpp SQLv1Antlr4Lexer.cpp SQLv1Antlr4Parser.h SQLv1Antlr4Lexer.h
  37. OUTPUT_INCLUDES
  38. ${PROTOBUF_HEADER_PATH}/SQLv1Parser.pb.main.h
  39. ${STG_INCLUDES}
  40. CWD ${antlr_output}
  41. )
  42. END()