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

ML API: made native layer ANSI-C compliant to avoid compilation issues.

Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
Christoph M. Wintersteiger 2013-01-07 15:32:25 +00:00
parent 597409c8ac
commit d0591334a2
2 changed files with 41 additions and 26 deletions

View file

@ -345,21 +345,20 @@ def check_ml():
t.commit()
if is_verbose():
print "Testing %s..." % OCAMLC
r = exec_cmd([OCAMLC, 'hello.ml'])
r = exec_cmd([OCAMLC, '-o', 'a.out', 'hello.ml'])
if r != 0:
raise MKException('Failed testing ocamlc compiler. Set environment variable OCAMLC with the path to the Ocaml compiler')
if is_verbose():
print "Testing %s..." % OCAMLOPT
r = exec_cmd([OCAMLC, 'hello.ml'])
r = exec_cmd([OCAMLC, '-o', 'a.out', 'hello.ml'])
if r != 0:
raise MKException('Failed testing ocamlopt compiler. Set environment variable OCAMLOPT with the path to the Ocaml native compiler')
os.remove('hello.cmi')
os.remove('hello.cmo')
os.remove('a.out')
r = exec_cmd([OCAMLBUILD])
r = exec_cmd([OCAMLBUILD, '-version'])
if r != 0:
raise MKException('Failed testing ocamlbuild. Set environment variable OCAMLBUILD with the path to ocamlbuild')
shutil.rmtree('_build')
find_ml_lib()
def find_ml_lib():
@ -1350,7 +1349,10 @@ class MLComponent(Component):
out.write(' %s' % os.path.join(self.to_src_dir, mlfile))
out.write('\n')
out.write('\t$(CXX) $(CXXFLAGS) $(CXX_OUT_FLAG)api/ml/z3native$(OBJ_EXT) -I%s -I%s %s/z3native.c\n' % (get_component(API_COMPONENT).to_src_dir, OCAML_LIB, self.to_src_dir))
out.write('\t$(SLINK) $(SLINK_OUT_FLAG)%s $(SLINK_FLAGS) %s$(OBJ_EXT) libz3$(SO_EXT)\n' % (libfile, os.path.join('api', 'ml', 'z3native')))
if WINDOWS:
out.write('\t$(SLINK) $(SLINK_OUT_FLAG)%s $(SLINK_FLAGS) %s$(OBJ_EXT) libz3$(LIB_EXT)\n' % (libfile, os.path.join('api', 'ml', 'z3native')))
else:
out.write('\t$(SLINK) $(SLINK_OUT_FLAG)%s $(SLINK_FLAGS) %s$(OBJ_EXT) libz3$(SO_EXT)\n' % (libfile, os.path.join('api', 'ml', 'z3native')))
out.write('z3.cmxa: %s\n' % libfile)
out.write('\tcd %s && ocamlbuild -cflags \'-g\' -lflags -cclib,-L../..,-cclib,-lz3,-cclib,-lz3ml,-linkall -build-dir ../../../%s/api/ml z3.cmxa z3native$(OBJ_EXT) && cd -\n' % (self.to_src_dir,BUILD_DIR))
out.write('z3.cma: %s\n' % libfile)