Skip to content

Commit

Permalink
Remove manipulation of CXXFLAGS and LDFLAGS
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfeickert committed Sep 17, 2024
1 parent e905d59 commit f188ffd
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import os
import pathlib
import platform
import shutil
import subprocess
import sys
Expand Down Expand Up @@ -74,28 +73,6 @@ def build_extensions(self):
cwd=FASTJET,
)

# Inject the required CXXFLAGS and LDFLAGS for building on
# aarch64 macOS. As Homebrew can not be used at any part in a
# conda-forge build, guard against this by checking for the
# conda-build environment variable.
# This is a bad hack, and will be alleviated if CMake can be used
# by FastJet and FastJet-contrib.
# c.f. https://github.com/scikit-hep/fastjet/issues/310
if (
sys.platform == "darwin"
and platform.processor() == "arm"
and "HOMEBREW_PREFIX" in os.environ
and "CONDA_BUILD" not in os.environ
):
os.environ["CXXFLAGS"] = (
os.environ.get("CXXFLAGS", "")
+ f" -I{os.environ['HOMEBREW_PREFIX']}/include"
)
os.environ["LDFLAGS"] = (
os.environ.get("LDFLAGS", "")
+ f" -L{os.environ['HOMEBREW_PREFIX']}/lib"
)

# RPATH is set for shared libraries in the following locations:
# * fastjet/
# * fastjet/_fastjet_core/lib/
Expand Down Expand Up @@ -137,20 +114,12 @@ def build_extensions(self):
subprocess.run(["make", "-j"], cwd=FASTJET, env=env, check=True)
subprocess.run(["make", "install"], cwd=FASTJET, env=env, check=True)

# For aarch64 macOS need to set the LDFLAGS for Homebrew installed
# dependencies to be found. However, fastjet-contrib's configure
# script does not use/accept LDFLAGS as an argument, and so to get
# the library search path options passed to the linker it is necessary
# to improperly inject them into the CXXFLAGS (which are used).
# This is a bad hack, and will be alleviated if CMake can be used
# by FastJet and FastJet-contrib.
# c.f. https://github.com/scikit-hep/fastjet/issues/310
subprocess.run(
[
"./configure",
f"--fastjet-config={FASTJET}/fastjet-config",
f'CXX={env["CXX"]}',
f'CXXFLAGS={env["CXXFLAGS"]}{" "+env["LDFLAGS"] if sys.platform == "darwin" else ""}',
f'CXXFLAGS={env["CXXFLAGS"]}',
],
cwd=FASTJET_CONTRIB,
env=env,
Expand Down

0 comments on commit f188ffd

Please sign in to comment.