mirror of
https://github.com/Z3Prover/z3
synced 2025-08-11 13:40:52 +00:00
merge with Z3Prover/master
This commit is contained in:
parent
57845d4809
commit
aacb7289be
1147 changed files with 59004 additions and 63575 deletions
|
@ -72,7 +72,7 @@ def main(args):
|
|||
|
||||
if count == 0:
|
||||
logging.info('No files generated. You need to specific an output directory'
|
||||
' for the relevant langauge bindings')
|
||||
' for the relevant language bindings')
|
||||
# TODO: Add support for other bindings
|
||||
return 0
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@ from mk_util import *
|
|||
|
||||
# Z3 Project definition
|
||||
def init_project_def():
|
||||
set_version(4, 6, 0, 0)
|
||||
set_version(4, 8, 0, 0)
|
||||
add_lib('util', [])
|
||||
add_lib('lp', ['util'], 'util/lp')
|
||||
add_lib('polynomial', ['util'], 'math/polynomial')
|
||||
add_lib('sat', ['util'])
|
||||
add_lib('nlsat', ['polynomial', 'sat'])
|
||||
add_lib('lp', ['util','nlsat'], 'util/lp')
|
||||
add_lib('hilbert', ['util'], 'math/hilbert')
|
||||
add_lib('simplex', ['util'], 'math/simplex')
|
||||
add_lib('automata', ['util'], 'math/automata')
|
||||
|
@ -32,17 +32,15 @@ def init_project_def():
|
|||
add_lib('grobner', ['ast'], 'math/grobner')
|
||||
add_lib('euclid', ['util'], 'math/euclid')
|
||||
add_lib('core_tactics', ['tactic', 'macros', 'normal_forms', 'rewriter'], 'tactic/core')
|
||||
add_lib('sat_tactic', ['tactic', 'sat'], 'sat/tactic')
|
||||
add_lib('proofs', ['rewriter', 'util'], 'ast/proofs')
|
||||
add_lib('solver', ['model', 'tactic', 'proofs'])
|
||||
add_lib('sat_tactic', ['tactic', 'sat', 'solver'], 'sat/tactic')
|
||||
add_lib('arith_tactics', ['core_tactics', 'sat'], 'tactic/arith')
|
||||
add_lib('nlsat_tactic', ['nlsat', 'sat_tactic', 'arith_tactics'], 'nlsat/tactic')
|
||||
add_lib('subpaving_tactic', ['core_tactics', 'subpaving'], 'math/subpaving/tactic')
|
||||
add_lib('aig_tactic', ['tactic'], 'tactic/aig')
|
||||
add_lib('proofs', ['rewriter', 'util'], 'ast/proofs')
|
||||
add_lib('solver', ['model', 'tactic', 'proofs'])
|
||||
add_lib('ackermannization', ['model', 'rewriter', 'ast', 'solver', 'tactic'], 'ackermannization')
|
||||
add_lib('interp', ['solver'])
|
||||
add_lib('cmd_context', ['solver', 'rewriter', 'interp'])
|
||||
add_lib('extra_cmds', ['cmd_context', 'subpaving_tactic', 'arith_tactics'], 'cmd_context/extra_cmds')
|
||||
add_lib('cmd_context', ['solver', 'rewriter'])
|
||||
add_lib('smt2parser', ['cmd_context', 'parser_util'], 'parsers/smt2')
|
||||
add_lib('fpa', ['ast', 'util', 'rewriter', 'model'], 'ast/fpa')
|
||||
add_lib('pattern', ['normal_forms', 'smt2parser', 'rewriter'], 'ast/pattern')
|
||||
|
@ -56,29 +54,26 @@ def init_project_def():
|
|||
add_lib('smt_tactic', ['smt'], 'smt/tactic')
|
||||
add_lib('sls_tactic', ['tactic', 'normal_forms', 'core_tactics', 'bv_tactics'], 'tactic/sls')
|
||||
add_lib('qe', ['smt','sat','nlsat','tactic','nlsat_tactic'], 'qe')
|
||||
add_lib('duality', ['smt', 'interp', 'qe'])
|
||||
add_lib('muz', ['smt', 'sat', 'smt2parser', 'aig_tactic', 'qe'], 'muz/base')
|
||||
add_lib('dataflow', ['muz'], 'muz/dataflow')
|
||||
add_lib('transforms', ['muz', 'hilbert', 'dataflow'], 'muz/transforms')
|
||||
add_lib('rel', ['muz', 'transforms'], 'muz/rel')
|
||||
add_lib('pdr', ['muz', 'transforms', 'arith_tactics', 'core_tactics', 'smt_tactic'], 'muz/pdr')
|
||||
add_lib('spacer', ['muz', 'transforms', 'arith_tactics', 'smt_tactic'], 'muz/spacer')
|
||||
add_lib('clp', ['muz', 'transforms'], 'muz/clp')
|
||||
add_lib('tab', ['muz', 'transforms'], 'muz/tab')
|
||||
add_lib('bmc', ['muz', 'transforms'], 'muz/bmc')
|
||||
add_lib('ddnf', ['muz', 'transforms', 'rel'], 'muz/ddnf')
|
||||
add_lib('duality_intf', ['muz', 'transforms', 'duality'], 'muz/duality')
|
||||
add_lib('fp', ['muz', 'pdr', 'clp', 'tab', 'rel', 'bmc', 'duality_intf', 'ddnf', 'spacer'], 'muz/fp')
|
||||
add_lib('nlsat_smt_tactic', ['nlsat_tactic', 'smt_tactic'], 'tactic/nlsat_smt')
|
||||
add_lib('fp', ['muz', 'clp', 'tab', 'rel', 'bmc', 'ddnf', 'spacer'], 'muz/fp')
|
||||
add_lib('ufbv_tactic', ['normal_forms', 'core_tactics', 'macros', 'smt_tactic', 'rewriter'], 'tactic/ufbv')
|
||||
add_lib('sat_solver', ['solver', 'core_tactics', 'aig_tactic', 'bv_tactics', 'arith_tactics', 'sat_tactic'], 'sat/sat_solver')
|
||||
add_lib('smtlogic_tactics', ['ackermannization', 'sat_solver', 'arith_tactics', 'bv_tactics', 'nlsat_tactic', 'smt_tactic', 'aig_tactic', 'fp', 'muz','qe','nlsat_smt_tactic'], 'tactic/smtlogics')
|
||||
add_lib('smtlogic_tactics', ['ackermannization', 'sat_solver', 'arith_tactics', 'bv_tactics', 'nlsat_tactic', 'smt_tactic', 'aig_tactic', 'fp', 'muz','qe'], 'tactic/smtlogics')
|
||||
add_lib('fpa_tactics', ['fpa', 'core_tactics', 'bv_tactics', 'sat_tactic', 'smt_tactic', 'arith_tactics', 'smtlogic_tactics'], 'tactic/fpa')
|
||||
add_lib('portfolio', ['smtlogic_tactics', 'sat_solver', 'ufbv_tactic', 'fpa_tactics', 'aig_tactic', 'fp', 'qe','sls_tactic', 'subpaving_tactic'], 'tactic/portfolio')
|
||||
add_lib('opt', ['smt', 'smtlogic_tactics', 'sls_tactic', 'sat_solver'], 'opt')
|
||||
API_files = ['z3_api.h', 'z3_ast_containers.h', 'z3_algebraic.h', 'z3_polynomial.h', 'z3_rcf.h', 'z3_fixedpoint.h', 'z3_optimization.h', 'z3_interp.h', 'z3_fpa.h', 'z3_spacer.h']
|
||||
add_lib('api', ['portfolio', 'realclosure', 'interp', 'opt'],
|
||||
API_files = ['z3_api.h', 'z3_ast_containers.h', 'z3_algebraic.h', 'z3_polynomial.h', 'z3_rcf.h', 'z3_fixedpoint.h', 'z3_optimization.h', 'z3_fpa.h', 'z3_spacer.h']
|
||||
add_lib('api', ['portfolio', 'realclosure', 'opt'],
|
||||
includes2install=['z3.h', 'z3_v1.h', 'z3_macros.h'] + API_files)
|
||||
add_lib('extra_cmds', ['cmd_context', 'subpaving_tactic', 'qe', 'arith_tactics'], 'cmd_context/extra_cmds')
|
||||
add_exe('shell', ['api', 'sat', 'extra_cmds','opt'], exe_name='z3')
|
||||
add_exe('test', ['api', 'fuzzing', 'simplex'], exe_name='test-z3', install=False)
|
||||
_libz3Component = add_dll('api_dll', ['api', 'sat', 'extra_cmds'], 'api/dll',
|
||||
|
|
|
@ -69,6 +69,7 @@ IS_WINDOWS=False
|
|||
IS_LINUX=False
|
||||
IS_OSX=False
|
||||
IS_FREEBSD=False
|
||||
IS_NETBSD=False
|
||||
IS_OPENBSD=False
|
||||
IS_CYGWIN=False
|
||||
IS_CYGWIN_MINGW=False
|
||||
|
@ -141,6 +142,9 @@ def is_linux():
|
|||
def is_freebsd():
|
||||
return IS_FREEBSD
|
||||
|
||||
def is_netbsd():
|
||||
return IS_NETBSD
|
||||
|
||||
def is_openbsd():
|
||||
return IS_OPENBSD
|
||||
|
||||
|
@ -604,6 +608,8 @@ elif os.name == 'posix':
|
|||
IS_LINUX=True
|
||||
elif os.uname()[0] == 'FreeBSD':
|
||||
IS_FREEBSD=True
|
||||
elif os.uname()[0] == 'NetBSD':
|
||||
IS_NETBSD=True
|
||||
elif os.uname()[0] == 'OpenBSD':
|
||||
IS_OPENBSD=True
|
||||
elif os.uname()[0][:6] == 'CYGWIN':
|
||||
|
@ -889,8 +895,13 @@ def is_CXX_gpp():
|
|||
return is_compiler(CXX, 'g++')
|
||||
|
||||
def is_clang_in_gpp_form(cc):
|
||||
version_string = check_output([cc, '--version']).encode('utf-8').decode('utf-8')
|
||||
return version_string.find('clang') != -1
|
||||
str = check_output([cc, '--version'])
|
||||
try:
|
||||
version_string = str.encode('utf-8')
|
||||
except:
|
||||
version_string = str
|
||||
clang = 'clang'.encode('utf-8')
|
||||
return version_string.find(clang) != -1
|
||||
|
||||
def is_CXX_clangpp():
|
||||
if is_compiler(CXX, 'g++'):
|
||||
|
@ -1240,7 +1251,7 @@ def get_so_ext():
|
|||
sysname = os.uname()[0]
|
||||
if sysname == 'Darwin':
|
||||
return 'dylib'
|
||||
elif sysname == 'Linux' or sysname == 'FreeBSD' or sysname == 'OpenBSD':
|
||||
elif sysname == 'Linux' or sysname == 'FreeBSD' or sysname == 'NetBSD' or sysname == 'OpenBSD':
|
||||
return 'so'
|
||||
elif sysname == 'CYGWIN' or sysname.startswith('MSYS_NT') or sysname.startswith('MINGW'):
|
||||
return 'dll'
|
||||
|
@ -1790,6 +1801,8 @@ class JavaDLLComponent(Component):
|
|||
t = t.replace('PLATFORM', 'linux')
|
||||
elif IS_FREEBSD:
|
||||
t = t.replace('PLATFORM', 'freebsd')
|
||||
elif IS_NETBSD:
|
||||
t = t.replace('PLATFORM', 'netbsd')
|
||||
elif IS_OPENBSD:
|
||||
t = t.replace('PLATFORM', 'openbsd')
|
||||
elif IS_CYGWIN:
|
||||
|
@ -1919,8 +1932,14 @@ class MLComponent(Component):
|
|||
OCAML_FLAGS = ''
|
||||
if DEBUG_MODE:
|
||||
OCAML_FLAGS += '-g'
|
||||
OCAMLCF = OCAMLC + ' ' + OCAML_FLAGS
|
||||
OCAMLOPTF = OCAMLOPT + ' ' + OCAML_FLAGS
|
||||
|
||||
if OCAMLFIND:
|
||||
# Load Big_int, which is no longer part of the standard library, via the num package: https://github.com/ocaml/num
|
||||
OCAMLCF = OCAMLFIND + ' ' + 'ocamlc -package num' + ' ' + OCAML_FLAGS
|
||||
OCAMLOPTF = OCAMLFIND + ' ' + 'ocamlopt -package num' + ' ' + OCAML_FLAGS
|
||||
else:
|
||||
OCAMLCF = OCAMLC + ' ' + OCAML_FLAGS
|
||||
OCAMLOPTF = OCAMLOPT + ' ' + OCAML_FLAGS
|
||||
|
||||
src_dir = self.to_src_dir
|
||||
mk_dir(os.path.join(BUILD_DIR, self.sub_dir))
|
||||
|
@ -2492,6 +2511,7 @@ def mk_config():
|
|||
LDFLAGS = '%s -lrt' % LDFLAGS
|
||||
SLIBFLAGS = '-shared'
|
||||
SLIBEXTRAFLAGS = '%s -lrt' % SLIBEXTRAFLAGS
|
||||
SLIBEXTRAFLAGS = '%s -Wl,-soname,libz3.so' % SLIBEXTRAFLAGS
|
||||
elif sysname == 'FreeBSD':
|
||||
CXXFLAGS = '%s -D_FREEBSD_' % CXXFLAGS
|
||||
OS_DEFINES = '-D_FREEBSD_'
|
||||
|
@ -2499,6 +2519,13 @@ def mk_config():
|
|||
LDFLAGS = '%s -lrt' % LDFLAGS
|
||||
SLIBFLAGS = '-shared'
|
||||
SLIBEXTRAFLAGS = '%s -lrt' % SLIBEXTRAFLAGS
|
||||
elif sysname == 'NetBSD':
|
||||
CXXFLAGS = '%s -D_NETBSD_' % CXXFLAGS
|
||||
OS_DEFINES = '-D_NETBSD_'
|
||||
SO_EXT = '.so'
|
||||
LDFLAGS = '%s -lrt' % LDFLAGS
|
||||
SLIBFLAGS = '-shared'
|
||||
SLIBEXTRAFLAGS = '%s -lrt' % SLIBEXTRAFLAGS
|
||||
elif sysname == 'OpenBSD':
|
||||
CXXFLAGS = '%s -D_OPENBSD_' % CXXFLAGS
|
||||
OS_DEFINES = '-D_OPENBSD_'
|
||||
|
@ -2783,6 +2810,7 @@ def get_header_files_for_components(component_src_dirs):
|
|||
def mk_install_tactic_cpp(cnames, path):
|
||||
component_src_dirs = []
|
||||
for cname in cnames:
|
||||
print("Component %s" % cname)
|
||||
c = get_component(cname)
|
||||
component_src_dirs.append(c.src_dir)
|
||||
h_files_full_path = get_header_files_for_components(component_src_dirs)
|
||||
|
|
|
@ -60,7 +60,7 @@ FIRST_OBJ_ID = 100
|
|||
def is_obj(ty):
|
||||
return ty >= FIRST_OBJ_ID
|
||||
|
||||
Type2Str = { VOID : 'void', VOID_PTR : 'void*', INT : 'int', UINT : 'unsigned', INT64 : '__int64', UINT64 : '__uint64', DOUBLE : 'double',
|
||||
Type2Str = { VOID : 'void', VOID_PTR : 'void*', INT : 'int', UINT : 'unsigned', INT64 : 'int64_t', UINT64 : 'uint64_t', DOUBLE : 'double',
|
||||
FLOAT : 'float', STRING : 'Z3_string', STRING_PTR : 'Z3_string_ptr', BOOL : 'Z3_bool', SYMBOL : 'Z3_symbol',
|
||||
PRINT_MODE : 'Z3_ast_print_mode', ERROR_CODE : 'Z3_error_code'
|
||||
}
|
||||
|
@ -577,9 +577,6 @@ def mk_java(java_dir, package_name):
|
|||
java_wrapper = open(java_wrapperf, 'w')
|
||||
pkg_str = package_name.replace('.', '_')
|
||||
java_wrapper.write('// Automatically generated file\n')
|
||||
java_wrapper.write('#ifdef _CYGWIN\n')
|
||||
java_wrapper.write('typedef long long __int64;\n')
|
||||
java_wrapper.write('#endif\n')
|
||||
java_wrapper.write('#include<jni.h>\n')
|
||||
java_wrapper.write('#include<stdlib.h>\n')
|
||||
java_wrapper.write('#include"z3.h"\n')
|
||||
|
@ -957,11 +954,16 @@ def def_API(name, result, params):
|
|||
log_c.write(" }\n")
|
||||
log_c.write(" Au(a%s);\n" % sz)
|
||||
exe_c.write("in.get_uint_array(%s)" % i)
|
||||
elif ty == INT or ty == BOOL:
|
||||
elif ty == INT:
|
||||
log_c.write("U(a%s[i]);" % i)
|
||||
log_c.write(" }\n")
|
||||
log_c.write(" Au(a%s);\n" % sz)
|
||||
exe_c.write("in.get_int_array(%s)" % i)
|
||||
elif ty == BOOL:
|
||||
log_c.write("U(a%s[i]);" % i)
|
||||
log_c.write(" }\n")
|
||||
log_c.write(" Au(a%s);\n" % sz)
|
||||
exe_c.write("in.get_bool_array(%s)" % i)
|
||||
else:
|
||||
error ("unsupported parameter for %s, %s, %s" % (ty, name, p))
|
||||
elif kind == OUT_ARRAY:
|
||||
|
@ -1655,7 +1657,7 @@ else:
|
|||
if hasattr(builtins, "Z3_LIB_DIRS"):
|
||||
_all_dirs = builtins.Z3_LIB_DIRS
|
||||
|
||||
for v in ('Z3_LIBRARY_PATH', 'PATH'):
|
||||
for v in ('Z3_LIBRARY_PATH', 'PATH', 'PYTHONPATH'):
|
||||
if v in os.environ:
|
||||
lp = os.environ[v];
|
||||
lds = lp.split(';') if sys.platform in ('win32') else lp.split(':')
|
||||
|
@ -1696,7 +1698,11 @@ if _lib is None:
|
|||
|
||||
def _to_ascii(s):
|
||||
if isinstance(s, str):
|
||||
return s.encode('ascii')
|
||||
try:
|
||||
return s.encode('ascii')
|
||||
except:
|
||||
# kick the bucket down the road. :-J
|
||||
return s
|
||||
else:
|
||||
return s
|
||||
|
||||
|
|
18
scripts/vsts-mac.sh
Normal file
18
scripts/vsts-mac.sh
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
cd ..
|
||||
mkdir build
|
||||
CSC=/usr/bin/csc GACUTIL=/usr/bin/gacutil CXX=clang++ CC=clang python scripts/mk_make.py --java --python
|
||||
cd build
|
||||
make
|
||||
make test-z3
|
||||
make cpp_example
|
||||
make c_example
|
||||
# make java_example
|
||||
# make python_example
|
||||
./cpp_example
|
||||
./test_capi
|
||||
|
||||
git clone https://github.com/z3prover/z3test.git z3test
|
||||
ls
|
||||
python z3test/scripts/test_benchmarks.py ./z3 ./z3test/regressions/smt2
|
49
scripts/vsts-vs2013.cmd
Normal file
49
scripts/vsts-vs2013.cmd
Normal file
|
@ -0,0 +1,49 @@
|
|||
|
||||
set
|
||||
echo "Build"
|
||||
md build
|
||||
cd build
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64
|
||||
cmake -DBUILD_DOTNET_BINDINGS=True -DBUILD_JAVA_BINDINGS=True -DBUILD_PYTHON_BINDINGS=True -G "NMake Makefiles" ../
|
||||
nmake
|
||||
if ERRORLEVEL 1 exit 1
|
||||
|
||||
rem echo "Test python bindings"
|
||||
rem pushd python
|
||||
rem python z3test.py z3
|
||||
rem if ERRORLEVEL 1 exit 1
|
||||
rem python z3test.py z3num
|
||||
rem if ERRORLEVEL 1 exit 1
|
||||
rem popd
|
||||
|
||||
echo "Build and run examples"
|
||||
nmake cpp_example
|
||||
examples\cpp_example_build_dir\cpp_example.exe
|
||||
if ERRORLEVEL 1 exit 1
|
||||
|
||||
nmake c_example
|
||||
examples\c_example_build_dir\c_example.exe
|
||||
if ERRORLEVEL 1 exit 1
|
||||
|
||||
rem nmake java_example
|
||||
rem java_example.exe
|
||||
if ERRORLEVEL 1 exit 1
|
||||
|
||||
rem nmake dotnet_example
|
||||
rem dotnet_example.exe
|
||||
if ERRORLEVEL 1 exit 1
|
||||
|
||||
echo "Build and run unit tests"
|
||||
nmake test-z3
|
||||
rem TBD: test error level
|
||||
rem test-z3.exe -a
|
||||
|
||||
|
||||
cd ..
|
||||
echo "Run regression tests"
|
||||
git clone https://github.com/z3prover/z3test z3test
|
||||
echo "test-benchmarks"
|
||||
python z3test\scripts\test_benchmarks.py build\z3.exe z3test\regressions\smt2
|
||||
if ERRORLEVEL 1 exit 1
|
||||
echo "benchmarks tested"
|
||||
|
51
scripts/vsts-vs2017.cmd
Normal file
51
scripts/vsts-vs2017.cmd
Normal file
|
@ -0,0 +1,51 @@
|
|||
rem Supply argument x64 or x86
|
||||
|
||||
echo "Build"
|
||||
md build
|
||||
cd build
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %1
|
||||
cmake -DBUILD_DOTNET_BINDINGS=True -DBUILD_JAVA_BINDINGS=True -DBUILD_PYTHON_BINDINGS=True -G "NMake Makefiles" ../
|
||||
nmake
|
||||
if ERRORLEVEL 1 exit 1
|
||||
|
||||
if %1 == "x86" goto :BUILD_EXAMPLES
|
||||
echo "Test python bindings"
|
||||
pushd python
|
||||
python z3test.py z3
|
||||
if ERRORLEVEL 1 exit 1
|
||||
python z3test.py z3num
|
||||
if ERRORLEVEL 1 exit 1
|
||||
popd
|
||||
|
||||
:BUILD_EXAMPLES
|
||||
echo "Build and run examples"
|
||||
nmake cpp_example
|
||||
examples\cpp_example_build_dir\cpp_example.exe
|
||||
if ERRORLEVEL 1 exit 1
|
||||
|
||||
nmake c_example
|
||||
examples\c_example_build_dir\c_example.exe
|
||||
if ERRORLEVEL 1 exit 1
|
||||
|
||||
rem nmake java_example
|
||||
rem java_example.exe
|
||||
if ERRORLEVEL 1 exit 1
|
||||
|
||||
rem nmake dotnet_example
|
||||
rem dotnet_example.exe
|
||||
if ERRORLEVEL 1 exit 1
|
||||
|
||||
echo "Build and run unit tests"
|
||||
nmake test-z3
|
||||
rem TBD: test error level
|
||||
rem test-z3.exe -a
|
||||
|
||||
|
||||
cd ..
|
||||
echo "Run regression tests"
|
||||
git clone https://github.com/z3prover/z3test z3test
|
||||
echo "test-benchmarks"
|
||||
python z3test\scripts\test_benchmarks.py build\z3.exe z3test\regressions\smt2
|
||||
if ERRORLEVEL 1 exit 1
|
||||
echo "benchmarks tested"
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue