Skip to content

Commit

Permalink
try scikit-build-core
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeplf committed Dec 21, 2023
1 parent d3464e1 commit cbf941a
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 21 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ install(
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

install(
EXPORT MorphIOTargets
NAMESPACE MorphIO::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/MorphIO
)
#install(
# EXPORT MorphIOTargets
# NAMESPACE MorphIO::
# DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/MorphIO
# )

install(
FILES ${CMAKE_CURRENT_LIST_DIR}/CMake/MorphIOConfig.cmake
Expand Down
5 changes: 3 additions & 2 deletions binds/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ if (NOT EXTERNAL_PYBIND11)
add_subdirectory(pybind11 EXCLUDE_FROM_ALL)
endif()

pybind11_add_module(_morphio SYSTEM
pybind11_add_module(_morphio
morphio.cpp

bind_enums.cpp
bind_immutable.cpp
bind_misc.cpp
Expand All @@ -17,3 +16,5 @@ target_link_libraries(_morphio
PRIVATE morphio_static
PRIVATE pybind11::module
)

install(TARGETS _morphio DESTINATION morphio)
71 changes: 70 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,74 @@
[build-system]
requires = ["setuptools>=24.2.0", "wheel", "cmake", "ninja"]
requires = [
"scikit-build-core",
"setuptools_scm>=8",
"cmake>=3.14",
"ninja",
"pybind11",
]
build-backend = "scikit_build_core.build"

[project]
name = "MorphIO"
description = "A neuron morphology IO library"
readme = "README.rst"
requires-python = ">=3.8"
license = { file = "LICENSE.txt" }
authors = [
{ name = "Blue Brain Project, EPFL" },
]
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"License :: OSI Approved :: Apache Software License v2.0",
]
dynamic = ["version"]
#dependencies = [
# "blueetl-core>=0.1.0",
#]

[tool.setuptools_scm]
#
# install_requires=install_requires,
# extras_require={
# 'docs': ['sphinx-bluebrain-theme'],
# },
# url='https://github.com/BlueBrain/MorphIO/',
# ext_modules=[CMakeExtension('morphio._morphio'),
# ],
# cmdclass={'build_ext': CMakeBuild,
# },
# packages=[],
# license="LGPLv3",
# zip_safe=False,
# use_scm_version=True,
# setup_requires=[
# 'setuptools_scm',
# ],
# python_requires=">=3.8",
#)

[tool.scikit-build]
cmake.targets = ["_morphio"]
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
wheel.packages = [ 'morphio', 'morphio.mut', 'morphio.vasculature' ]
cmake.args = [
"-DHIGHFIVE_EXAMPLES=OFF",
"-DHIGHFIVE_UNIT_TESTS=OFF",
'-DMORPHIO_TESTS=OFF',
]
#sdist.include = ["src/some_generated_file.txt"]
#sdist.exclude = [".github"]

[tool.pytest.ini_options]
testpaths = ["tests"]

#'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir,
#'-DMORPHIO_VERSION_STRING=' + self.distribution.get_version(),
#'-DPYTHON_EXECUTABLE=' + sys.executable,
6 changes: 0 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@
from setuptools.command.build_ext import build_ext


class CMakeExtension(Extension):
def __init__(self, name, sourcedir=''):
Extension.__init__(self, name, sources=[])
self.sourcedir = os.path.abspath(sourcedir)


class CMakeBuild(build_ext):
user_options = build_ext.user_options + [
("cmake-defs=", None, "Additional CMake definitions, comma split")
Expand Down
14 changes: 7 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ foreach(TARGET morphio_shared morphio_static)
target_link_libraries(${TARGET} PUBLIC gsl-lite PRIVATE HighFive lexertl)
endforeach(TARGET)

install(
# DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
TARGETS morphio_shared
EXPORT MorphIOTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION include
)
#install(
# # DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
# TARGETS morphio_shared
# EXPORT MorphIOTargets
# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
# PUBLIC_HEADER DESTINATION include
#)

0 comments on commit cbf941a

Please sign in to comment.