Skip to content

build: use cmake build system in fastjet and fastjet-contrib #340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 83 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
5054ba7
update fastjet-core to point at fastjet/cmake-build
lgray Apr 7, 2025
27e80dd
point to fixed up fastjet branch
lgray Apr 7, 2025
2cb4f6e
with the right externs this will compile and link!
lgray Apr 7, 2025
7ea4f76
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 7, 2025
02ba232
point fastjet-contrib at CMake-ified fjcontrib repo
lgray Apr 8, 2025
b93b77c
checkpoint work
lgray Apr 8, 2025
c39b308
update fastjet contrib
lgray Apr 8, 2025
fdb820f
work on getting CI to pass
lgray Apr 8, 2025
c8eafba
almost works with scikit build (this breaks current CI)
lgray Apr 8, 2025
c08fe58
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 8, 2025
50bc2b2
install cgal as system lib in linux and macos
lgray Apr 8, 2025
7007b9e
install gfortran on macos
lgray Apr 8, 2025
b92f5d9
be a bit pushier with gfortran on macos
lgray Apr 8, 2025
b574f1f
set release build for cgal
lgray Apr 8, 2025
8658091
try for cgal-devel in manylinux?
lgray Apr 8, 2025
cda26a3
working on getting the rpath correct, presently fails and module load
lgray Apr 8, 2025
ec6e5be
skip installing cgal in manylinux since we use FetchContent
lgray Apr 8, 2025
12d9b52
wrong place
lgray Apr 8, 2025
9bfc204
remove CGAL-devel in manylinux
lgray Apr 8, 2025
fb97eee
further work on cmake install
lgray Apr 8, 2025
7f3cfb6
address review from Henry
lgray Apr 8, 2025
75ed717
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 8, 2025
97966ff
missed a comment
lgray Apr 8, 2025
5f712d3
pyproject cleanup
lgray Apr 8, 2025
505a91f
more pyproject poking
lgray Apr 8, 2025
cd4b7ec
use a linter that is compatible with pyproject
lgray Apr 8, 2025
3f20b01
try updating wheel setup
lgray Apr 8, 2025
9d2522a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 8, 2025
aa401fd
reinstall autotools for gmp rebuild
lgray Apr 8, 2025
62d03f0
reinstall gfortran for macos wheels as well
lgray Apr 8, 2025
764018b
try getting CGAL in before-all and set CGAL_DIR
lgray Apr 8, 2025
3d0b091
install CGAL in the linux image
lgray Apr 8, 2025
5da131a
derp forgot recursive
lgray Apr 8, 2025
0a0be41
update fastjet-contrib
lgray Apr 8, 2025
d0763f7
update fastjet-core
lgray Apr 8, 2025
931f2c4
update fastjet-core
lgray Apr 8, 2025
c42c23e
turn off contribs that are not used in the scikit-hep bindings
lgray Apr 8, 2025
08337ef
update fastjet-core
lgray Apr 8, 2025
2549869
update fastjet-contrib
lgray Apr 9, 2025
e5ca234
see if we can get some info about what's being linked
lgray Apr 9, 2025
3f5a2f9
remove listdeps
lgray Apr 9, 2025
620ef1e
try to uninstall gmp with brew
lgray Apr 9, 2025
7a68eb7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 9, 2025
4b722df
force remove gmp since we reinstall
lgray Apr 9, 2025
a6c5697
try just using reinstalls gmp
lgray Apr 9, 2025
2faadad
more precise install list for macos
lgray Apr 9, 2025
0e83314
rebuild brew packages with MACOSX_DEPLOYMENT_TARGET=11.0
lgray Apr 9, 2025
ef009cf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 9, 2025
cee92d0
try uninstalling homebrew and use conda instead
lgray Apr 9, 2025
a3955e9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 9, 2025
d7236e7
hacky but should work?
lgray Apr 9, 2025
d90ac17
try to only reinstall gmp from source?
lgray Apr 9, 2025
73c787f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 9, 2025
fd726a6
just set MACOSX_DEPLOYMENT_TARGET=14.0 for now to work all the way th…
lgray Apr 9, 2025
3762e03
look at libgmp build info
lgray Apr 9, 2025
d46d373
how about just not setting it?
lgray Apr 9, 2025
6bbb372
how about this?
lgray Apr 9, 2025
e537e4b
single quotes
lgray Apr 9, 2025
83b550c
restore custom gmp build, uninstall brew gcc, mpfr, gmp
lgray Apr 9, 2025
cf92e4c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 9, 2025
6f0db40
disable pxcone in scikit-hep/fastjet
lgray Apr 9, 2025
e092c56
remove more deps
lgray Apr 9, 2025
49af29e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 9, 2025
31b7b5d
--ignore-dependencies
lgray Apr 9, 2025
3b60346
forgot autoconf
lgray Apr 9, 2025
5a25605
m4
lgray Apr 9, 2025
fdd1e9b
manually build mpfr
lgray Apr 9, 2025
0adcdc5
typo
lgray Apr 9, 2025
f0edabe
set gmp directory
lgray Apr 9, 2025
4d47313
typo
lgray Apr 9, 2025
6b20bae
update fastjet-core
lgray Apr 9, 2025
5bfe92a
update complete wheel build
lgray Apr 9, 2025
0821843
wheels cleanup
lgray Apr 9, 2025
af6c136
add requirements for non-isolated build/editable install
lgray Apr 9, 2025
2b6289f
update fastjet-core
lgray Apr 9, 2025
0a6823a
update fastjet-core
lgray Apr 9, 2025
92c3113
update fastjet-core
lgray Apr 10, 2025
2a6a07f
update fastjet-core
lgray Apr 10, 2025
447fe77
update fastjet-core
lgray Apr 10, 2025
631a883
update fastjet-core
lgray Apr 10, 2025
4f70d61
update fastjet-core
lgray Apr 10, 2025
95a5fcf
update fastjet-core
lgray Apr 10, 2025
af50217
update fastjet-core
lgray Apr 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ jobs:
- name: Install compiler tools on macOS
if: runner.os == 'macOS'
run: |
brew install make automake swig gmp mpfr boost libtool
brew install make automake swig gmp mpfr boost libtool cgal
brew reinstall gfortran
which gfortran

