Skip to content

Commit f8b5e7b

Browse files
committed
resolving arch flag issues for mac
1 parent 51a5f1e commit f8b5e7b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

setup.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@
2323
def get_build_machine():
2424
machine = platform.machine()
2525
if machine == 'arm64' or machine == 'aarch64':
26-
return 'arm64'
26+
return 'arm8'
2727
return machine
2828

29+
def get_archflag_machine():
30+
machine = platform.machine()
31+
if machine == 'arm64' or machine == 'aarch64':
32+
return 'arm64'
33+
return machine
2934

3035
def get_build_os():
3136
os = platform.system()
@@ -53,7 +58,7 @@ def get_build_triple(build_mpi):
5358
libcharm_filename2 = 'charm.lib'
5459
charmrun_filename = 'charmrun.exe'
5560
elif system == 'darwin':
56-
os.environ['ARCHFLAGS'] = f'-arch {machine}'
61+
os.environ['ARCHFLAGS'] = f'-arch {get_archflag_machine()}'
5762
libcharm_filename = 'libcharm.dylib'
5863
charmrun_filename = 'charmrun'
5964
if 'CPPFLAGS' in os.environ:
@@ -169,7 +174,7 @@ def build_libcharm(charm_src_dir, build_dir):
169174
raise DistutilsSetupError('An error occured while building charm library')
170175

171176
if system == 'darwin':
172-
old_file_path = os.path.join(charm_src_dir, 'charm', 'lib', 'libcharm.so')
177+
old_file_path = os.path.join(charm_src_dir, 'charm', 'lib', 'libcharm.dylib')
173178
new_file_path = os.path.join(charm_src_dir, 'charm', 'lib', libcharm_filename)
174179
shutil.move(old_file_path, new_file_path)
175180
cmd = ['install_name_tool', '-id', '@rpath/../.libs/' + libcharm_filename, new_file_path]

0 commit comments

Comments
 (0)