mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 12:08:18 +00:00
Updated .NET build.
This commit is contained in:
parent
fc5b9156cf
commit
942b6ba5ec
|
@ -75,7 +75,7 @@ ONLY_MAKEFILES = False
|
||||||
Z3PY_SRC_DIR=None
|
Z3PY_SRC_DIR=None
|
||||||
VS_PROJ = False
|
VS_PROJ = False
|
||||||
TRACE = False
|
TRACE = False
|
||||||
DOTNET_ENABLED=True
|
DOTNET_ENABLED=False
|
||||||
JAVA_ENABLED=False
|
JAVA_ENABLED=False
|
||||||
ML_ENABLED=False
|
ML_ENABLED=False
|
||||||
PYTHON_INSTALL_ENABLED=True
|
PYTHON_INSTALL_ENABLED=True
|
||||||
|
@ -399,40 +399,34 @@ def check_java():
|
||||||
|
|
||||||
def check_dotnet():
|
def check_dotnet():
|
||||||
global CSC, GACUTIL
|
global CSC, GACUTIL
|
||||||
|
|
||||||
if IS_WINDOWS:
|
if IS_WINDOWS:
|
||||||
# Apparently building the dotnet bindings worked fine before
|
# We assume we're running in a VS command prompt as per instructions.
|
||||||
# so don't bother to try to detect anything
|
|
||||||
# FIXME: Shouldn't we be checking the supported version of .NET
|
|
||||||
# or something!?
|
|
||||||
if CSC == None:
|
if CSC == None:
|
||||||
CSC='csc.exe'
|
CSC='csc.exe'
|
||||||
return
|
return
|
||||||
|
|
||||||
# Check for the mono compiler
|
|
||||||
if CSC == None:
|
|
||||||
monoCompilerExecutable = 'mcs'
|
|
||||||
else:
|
else:
|
||||||
monoCompilerExecutable = CSC
|
# Check for the mono compiler
|
||||||
monoCompilerPath = which(monoCompilerExecutable)
|
if CSC == None:
|
||||||
if monoCompilerPath == None:
|
monoCompilerExecutable = 'mcs'
|
||||||
disable_dotnet()
|
else:
|
||||||
print(("Could not find mono compiler ({}) in your PATH. Not building .NET bindings").format(
|
monoCompilerExecutable = CSC
|
||||||
monoCompilerExecutable))
|
monoCompilerPath = which(monoCompilerExecutable)
|
||||||
return
|
if monoCompilerPath == None:
|
||||||
CSC = monoCompilerPath
|
raise MKException(('Could not find mono C# compiler ({}) in your PATH. Set environment variable CSC with the path to the mono C# compiler.').format(monoCompilerExecutable))
|
||||||
|
CSC = monoCompilerPath
|
||||||
# Check for gacutil (needed to install the dotnet bindings)
|
|
||||||
if GACUTIL == None:
|
# Check for gacutil (needed to install the dotnet bindings)
|
||||||
gacutilExecutable = 'gacutil'
|
if GACUTIL == None:
|
||||||
else:
|
gacutilExecutable = 'gacutil'
|
||||||
gacutilExecutable = GACUTIL
|
else:
|
||||||
gacutilPath = which(gacutilExecutable)
|
gacutilExecutable = GACUTIL
|
||||||
if gacutilPath == None:
|
gacutilPath = which(gacutilExecutable)
|
||||||
print(("ERROR: Could not find the gacutil ({}) in your PATH. "
|
if gacutilPath == None:
|
||||||
"Either install it or disable building the dotnet bindings.").format(
|
raise MKException(('Could not find the gacutil ({}) in your PATH. '
|
||||||
gacutilExecutable))
|
'Either install it or disable building the dotnet bindings.').format(
|
||||||
sys.exit(1)
|
gacutilExecutable))
|
||||||
GACUTIL = gacutilPath
|
GACUTIL = gacutilPath
|
||||||
|
|
||||||
def check_ml():
|
def check_ml():
|
||||||
t = TempFile('hello.ml')
|
t = TempFile('hello.ml')
|
||||||
|
@ -612,10 +606,10 @@ def display_help(exit_code):
|
||||||
print(" -m, --makefiles generate only makefiles.")
|
print(" -m, --makefiles generate only makefiles.")
|
||||||
if IS_WINDOWS:
|
if IS_WINDOWS:
|
||||||
print(" -v, --vsproj generate Visual Studio Project Files.")
|
print(" -v, --vsproj generate Visual Studio Project Files.")
|
||||||
print(" -n, --nodotnet do not generate Microsoft.Z3.dll make rules.")
|
|
||||||
if IS_WINDOWS:
|
if IS_WINDOWS:
|
||||||
print(" --optimize generate optimized code during linking.")
|
print(" --optimize generate optimized code during linking.")
|
||||||
print(" -j, --java generate Java bindings.")
|
print(" --dotnet generate .NET bindings.")
|
||||||
|
print(" --java generate Java bindings.")
|
||||||
print(" --ml generate OCaml bindings.")
|
print(" --ml generate OCaml bindings.")
|
||||||
print(" --staticlib build Z3 static library.")
|
print(" --staticlib build Z3 static library.")
|
||||||
if not IS_WINDOWS:
|
if not IS_WINDOWS:
|
||||||
|
@ -636,8 +630,8 @@ def display_help(exit_code):
|
||||||
print(" OCAMLC Ocaml byte-code compiler (only relevant with --ml)")
|
print(" OCAMLC Ocaml byte-code compiler (only relevant with --ml)")
|
||||||
print(" OCAMLOPT Ocaml native compiler (only relevant with --ml)")
|
print(" OCAMLOPT Ocaml native compiler (only relevant with --ml)")
|
||||||
print(" OCAML_LIB Ocaml library directory (only relevant with --ml)")
|
print(" OCAML_LIB Ocaml library directory (only relevant with --ml)")
|
||||||
print(" CSC C# Compiler (only relevant if dotnet bindings are enabled)")
|
print(" CSC C# Compiler (only relevant if .NET bindings are enabled)")
|
||||||
print(" GACUTIL GAC Utility (only relevant if dotnet bindings are enabled)")
|
print(" GACUTIL GAC Utility (only relevant if .NET bindings are enabled)")
|
||||||
print(" Z3_INSTALL_BIN_DIR Install directory for binaries relative to install prefix")
|
print(" Z3_INSTALL_BIN_DIR Install directory for binaries relative to install prefix")
|
||||||
print(" Z3_INSTALL_LIB_DIR Install directory for libraries relative to install prefix")
|
print(" Z3_INSTALL_LIB_DIR Install directory for libraries relative to install prefix")
|
||||||
print(" Z3_INSTALL_INCLUDE_DIR Install directory for header files relative to install prefix")
|
print(" Z3_INSTALL_INCLUDE_DIR Install directory for header files relative to install prefix")
|
||||||
|
@ -653,7 +647,7 @@ def parse_options():
|
||||||
options, remainder = getopt.gnu_getopt(sys.argv[1:],
|
options, remainder = getopt.gnu_getopt(sys.argv[1:],
|
||||||
'b:df:sxhmcvtnp:gj',
|
'b:df:sxhmcvtnp:gj',
|
||||||
['build=', 'debug', 'silent', 'x64', 'help', 'makefiles', 'showcpp', 'vsproj',
|
['build=', 'debug', 'silent', 'x64', 'help', 'makefiles', 'showcpp', 'vsproj',
|
||||||
'trace', 'nodotnet', 'staticlib', 'prefix=', 'gmp', 'foci2=', 'java', 'parallel=', 'gprof',
|
'trace', 'dotnet', 'staticlib', 'prefix=', 'gmp', 'foci2=', 'java', 'parallel=', 'gprof',
|
||||||
'githash=', 'x86', 'ml', 'optimize', 'noomp', 'pypkgdir='])
|
'githash=', 'x86', 'ml', 'optimize', 'noomp', 'pypkgdir='])
|
||||||
except:
|
except:
|
||||||
print("ERROR: Invalid command line option")
|
print("ERROR: Invalid command line option")
|
||||||
|
@ -685,8 +679,8 @@ def parse_options():
|
||||||
VS_PROJ = True
|
VS_PROJ = True
|
||||||
elif opt in ('-t', '--trace'):
|
elif opt in ('-t', '--trace'):
|
||||||
TRACE = True
|
TRACE = True
|
||||||
elif opt in ('-n', '--nodotnet'):
|
elif opt in ('-.net', '--dotnet'):
|
||||||
DOTNET_ENABLED = False
|
DOTNET_ENABLED = True
|
||||||
elif opt in ('--staticlib'):
|
elif opt in ('--staticlib'):
|
||||||
STATIC_LIB = True
|
STATIC_LIB = True
|
||||||
elif opt in ('--optimize'):
|
elif opt in ('--optimize'):
|
||||||
|
@ -829,10 +823,6 @@ def is_dotnet_enabled():
|
||||||
def is_python_install_enabled():
|
def is_python_install_enabled():
|
||||||
return PYTHON_INSTALL_ENABLED
|
return PYTHON_INSTALL_ENABLED
|
||||||
|
|
||||||
def disable_dotnet():
|
|
||||||
global DOTNET_ENABLED
|
|
||||||
DOTNET_ENABLED = False
|
|
||||||
|
|
||||||
def is_compiler(given, expected):
|
def is_compiler(given, expected):
|
||||||
"""
|
"""
|
||||||
Return True if the 'given' compiler is the expected one.
|
Return True if the 'given' compiler is the expected one.
|
||||||
|
@ -1485,7 +1475,7 @@ class DotNetDLLComponent(Component):
|
||||||
configure_file(pkg_config_template, pkg_config_output, substitutions)
|
configure_file(pkg_config_template, pkg_config_output, substitutions)
|
||||||
|
|
||||||
def mk_makefile(self, out):
|
def mk_makefile(self, out):
|
||||||
if not DOTNET_ENABLED:
|
if not is_dotnet_enabled():
|
||||||
return
|
return
|
||||||
cs_fp_files = []
|
cs_fp_files = []
|
||||||
cs_files = []
|
cs_files = []
|
||||||
|
@ -1576,8 +1566,8 @@ class DotNetDLLComponent(Component):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def mk_win_dist(self, build_path, dist_path):
|
def mk_win_dist(self, build_path, dist_path):
|
||||||
if DOTNET_ENABLED:
|
if is_dotnet_enabled():
|
||||||
# Assuming all DotNET dll should be in the distribution
|
# Assuming all .NET dlls should be in the distribution
|
||||||
mk_dir(os.path.join(dist_path, INSTALL_BIN_DIR))
|
mk_dir(os.path.join(dist_path, INSTALL_BIN_DIR))
|
||||||
shutil.copy('%s.dll' % os.path.join(build_path, self.dll_name),
|
shutil.copy('%s.dll' % os.path.join(build_path, self.dll_name),
|
||||||
'%s.dll' % os.path.join(dist_path, INSTALL_BIN_DIR, self.dll_name))
|
'%s.dll' % os.path.join(dist_path, INSTALL_BIN_DIR, self.dll_name))
|
||||||
|
@ -1594,7 +1584,7 @@ class DotNetDLLComponent(Component):
|
||||||
return
|
return
|
||||||
|
|
||||||
def mk_install_deps(self, out):
|
def mk_install_deps(self, out):
|
||||||
if not DOTNET_ENABLED:
|
if not is_dotnet_enabled:
|
||||||
return
|
return
|
||||||
out.write('%s' % self.name)
|
out.write('%s' % self.name)
|
||||||
|
|
||||||
|
@ -1620,7 +1610,7 @@ class DotNetDLLComponent(Component):
|
||||||
flags=' '.join(gacUtilFlags)))
|
flags=' '.join(gacUtilFlags)))
|
||||||
|
|
||||||
def mk_install(self, out):
|
def mk_install(self, out):
|
||||||
if not DOTNET_ENABLED or IS_WINDOWS:
|
if not DOTNET_ENABLED:
|
||||||
return
|
return
|
||||||
self._install_or_uninstall_to_gac(out, install=True)
|
self._install_or_uninstall_to_gac(out, install=True)
|
||||||
|
|
||||||
|
@ -1631,7 +1621,7 @@ class DotNetDLLComponent(Component):
|
||||||
MakeRuleCmd.install_files(out, pkg_config_output, INSTALL_PKGCONFIG_DIR)
|
MakeRuleCmd.install_files(out, pkg_config_output, INSTALL_PKGCONFIG_DIR)
|
||||||
|
|
||||||
def mk_uninstall(self, out):
|
def mk_uninstall(self, out):
|
||||||
if not DOTNET_ENABLED or IS_WINDOWS:
|
if not DOTNET_ENABLED:
|
||||||
return
|
return
|
||||||
self._install_or_uninstall_to_gac(out, install=False)
|
self._install_or_uninstall_to_gac(out, install=False)
|
||||||
pkg_config_file = os.path.join('lib','pkgconfig','{}.pc'.format(self.gac_pkg_name()))
|
pkg_config_file = os.path.join('lib','pkgconfig','{}.pc'.format(self.gac_pkg_name()))
|
||||||
|
@ -1919,7 +1909,7 @@ class DotNetExampleComponent(ExampleComponent):
|
||||||
return is_dotnet_enabled()
|
return is_dotnet_enabled()
|
||||||
|
|
||||||
def mk_makefile(self, out):
|
def mk_makefile(self, out):
|
||||||
if DOTNET_ENABLED:
|
if is_dotnet_enabled():
|
||||||
dll_name = get_component(DOTNET_COMPONENT).dll_name
|
dll_name = get_component(DOTNET_COMPONENT).dll_name
|
||||||
dll = '%s.dll' % dll_name
|
dll = '%s.dll' % dll_name
|
||||||
exefile = '%s$(EXE_EXT)' % self.name
|
exefile = '%s$(EXE_EXT)' % self.name
|
||||||
|
|
Loading…
Reference in a new issue