Skip to content

Commit

Permalink
migrating to scikit-build-core
Browse files Browse the repository at this point in the history
  • Loading branch information
dfm committed Nov 3, 2023
1 parent 388c8ba commit 7c80b74
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 140 deletions.
23 changes: 15 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
cmake_minimum_required(VERSION 3.12...3.18)
project(kepler_jax LANGUAGES CXX)
cmake_minimum_required(VERSION 3.15...3.26)
project(${SKBUILD_PROJECT_NAME} LANGUAGES C CXX)
message(STATUS "Using CMake version: " ${CMAKE_VERSION})

message(STATUS "Using CMake version " ${CMAKE_VERSION})

find_package(Python COMPONENTS Interpreter Development REQUIRED)
# Find pybind11
set(PYBIND11_NEWPYTHON ON)
find_package(pybind11 CONFIG REQUIRED)

# find_package(Python COMPONENTS Interpreter Development REQUIRED)
# find_package(pybind11 CONFIG REQUIRED)

include_directories(${CMAKE_CURRENT_LIST_DIR}/lib)

# CPU op library
pybind11_add_module(cpu_ops ${CMAKE_CURRENT_LIST_DIR}/lib/cpu_ops.cc)
install(TARGETS cpu_ops DESTINATION kepler_jax)
install(TARGETS cpu_ops LIBRARY DESTINATION .)

# Include the CUDA extensions if possible
include(CheckLanguage)
check_language(CUDA)

if (KEPLER_JAX_CUDA)
if(CMAKE_CUDA_COMPILER)
enable_language(CUDA)
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
pybind11_add_module(
gpu_ops
${CMAKE_CURRENT_LIST_DIR}/lib/kernels.cc.cu
${CMAKE_CURRENT_LIST_DIR}/lib/gpu_ops.cc)
install(TARGETS gpu_ops DESTINATION kepler_jax)
install(TARGETS gpu_ops LIBRARY DESTINATION .)
else()
message(STATUS "Building without CUDA")
endif()
25 changes: 23 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
[project]
name = "kepler_jax"
description = "A simple demonstration of how you can extend JAX with custom C++ and CUDA ops"
readme = "README.md"
authors = [{ name = "Dan Foreman-Mackey", email = "[email protected]" }]
requires-python = ">=3.9"
license = { file = "LICENSE" }
urls = { Homepage = "https://github.com/dfm/extending-jax" }
dependencies = ["jax>=0.4.16"]
dynamic = ["version"]

[project.optional-dependencies]
test = ["pytest"]

[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4", "pybind11>=2.6", "cmake"]
build-backend = "setuptools.build_meta"
requires = ["pybind11>=2.6", "scikit-build-core>=0.5"]
build-backend = "scikit_build_core.build"

[tool.scikit-build]
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
sdist.include = ["src/kepler_jax/kepler_jax_version.py"]
wheel.install-dir = "kepler_jax"
minimum-version = "0.5"
build-dir = "build/{wheel_tag}"

[tool.setuptools_scm]
write_to = "src/kepler_jax/kepler_jax_version.py"
130 changes: 0 additions & 130 deletions setup.py

This file was deleted.

0 comments on commit 7c80b74

Please sign in to comment.