ya.make 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. LIBRARY()
  2. PEERDIR (
  3. yql/essentials/parser/proto_ast/gen/v1_proto_split
  4. yql/essentials/parser/proto_ast/antlr3
  5. )
  6. SET(antlr_output ${ARCADIA_BUILD_ROOT}/${MODDIR})
  7. SET(antlr_templates ${antlr_output}/org/antlr/codegen/templates)
  8. SET(sql_grammar ${antlr_output}/SQLv1.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 NALPAnsi)
  13. CONFIGURE_FILE(${ARCADIA_ROOT}/yql/essentials/parser/proto_ast/org/antlr/codegen/templates/Cpp/Cpp.stg.in ${antlr_templates}/Cpp/Cpp.stg)
  14. IF(EXPORT_CMAKE)
  15. MANUAL_GENERATION(${sql_grammar})
  16. ELSE()
  17. # For exporting CMake this vars fill in epilogue.cmake
  18. SET(GRAMMAR_STRING_CORE_SINGLE "\"~QUOTE_SINGLE | (QUOTE_SINGLE QUOTE_SINGLE)\"")
  19. SET(GRAMMAR_STRING_CORE_DOUBLE "\"~QUOTE_DOUBLE | (QUOTE_DOUBLE QUOTE_DOUBLE)\"")
  20. SET(GRAMMAR_MULTILINE_COMMENT_CORE "\"MULTILINE_COMMENT | .\"")
  21. CONFIGURE_FILE(${ARCADIA_ROOT}/yql/essentials/sql/v1/SQLv1.g.in ${sql_grammar})
  22. ENDIF()
  23. NO_COMPILER_WARNINGS()
  24. ADDINCL(
  25. GLOBAL contrib/libs/antlr4_cpp_runtime/src
  26. )
  27. INCLUDE(${ARCADIA_ROOT}/yql/essentials/parser/proto_ast/org/antlr/codegen/templates/ya.make.incl)
  28. RUN_ANTLR(
  29. ${sql_grammar}
  30. -lib .
  31. -fo ${antlr_output}
  32. IN ${sql_grammar} ${antlr_templates}/Cpp/Cpp.stg
  33. OUT SQLv1Parser.cpp SQLv1Lexer.cpp SQLv1Parser.h SQLv1Lexer.h
  34. OUTPUT_INCLUDES
  35. ${PROTOBUF_HEADER_PATH}/SQLv1Parser.pb.main.h
  36. ${STG_INCLUDES}
  37. CWD ${antlr_output}
  38. )
  39. END()