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"}