Skip to content

Commit

Permalink
fix: Inject LDFLAGS into fasjet-contrib CXXFLAGS to get build working
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfeickert committed Sep 15, 2024
1 parent 2c8b7a7 commit 106662c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion extern/fastjet-core
Submodule fastjet-core updated from 0648cf to 67796a
15 changes: 10 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,20 @@ 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=-O3 -Bstatic -Bdynamic -std=c++17 {env["LDFLAGS"]}',
f'CXXFLAGS=-O3 -Bstatic -Bdynamic -std=c++17{" "+env["LDFLAGS"] if sys.platform == "darwin" else ""}',
],
cwd=FASTJET_CONTRIB,
env=env,
Expand Down Expand Up @@ -135,10 +143,7 @@ def run(self):

shutil.copytree(OUTPUT, fastjetdir / "_fastjet_core", symlinks=True)

make = "make"
if sys.platform == "darwin":
make = "gmake"

make = "gmake" if sys.platform == "darwin" else "make"
pythondir = pathlib.Path(
subprocess.check_output(
f"""{make} -f Makefile --eval='print-pythondir:
Expand Down

0 comments on commit 106662c

Please sign in to comment.