############################################################################### # Top contributors (to current version): # Mathias Preiner, Gereon Kremer, Aina Niemetz # # This file is part of the cvc5 project. # # Copyright (c) 2009-2021 by the authors listed in the file AUTHORS # in the top-level source directory and their institutional affiliations. # All rights reserved. See the file COPYING in the top-level source # directory for licensing information. # ############################################################################# # # The build system configuration. ## find_package(ANTLR3 3.4 REQUIRED) # Java runtime is required for ANTLR find_package(Java COMPONENTS Runtime REQUIRED) #-----------------------------------------------------------------------------# # libcvc5parser source files set(libcvc5parser_src_files antlr_input.cpp antlr_input.h antlr_input_imports.cpp antlr_line_buffered_input.cpp antlr_line_buffered_input.h antlr_tracing.h bounded_token_buffer.cpp bounded_token_buffer.h bounded_token_factory.cpp bounded_token_factory.h cvc/cvc.cpp cvc/cvc.h cvc/cvc_input.cpp cvc/cvc_input.h input.cpp input.h line_buffer.cpp line_buffer.h memory_mapped_input_buffer.cpp memory_mapped_input_buffer.h parse_op.cpp parse_op.h parser.cpp parser.h parser_builder.cpp parser_builder.h parser_exception.h smt2/smt2.cpp smt2/smt2.h smt2/smt2_input.cpp smt2/smt2_input.h smt2/sygus_input.cpp smt2/sygus_input.h tptp/TptpLexer.c tptp/TptpParser.c tptp/tptp.cpp tptp/tptp.h tptp/tptp_input.cpp tptp/tptp_input.h ) #-----------------------------------------------------------------------------# # Generate parsers for all supported languages foreach(lang Cvc Smt2 Tptp) string(TOLOWER ${lang} lang_dir) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Lexer.c ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Lexer.h ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Parser.c ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Parser.h ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}.tokens COMMAND ${ANTLR3_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}/${lang_dir}/${lang}.g -fo ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir} DEPENDS ${lang_dir}/${lang}.g ) set(gen_src_files ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Lexer.c ${CMAKE_CURRENT_BINARY_DIR}/${lang_dir}/${lang}Parser.c) # Tell cmake that generated source files are actually c++ files set_source_files_properties(${gen_src_files} PROPERTIES LANGUAGE CXX) set_source_files_properties(${gen_src_files} PROPERTIES GENERATED TRUE) # We don't want to enable -Wall for code generated by ANTLR. set_source_files_properties( ${gen_src_files} PROPERTIES COMPILE_FLAGS "-Wno-all -Wno-error") # Add generated source files to the parser source files list(APPEND libcvc5parser_src_files ${gen_src_files}) endforeach() #-----------------------------------------------------------------------------# # libcvc5parser configuration add_library(cvc5parser ${libcvc5parser_src_files}) set_target_properties(cvc5parser PROPERTIES SOVERSION ${CVC5_SOVERSION}) target_compile_definitions(cvc5parser PRIVATE -D__BUILDING_CVC5PARSERLIB) target_link_libraries(cvc5parser PUBLIC cvc5) target_link_libraries(cvc5parser PRIVATE ANTLR3) install(TARGETS cvc5parser EXPORT cvc5-targets DESTINATION ${CMAKE_INSTALL_LIBDIR}) # The generated lexer/parser files define some functions as # __declspec(dllexport) via the ANTLR3_API macro, which leads to lots of # unresolved symbols when linking against libcvc5parser. # -Wl,--export-all-symbols makes sure that all symbols are exported when # building a DLL. if(CVC5_WINDOWS_BUILD) set_target_properties(cvc5parser PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols") endif()