Skip to content

Commit

Permalink
In further bad hacks, the LDFLAGs need to be fully overridden
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfeickert committed Sep 15, 2024
1 parent 33ea75b commit 97dc875
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,27 @@ def build_extensions(self):
if sys.platform == "darwin":
if "CXXFLAGS" not in os.environ:
os.environ["CXXFLAGS"] = ""
if "LDFLAGS" not in os.environ:
os.environ["LDFLAGS"] = ""

os.environ["CXXFLAGS"] = os.environ["CXXFLAGS"] + " -I/opt/homebrew/include"
os.environ["LDFLAGS"] = os.environ["LDFLAGS"] + " -L/opt/homebrew/lib"
os.environ["CXXFLAGS"] = (
os.environ["CXXFLAGS"] + " -I/opt/homebrew/include"
)
# For reasons that are unclear, the LDFLAGS need to be fully
# overridden. It is insufficient to just prepend the Homebrew
# library path to the existing LDFLAGS.
os.environ["LDFLAGS"] = "-L/opt/homebrew/lib"
# Pick up a Conda environment if it is active
if "CONDA_PREFIX" in os.environ and os.environ["CONDA_PREFIX"]:
if "CXXFLAGS" not in os.environ:
os.environ["CXXFLAGS"] = ""
if "LDFLAGS" not in os.environ:
os.environ["LDFLAGS"] = ""

os.environ["CXXFLAGS"] = os.environ["CXXFLAGS"] + f" -I{os.environ['CONDA_PREFIX']}/include"
os.environ["LDFLAGS"] = os.environ["LDFLAGS"] + f" -L{os.environ['CONDA_PREFIX']}/lib"
os.environ["CXXFLAGS"] = (
os.environ["CXXFLAGS"] + f" -I{os.environ['CONDA_PREFIX']}/include"
)
os.environ["LDFLAGS"] = (
os.environ["LDFLAGS"] + f" -L{os.environ['CONDA_PREFIX']}/lib"
)

env = os.environ.copy()
env["CXX"] = env.get("CXX", "g++")
Expand Down

0 comments on commit 97dc875

Please sign in to comment.