- name: Install extra deps on Linux
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libboost-dev libmpfr-dev swig autoconf libtool
run: sudo apt-get update && sudo apt-get install -y libboost-dev libmpfr-dev swig autoconf libtool libcgal-dev

- name: Install package (MacOS)
if: runner.os == 'macOS'
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "fastjet"]
path = extern/fastjet-core
url = https://gitlab.com/fastjet/fastjet.git
url = https://gitlab.com/lgray1/fastjet.git
[submodule "fastjet-contrib"]
path = extern/fastjet-contrib
url = https://github.com/cms-externals/fastjet-contrib.git
url = https://github.com/lgray/fastjet-contrib.git
48 changes: 48 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
cmake_minimum_required(VERSION 3.11)

if(NOT SKBUILD_PROJECT_VERSION)
set(SKBUILD_PROJECT_VERSION "0.0.0") # provided by scikit-build-core
endif()
string(REPLACE "." ";" VERSION_SPLIT ${SKBUILD_PROJECT_VERSION})
list(GET VERSION_SPLIT 0 SPLIT_VERSION_MAJOR)
list(GET VERSION_SPLIT 1 SPLIT_VERSION_MINOR)

project(fastjet VERSION ${SPLIT_VERSION_MAJOR}.${SPLIT_VERSION_MINOR} LANGUAGES CXX)

set(PKG_INSTALL "fastjet") ## python package name

include(FetchContent)

find_package(pybind11 REQUIRED)

find_package(CGAL)
if (NOT CGAL_FOUND)
FetchContent_Declare(CGAL
GIT_REPOSITORY https://github.com/CGAL/cgal.git
GIT_TAG v6.0.1
)
FetchContent_MakeAvailable(CGAL)
endif()

