From 4e13fb7d25f835506f73502ff33a0e79112389f6 Mon Sep 17 00:00:00 2001 From: Edward Date: Wed, 31 Jan 2024 14:44:06 +1300 Subject: [PATCH] fix macos compiling without homebrew gcc at /usr/local/Cellar/gcc* --- setup.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index e8ffb034..c5dd185c 100644 --- a/setup.py +++ b/setup.py @@ -128,16 +128,21 @@ def guess_compiler_name(env_name): os.environ['FFLAGS'] = '-fPIC -fno-range-check ' + os.environ['CLIMT_OPT_FLAGS'] os.environ['CFLAGS'] = '-fPIC ' + os.environ['CLIMT_OPT_FLAGS'] -if operating_system == 'Darwin': - gcc_dir = find_homebrew_gcc() - # print('gcc_dir', gcc_dir) - for root, dirs, files in os.walk(gcc_dir): - for line in files: - if re.match('libgfortran.a', line): - if not ('i386' in root): - lib_path_list.append(root) - - # print(lib_path_list) +if operating_system == 'Darwin': # gcc_dir = find_homebrew_gcc() + # # print('gcc_dir', gcc_dir) + # for root, dirs, files in os.walk(gcc_dir): + # for line in files: + # if re.match("libgfortran.a", line): + # if not ("i386" in root): + # lib_path_list.append(root) + path = subprocess.run( + [os.environ["FC"], "--print-file-name", "libgfortran.dylib"], + capture_output=True, + text=True, + ).stdout + print(path) + + lib_path_list.append(os.path.dirname(path)) os.environ['FFLAGS'] += ' -mmacosx-version-min=10.7' os.environ['CFLAGS'] += ' -mmacosx-version-min=10.7'