Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 18 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,21 @@ cython_debug/
.ruff_cache/

# PyPI configuration file
.pypirc
.pypirc

# CMake stuff
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
CMakeUserPresets.json

# VSCode/ium stuff
.vscode/
43 changes: 43 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.17.2...3.29)
project(${SKBUILD_PROJECT_NAME} LANGUAGES C Fortran)

find_package(Python COMPONENTS Development.Module NumPy REQUIRED)

# F2PY include path
execute_process(
COMMAND "${Python_EXECUTABLE}" -c
"import numpy.f2py; print(numpy.f2py.get_include())"
OUTPUT_VARIABLE F2PY_INCLUDE_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)

# fortranobject object library
add_library(fortranobject OBJECT "${F2PY_INCLUDE_DIR}/fortranobject.c")
target_link_libraries(fortranobject PUBLIC Python::NumPy)
target_include_directories(fortranobject PUBLIC "${F2PY_INCLUDE_DIR}")
set_property(TARGET fortranobject PROPERTY POSITION_INDEPENDENT_CODE ON)

# Auto-generate wrappers
add_custom_command(
OUTPUT bicubicmodule.c bicubic-f2pywrappers.f
DEPENDS lensit/bicubic/bicubic.f90
COMMAND "${Python_EXECUTABLE}" -m numpy.f2py
"${CMAKE_CURRENT_SOURCE_DIR}/lensit/bicubic/bicubic.f90"
-m bicubic --lower
VERBATIM)

# Compile extension in the right namespace
python_add_library(
bicubic MODULE
"${CMAKE_CURRENT_BINARY_DIR}/bicubicmodule.c"
"${CMAKE_CURRENT_BINARY_DIR}/bicubic-f2pywrappers.f"
"${CMAKE_CURRENT_SOURCE_DIR}/lensit/bicubic/bicubic.f90"
WITH_SOABI)

target_link_libraries(bicubic PRIVATE fortranobject)


# Automatically install to correct package dir
install(TARGETS bicubic
LIBRARY DESTINATION lensit/bicubic)

message(STATUS "Installing to: ${CMAKE_INSTALL_PREFIX}")
45 changes: 45 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[build-system]
requires = [
"scikit-build-core",
"cmake>=3.18",
"ninja",
"numpy"
]
build-backend = "scikit_build_core.build"

[project]
name = "lensit"
version = "0.0.0"
dependencies = [
"numpy",
"scipy",
"pyfftw",
"finufft",
"six"
]
authors = [
{name = "Julien Carron", email="to.jcarron@gmail.com"}
]
description = "CMB lensing flat-sky quadratic and iterative estimation tools"
readme = "README.md"
license = "MIT-0"
license-files = ["LICENSE.txt"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Astronomy",
"Programming Language :: Python :: 3",
]

[project.optional-dependencies]
dev = ["pytest"]
extra = ["mpi4py"]

[project.urls]
Documentation = "https://lensit.readthedocs.io/"
Repository = "https://github.com/carronj/LensIt"
Issues = "https://github.com/carronj/LensIt/issues"


[tool.scikit-build]
wheel.packages = ["lensit"]
5 changes: 0 additions & 5 deletions requirements.txt

This file was deleted.

29 changes: 0 additions & 29 deletions setup.py

This file was deleted.