3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-10 16:13:25 +00:00

.NET API build fixes

This commit is contained in:
Christoph M. Wintersteiger 2015-12-15 13:09:02 +00:00
parent 0da8160716
commit f4e3989766

View file

@ -35,7 +35,7 @@ OCAMLOPT=getenv("OCAMLOPT", "ocamlopt")
OCAML_LIB=getenv("OCAML_LIB", None) OCAML_LIB=getenv("OCAML_LIB", None)
OCAMLFIND=getenv("OCAMLFIND", "ocamlfind") OCAMLFIND=getenv("OCAMLFIND", "ocamlfind")
CSC=getenv("CSC", None) CSC=getenv("CSC", None)
GACUTIL=getenv("GACUTIL", None) GACUTIL=getenv("GACUTIL", 'gacutil')
# Standard install directories relative to PREFIX # Standard install directories relative to PREFIX
INSTALL_BIN_DIR=getenv("Z3_INSTALL_BIN_DIR", "bin") INSTALL_BIN_DIR=getenv("Z3_INSTALL_BIN_DIR", "bin")
INSTALL_LIB_DIR=getenv("Z3_INSTALL_LIB_DIR", "lib") INSTALL_LIB_DIR=getenv("Z3_INSTALL_LIB_DIR", "lib")
@ -44,6 +44,7 @@ INSTALL_PKGCONFIG_DIR=getenv("Z3_INSTALL_PKGCONFIG_DIR", os.path.join(INSTALL_LI
CXX_COMPILERS=['g++', 'clang++'] CXX_COMPILERS=['g++', 'clang++']
C_COMPILERS=['gcc', 'clang'] C_COMPILERS=['gcc', 'clang']
CSC_COMPILERS=['csc', 'mcs']
JAVAC=None JAVAC=None
JAR=None JAR=None
PYTHON_PACKAGE_DIR=distutils.sysconfig.get_python_lib() PYTHON_PACKAGE_DIR=distutils.sysconfig.get_python_lib()
@ -397,36 +398,36 @@ def check_java():
if JNI_HOME is None: if JNI_HOME is None:
raise MKException("Failed to detect jni.h. Possible solution: set JNI_HOME with the path to JDK.") raise MKException("Failed to detect jni.h. Possible solution: set JNI_HOME with the path to JDK.")
def test_csc_compiler(c):
t = TempFile('hello.cs')
t.add('public class hello { public static void Main() {} }')
t.commit()
if is_verbose():
print ('Testing %s...' % c)
r = exec_cmd([c, 'hello.cs'])
try:
rmf('hello.cs')
rmf('hello.exe')
except:
pass
return r == 0
def check_dotnet(): def check_dotnet():
global CSC, GACUTIL global CSC, GACUTIL
if IS_WINDOWS: if CSC == None:
# We assume we're running in a VS command prompt as per instructions. for c in CSC_COMPILERS:
if CSC == None: if test_csc_compiler(c):
CSC='csc.exe' CSC = c
return
else: if CSC == None:
# Check for the mono compiler raise MKException('Failed testing C# compiler. Set environment variable CSC with the path to the C# compiler')
if CSC == None:
monoCompilerExecutable = 'mcs' if is_verbose():
else: print ('Testing %s...' % GACUTIL)
monoCompilerExecutable = CSC r = exec_cmd([GACUTIL, '/l', 'hello' ])
monoCompilerPath = which(monoCompilerExecutable) if r != 0:
if monoCompilerPath == None: raise MKException('Failed testing gacutil. Set environment variable GACUTIL with the path to gacutil.')
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:
gacutilExecutable = 'gacutil'
else:
gacutilExecutable = GACUTIL
gacutilPath = which(gacutilExecutable)
if gacutilPath == None:
raise MKException(('Could not find the gacutil ({}) in your PATH. '
'Either install it or disable building the dotnet bindings.').format(
gacutilExecutable))
GACUTIL = gacutilPath
def check_ml(): def check_ml():
t = TempFile('hello.ml') t = TempFile('hello.ml')
@ -1584,7 +1585,7 @@ class DotNetDLLComponent(Component):
return return
def mk_install_deps(self, out): def mk_install_deps(self, out):
if not is_dotnet_enabled: if not is_dotnet_enabled():
return return
out.write('%s' % self.name) out.write('%s' % self.name)