Skip to content

Commit

Permalink
setup: Only try for openmp support in Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Jun 4, 2024
1 parent c1295cb commit f5927c0
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env python

import os
from setuptools import setup, find_packages
from setuptools.extension import Extension
from Cython.Build import cythonize
import sys

from Cython.Build import cythonize
from setuptools import find_packages, setup
from setuptools.extension import Extension

# {{{ capture git revision at install time

Expand All @@ -13,14 +14,14 @@ def find_git_revision(tree_root):
# Keep this routine self-contained so that it can be copy-pasted into
# setup.py.

from os.path import join, exists, abspath
from os.path import abspath, exists, join

tree_root = abspath(tree_root)

if not exists(join(tree_root, ".git")):
return None

from subprocess import Popen, PIPE, STDOUT
from subprocess import PIPE, STDOUT, Popen

p = Popen(
["git", "rev-parse", "HEAD"],
Expand Down Expand Up @@ -62,6 +63,12 @@ def write_git_revision(package_name):
# }}}


if sys.platform.startswith("linux"):
openmp_flag = ["-fopenmp"]
else:
openmp_flag = []


ext_modules = [
Extension(
"pytential.qbx.target_specific.impl",
Expand All @@ -73,8 +80,8 @@ def write_git_revision(package_name):
"pytential/qbx/target_specific/impl.h",
"pytential/qbx/target_specific/helmholtz_utils.h",
],
extra_compile_args=["-Wall", "-fopenmp", "-Ofast"],
extra_link_args=["-fopenmp"],
extra_compile_args=["-Wall", "-Ofast"] + openmp_flag,
extra_link_args=openmp_flag,
),
]

Expand Down

0 comments on commit f5927c0

Please sign in to comment.