From c5f06e8315ce92262d53fa512180fc6cc26d895c Mon Sep 17 00:00:00 2001 From: Jimmy Charnley Kromann Date: Mon, 13 Jan 2025 21:38:22 +0100 Subject: [PATCH] Fixing flags --- _compile.py | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/_compile.py b/_compile.py index 62381ac3..22208251 100644 --- a/_compile.py +++ b/_compile.py @@ -60,26 +60,6 @@ def find_env() -> dict[str, str]: fc = os.environ.get("FC", DEFAULT_FC) - linker_mathlib_dirs = [ - "/usr/lib/", # Debian - "/lib/", # Alpine - "/usr/local/lib/", # FreeBSD - "/usr/lib64/", # Redhat - ] - - mathlib_path = None - - for dir in linker_mathlib_dirs: - - if not Path(dir).is_dir(): - continue - - mathlib_path = dir - break - - if mathlib_path is None: - print("Unable to find mathlib path") - # TODO Check if FC is there, not not raise Error # TODO Check if lapack / blas is there, if not raise Error # TODO Check if omp is installed @@ -115,10 +95,8 @@ def find_env() -> dict[str, str]: "-llapack", ] - if mathlib_path is not None: - linker_math += [f"-L{mathlib_path}"] - - if sys.platform == "darwin": + # MacOS X specific flags + if "darwin " in sys.platform: expected_omp_dir = Path("/opt/homebrew/opt/libomp/lib") @@ -136,6 +114,11 @@ def find_env() -> dict[str, str]: compiler_openmp = [] linker_openmp = [] + # FreeBSD specific flags + if "freebsd" in sys.platform: + # Location of BLAS / Lapack for FreeBSD 14 + linker_math += ["/usr/local/lib/"] + fflags = [] + compiler_flags + compiler_openmp ldflags = [] + linker_flags + linker_math + linker_openmp