blob: f2596ceeba907ad5b349e276aa4feec78ce7b77e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
###############################################################################
# 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()
|