mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 20:18:18 +00:00
fixed messy directory separator in mk_util
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
db6e20b2ea
commit
017176c720
|
@ -85,11 +85,9 @@ def is_linux():
|
||||||
def is_osx():
|
def is_osx():
|
||||||
return IS_OSX
|
return IS_OSX
|
||||||
|
|
||||||
def unix_path2dos(path):
|
def norm_path(p):
|
||||||
return string.join(path.split('/'), '\\')
|
# We use '/' on mk_project for convenience
|
||||||
|
return os.path.join(*(p.split('/')))
|
||||||
def to_unix_path(path):
|
|
||||||
return string.join(path.split('\\'), '/')
|
|
||||||
|
|
||||||
def which(program):
|
def which(program):
|
||||||
import os
|
import os
|
||||||
|
@ -443,7 +441,7 @@ def extract_c_includes(fname):
|
||||||
|
|
||||||
# Given a path dir1/subdir2/subdir3 returns ../../..
|
# Given a path dir1/subdir2/subdir3 returns ../../..
|
||||||
def reverse_path(p):
|
def reverse_path(p):
|
||||||
l = to_unix_path(p).split('/')
|
l = p.split(os.sep)
|
||||||
n = len(l)
|
n = len(l)
|
||||||
r = '..'
|
r = '..'
|
||||||
for i in range(1, n):
|
for i in range(1, n):
|
||||||
|
@ -461,6 +459,7 @@ def set_build_dir(d):
|
||||||
|
|
||||||
def set_z3py_dir(p):
|
def set_z3py_dir(p):
|
||||||
global SRC_DIR, Z3PY_SRC_DIR
|
global SRC_DIR, Z3PY_SRC_DIR
|
||||||
|
p = norm_path(p)
|
||||||
full = os.path.join(SRC_DIR, p)
|
full = os.path.join(SRC_DIR, p)
|
||||||
if not os.path.exists(full):
|
if not os.path.exists(full):
|
||||||
raise MKException("Python bindings directory '%s' does not exist" % full)
|
raise MKException("Python bindings directory '%s' does not exist" % full)
|
||||||
|
@ -559,6 +558,7 @@ class Component:
|
||||||
if path == None:
|
if path == None:
|
||||||
path = name
|
path = name
|
||||||
self.name = name
|
self.name = name
|
||||||
|
path = norm_path(path)
|
||||||
self.path = path
|
self.path = path
|
||||||
self.deps = find_all_deps(name, deps)
|
self.deps = find_all_deps(name, deps)
|
||||||
self.build_dir = path
|
self.build_dir = path
|
||||||
|
@ -989,25 +989,29 @@ class JavaDLLComponent(Component):
|
||||||
t = t.replace('PLATFORM', 'win32')
|
t = t.replace('PLATFORM', 'win32')
|
||||||
out.write(t)
|
out.write(t)
|
||||||
if IS_WINDOWS: # On Windows, CL creates a .lib file to link against.
|
if IS_WINDOWS: # On Windows, CL creates a .lib file to link against.
|
||||||
out.write('\t$(SLINK) $(SLINK_OUT_FLAG)libz3java$(SO_EXT) $(SLINK_FLAGS) api/java/Native$(OBJ_EXT) libz3$(LIB_EXT)\n')
|
out.write('\t$(SLINK) $(SLINK_OUT_FLAG)libz3java$(SO_EXT) $(SLINK_FLAGS) %s$(OBJ_EXT) libz3$(LIB_EXT)\n' %
|
||||||
|
os.join.path('api', 'java', 'Native'))
|
||||||
else:
|
else:
|
||||||
out.write('\t$(SLINK) $(SLINK_OUT_FLAG)libz3java$(SO_EXT) $(SLINK_FLAGS) api/java/Native$(OBJ_EXT) libz3$(SO_EXT)\n')
|
out.write('\t$(SLINK) $(SLINK_OUT_FLAG)libz3java$(SO_EXT) $(SLINK_FLAGS) %s$(OBJ_EXT) libz3$(SO_EXT)\n' %
|
||||||
|
os.join.path('api', 'java', 'Native'))
|
||||||
out.write('%s.jar: libz3java$(SO_EXT) ' % self.package_name)
|
out.write('%s.jar: libz3java$(SO_EXT) ' % self.package_name)
|
||||||
deps = ''
|
deps = ''
|
||||||
for jfile in get_java_files(self.src_dir):
|
for jfile in get_java_files(self.src_dir):
|
||||||
deps += ('%s ' % os.path.join(self.to_src_dir, jfile))
|
deps += ('%s ' % os.path.join(self.to_src_dir, jfile))
|
||||||
for jfile in get_java_files(os.path.join(self.src_dir, "enumerations")):
|
for jfile in get_java_files(os.path.join(self.src_dir, "enumerations")):
|
||||||
deps += '%s ' % os.path.join(self.to_src_dir, 'enumerations', jfile)
|
deps += '%s ' % os.path.join(self.to_src_dir, 'enumerations', jfile)
|
||||||
if IS_WINDOWS: deps = deps.replace('/', '\\')
|
|
||||||
out.write(deps)
|
out.write(deps)
|
||||||
out.write('\n')
|
out.write('\n')
|
||||||
t = ('\t%s %s/enumerations/*.java -d api/java/classes\n' % (JAVAC, self.to_src_dir))
|
t = ('\t%s %s.java -d %s\n' % (JAVAC, os.join.path(self.to_src_dir, 'enumerations', '*'), os.join.path('api', 'java', 'classes')))
|
||||||
if IS_WINDOWS: t = t.replace('/','\\')
|
|
||||||
out.write(t)
|
out.write(t)
|
||||||
t = ('\t%s -cp api/java/classes %s/*.java -d api/java/classes\n' % (JAVAC, self.to_src_dir))
|
t = ('\t%s -cp api/java/classes %s.java -d %s\n' % (JAVAC,
|
||||||
if IS_WINDOWS: t = t.replace('/','\\')
|
os.join.path('api', 'java', 'classes'),
|
||||||
|
os.join.path(self.to_src_dir, '*'),
|
||||||
|
os.join.path('api', 'java', 'classes')))
|
||||||
out.write(t)
|
out.write(t)
|
||||||
out.write('\tjar cfm %s.jar %s/manifest -C api/java/classes .\n' % (self.package_name, self.to_src_dir))
|
out.write('\tjar cfm %s.jar %s -C %s .\n' % (self.package_name,
|
||||||
|
os.join.path(self.to_src_dir, 'manifest'),
|
||||||
|
os.join.path('api', 'java', 'classes')))
|
||||||
out.write('java: %s.jar\n\n' % self.package_name)
|
out.write('java: %s.jar\n\n' % self.package_name)
|
||||||
|
|
||||||
def main_component(self):
|
def main_component(self):
|
||||||
|
|
|
@ -24,11 +24,11 @@ from mk_exception import *
|
||||||
api_dir = get_component('api').src_dir
|
api_dir = get_component('api').src_dir
|
||||||
dotnet_dir = get_component('dotnet').src_dir
|
dotnet_dir = get_component('dotnet').src_dir
|
||||||
|
|
||||||
log_h = open('%s/api_log_macros.h' % api_dir, 'w')
|
log_h = open(os.path.join(api_dir, 'api_log_macros.h'), 'w')
|
||||||
log_c = open('%s/api_log_macros.cpp' % api_dir, 'w')
|
log_c = open(os.path.join(api_dir, 'api_log_macros.cpp'), 'w')
|
||||||
exe_c = open('%s/api_commands.cpp' % api_dir, 'w')
|
exe_c = open(os.path.join(api_dir, 'api_commands.cpp'), 'w')
|
||||||
core_py = open('%s/z3core.py' % get_z3py_dir(), 'w')
|
core_py = open(os.path.join(get_z3py_dir(), 'z3core.py'), 'w')
|
||||||
dotnet_fileout = '%s/Native.cs' % dotnet_dir
|
dotnet_fileout = os.path.join(dotnet_dir, 'Native.cs')
|
||||||
##
|
##
|
||||||
log_h.write('// Automatically generated file\n')
|
log_h.write('// Automatically generated file\n')
|
||||||
log_h.write('#include\"z3.h\"\n')
|
log_h.write('#include\"z3.h\"\n')
|
||||||
|
@ -479,8 +479,8 @@ def mk_java():
|
||||||
if not is_java_enabled():
|
if not is_java_enabled():
|
||||||
return
|
return
|
||||||
java_dir = get_component('java').src_dir
|
java_dir = get_component('java').src_dir
|
||||||
java_nativef = '%s/Native.java' % java_dir
|
java_nativef = os.path.join(java_dir, 'Native.java')
|
||||||
java_wrapperf = '%s/Native.cpp' % java_dir
|
java_wrapperf = os.path.join(java_dir, 'Native.cpp')
|
||||||
java_native = open(java_nativef, 'w')
|
java_native = open(java_nativef, 'w')
|
||||||
java_native.write('// Automatically generated file\n')
|
java_native.write('// Automatically generated file\n')
|
||||||
java_native.write('package %s;\n' % get_component('java').package_name)
|
java_native.write('package %s;\n' % get_component('java').package_name)
|
||||||
|
@ -981,8 +981,8 @@ exe_c.close()
|
||||||
core_py.close()
|
core_py.close()
|
||||||
|
|
||||||
if is_verbose():
|
if is_verbose():
|
||||||
print "Generated '%s'" % ('%s/api_log_macros.h' % api_dir)
|
print "Generated '%s'" % os.path.join(api_dir, 'api_log_macros.h')
|
||||||
print "Generated '%s'" % ('%s/api_log_macros.cpp' % api_dir)
|
print "Generated '%s'" % os.path.join(api_dir, 'api_log_macros.cpp')
|
||||||
print "Generated '%s'" % ('%s/api_commands.cpp' % api_dir)
|
print "Generated '%s'" % os.path.join(api_dir, 'api_commands.cpp')
|
||||||
print "Generated '%s'" % ('%s/z3core.py' % get_z3py_dir())
|
print "Generated '%s'" % os.path.join(get_z3py_dir(), 'z3core.py')
|
||||||
print "Generated '%s'" % ('%s/Native.cs' % dotnet_dir)
|
print "Generated '%s'" % os.path.join(dotnet_dir, 'Native.cs')
|
||||||
|
|
Loading…
Reference in a new issue