mirror of
https://github.com/Z3Prover/z3
synced 2025-04-10 03:07:07 +00:00
Add a hacky patch so that Z3 on M1 hardware can link to libs properly (#5974)
* Add a hacky patch so that Z3 on M1 hardware can link to libs properly * Update setup.py Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
ddbe17d581
commit
7d47e45c6b
|
@ -178,6 +178,20 @@ def _copy_bins():
|
|||
continue
|
||||
shutil.copy(os.path.join(header_dir, fname), os.path.join(HEADERS_DIR, fname))
|
||||
|
||||
# This hack lets z3 installed libs link on M1 macs; it is a hack, not a proper fix
|
||||
# @TODO: Linked issue: https://github.com/Z3Prover/z3/issues/5926
|
||||
major_minor = '.'.join(_z3_version().split('.')[:2])
|
||||
link_name = None
|
||||
if BUILD_PLATFORM in ('win32', 'cygwin', 'win'):
|
||||
pass # TODO: When windows VMs work on M1, fill this in
|
||||
elif BUILD_PLATFORM in ('darwin', 'osx'):
|
||||
split = LIBRARY_FILE.split('.')
|
||||
link_name = split[0] + '.' + major_minor + '.' + split[1]
|
||||
else:
|
||||
link_name = LIBRARY_FILE + '.' + major_minor
|
||||
if link_name:
|
||||
os.symlink(LIBRARY_FILE, os.path.join(LIBS_DIR, link_name), True)
|
||||
|
||||
def _copy_sources():
|
||||
"""
|
||||
Prepare for a source distribution by assembling a minimal set of source files needed
|
||||
|
@ -273,10 +287,10 @@ if 'bdist_wheel' in sys.argv and '--plat-name' not in sys.argv:
|
|||
osver = RELEASE_METADATA[3]
|
||||
if osver.count('.') > 1:
|
||||
osver = '.'.join(osver.split('.')[:2])
|
||||
if arch == 'x64':
|
||||
if arch == 'x64':
|
||||
plat_name ='macosx_%s_x86_64' % osver.replace('.', '_')
|
||||
elif arch == 'arm64':
|
||||
plat_name ='macosx_%s_arm64' % osver.replace('.', '_')
|
||||
plat_name ='macosx_%s_arm64' % osver.replace('.', '_')
|
||||
else:
|
||||
raise Exception(f"idk how os {distos} {osver} works. what goes here?")
|
||||
else:
|
||||
|
@ -287,7 +301,6 @@ if 'bdist_wheel' in sys.argv and '--plat-name' not in sys.argv:
|
|||
sys.argv.insert(idx + 1, plat_name)
|
||||
sys.argv.insert(idx + 2, '--universal') # supports py2+py3. if --plat-name is not specified this will also mean that the package can be installed on any machine regardless of architecture, so watch out!
|
||||
|
||||
|
||||
setup(
|
||||
name='z3-solver',
|
||||
version=_z3_version(),
|
||||
|
|
Loading…
Reference in a new issue