#FetchContent_Declare(fastjet
# SOURCE_DIR ${CMAKE_SOURCE_DIR}/extern/fastjet-core
# CMAKE_ARGS "-DCMAKE_BUILD_TYPE=\"Release\" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/${PKG_INSTALL} -DFASTJET_CUSTOM_PYTHON_INSTALL=lib/${PKG_INSTALL} -DFASTJET_PYTHON_PACKAGE_NAME=_swig -DFASTJET_ENABLE_CGAL=ON"
# )
#FetchContent_MakeAvailable(fastjet)

add_subdirectory(${CMAKE_SOURCE_DIR}/extern/fastjet-core)
add_subdirectory(${CMAKE_SOURCE_DIR}/extern/fastjet-contrib)

pybind11_add_module(_ext MODULE src/_ext.cpp)
target_link_libraries(_ext PRIVATE fastjet::fastjet)
target_link_libraries(_ext PRIVATE EnergyCorrelator LundPlane Nsubjettiness RecursiveTools)
target_include_directories(_ext PRIVATE ${CMAKE_BINARY_DIR}/include)
#set_target_properties(_ext PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
#set_target_properties(_ext PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set_target_properties(_ext PROPERTIES INSTALL_RPATH "@loader_path/lib")
else()
set_target_properties(_ext PROPERTIES INSTALL_RPATH "$ORIGIN/lib")
endif()

install(TARGETS _ext LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX})
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ graft src
graft tests
graft extern
global-exclude .git .gitmodules
include LICENSE README.md pyproject.toml setup.py setup.cfg patch_clustersequence.txt
include LICENSE README.md pyproject.toml setup.py setup.cfg patch_clustersequence.txt CMakeLists.txt
exclude .cirrus.yml
2 changes: 1 addition & 1 deletion extern/fastjet-contrib
Submodule fastjet-contrib updated 219 files
2 changes: 1 addition & 1 deletion extern/fastjet-core
Submodule fastjet-core updated from 0648cf to fbb01c
36 changes: 32 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
[build-system]
requires = [
"setuptools>=42",
"setuptools_scm[toml]>=3.4",
"pybind11>=2.12.0",
"setuptools_scm[toml]>=3.4",
"pybind11>=2.6.1",
"scikit-build-core>=0.8",
]
build-backend = "setuptools.build_meta"
build-backend = "scikit_build_core.build"

[project]
name = "fastjet"
dynamic = ["version"]
requires-python = ">=3.9"
dependencies = [
"awkward>=2",
"numpy>=1.13.3",
"vector"
]


[tool.cibuildwheel]
skip = "pp*"
Expand All @@ -23,3 +34,20 @@ before-all = [
]
# Skip musllinux builds for the moment
skip = "*-musllinux_*"

[tool.scikit-build]
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
cmake.version = ">=3.11.0"
sdist.include = ["src/fastjet/version.py"]
wheel.install-dir = "fastjet"

[tool.scikit-build.cmake.define]
FASTJET_ENABLE_PYTHON = "ON"
FASTJET_ENABLE_CGAL = "ON"
FASTJET_PYTHON_PACKAGE_NAME = "_swig"
FASTJET_CUSTOM_PYTHON_INSTALL = "./"
CMAKE_BUILD_TYPE = "Release"
CMAKE_INSTALL_RPATH = "$ORIGIN/lib"

[tool.setuptools_scm]
write_to = "src/fastjet/version.py"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def run(self):
)

shutil.copyfile(pythondir / "fastjet.py", fastjetdir / "_swig.py")
shutil.copyfile(pyexecdir / "_fastjet.so", fastjetdir / "_fastjet.so")
shutil.copyfile(pyexecdir / "_fastjet_swig.so", fastjetdir / "_fastjet_swig.so")

setuptools.command.install.install.run(self)

Expand Down
9 changes: 0 additions & 9 deletions src/fastjet/version.py

This file was deleted.

Loading