From d0443f96adcc7a554494cf75ba85fcba74476b77 Mon Sep 17 00:00:00 2001 From: Boris Bolliet Date: Sat, 28 Sep 2024 19:03:21 +0100 Subject: [PATCH] Update setup.py --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5cc439cf..60c90205 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,10 @@ def package_files(directory, exclude_dirs): if b"mvec" not in MVEC_STRING: liblist += ["mvec", "m"] +# Check the platform to determine the correct OpenMP library +openmp_flag = '-lgomp' if sys.platform.startswith('linux') else '-lomp' + + # Define Cython extension classy_sz_ext = Extension( "classy_sz", @@ -39,7 +43,7 @@ def package_files(directory, exclude_dirs): include_dirs=[np.get_include(), os.path.join("class-sz", "include")], libraries=liblist, library_dirs=["class-sz", GCCPATH], - extra_link_args=['-lgomp', '-lgsl', '-lfftw3', '-lgslcblas'] + extra_link_args=[openmp_flag, '-lgsl', '-lfftw3', '-lgslcblas'] ) classy_sz_ext.cython_directives = {'language_level': "3" if sys.version_info.major >= 3 else "2"}