diff --git a/Makefile b/Makefile index 98d92541..7ff8ab0d 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,15 @@ .PHONY: cpp -editable: - SETUPTOOLS_ENABLE_FEATURES="legacy-editable" pip install --verbose --prefix=$(shell python3 -m site --user-base) --editable ./python/ - install: @pip install --verbose ./python/ uninstall: @pip -v uninstall kiss_icp +editable: + @pip install scikit-build-core pyproject_metadata pathspec pybind11 ninja cmake + @pip install --no-build-isolation -ve ./python/ + cpp: @cmake -Bbuild cpp/kiss_icp/ @cmake --build build -j$(nproc --all) diff --git a/cpp/kiss_icp/3rdparty/eigen/eigen.cmake b/cpp/kiss_icp/3rdparty/eigen/eigen.cmake index 315b400c..7de1864b 100644 --- a/cpp/kiss_icp/3rdparty/eigen/eigen.cmake +++ b/cpp/kiss_icp/3rdparty/eigen/eigen.cmake @@ -32,8 +32,11 @@ set(EIGEN_BUILD_BLAS OFF CACHE BOOL "Don't build blas module") set(EIGEN_BUILD_LAPACK OFF CACHE BOOL "Don't build lapack module") include(FetchContent) -FetchContent_Declare(eigen SYSTEM URL https://github.com/nachovizzo/eigen/archive/refs/tags/3.4.90.tar.gz) -FetchContent_MakeAvailable(eigen) +FetchContent_Declare(eigen URL https://github.com/nachovizzo/eigen/archive/refs/tags/3.4.90.tar.gz) +if(NOT eigen_POPULATED) + FetchContent_Populate(eigen) + add_subdirectory(${eigen_SOURCE_DIR} ${eigen_BINARY_DIR} SYSTEM EXCLUDE_FROM_ALL) +endif() if(${CMAKE_VERSION} VERSION_LESS 3.25) get_target_property(eigen_include_dirs eigen INTERFACE_INCLUDE_DIRECTORIES) diff --git a/cpp/kiss_icp/3rdparty/tbb/tbb.cmake b/cpp/kiss_icp/3rdparty/tbb/tbb.cmake index fc98393c..576bfc64 100644 --- a/cpp/kiss_icp/3rdparty/tbb/tbb.cmake +++ b/cpp/kiss_icp/3rdparty/tbb/tbb.cmake @@ -28,8 +28,11 @@ option(TBB_STRICT OFF) option(TBB_TEST OFF) include(FetchContent) -FetchContent_Declare(tbb SYSTEM URL https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.8.0.tar.gz) -FetchContent_MakeAvailable(tbb) +FetchContent_Declare(tbb URL https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.8.0.tar.gz) +if(NOT tbb_POPULATED) + FetchContent_Populate(tbb) + add_subdirectory(${tbb_SOURCE_DIR} ${tbb_BINARY_DIR} SYSTEM EXCLUDE_FROM_ALL) +endif() if(${CMAKE_VERSION} VERSION_LESS 3.25) get_target_property(tbb_include_dirs tbb INTERFACE_INCLUDE_DIRECTORIES) diff --git a/cpp/kiss_icp/CMakeLists.txt b/cpp/kiss_icp/CMakeLists.txt index b62aca3d..d13144c2 100644 --- a/cpp/kiss_icp/CMakeLists.txt +++ b/cpp/kiss_icp/CMakeLists.txt @@ -24,11 +24,22 @@ cmake_minimum_required(VERSION 3.16...3.26) project(kiss_icp_cpp VERSION 0.2.10 LANGUAGES CXX) # Setup build options +option(USE_CCACHE "Build using Ccache if found on the path" ON) option(USE_SYSTEM_EIGEN3 "Use system pre-installed Eigen" ON) option(USE_SYSTEM_SOPHUS "Use system pre-installed Sophus" ON) option(USE_SYSTEM_TSLMAP "Use system pre-installed tsl_robin" ON) option(USE_SYSTEM_TBB "Use system pre-installed oneAPI/tbb" ON) +# ccache setup +if(USE_CCACHE) + find_program(CCACHE_PATH ccache) + if(CCACHE_PATH) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + message(STATUS "Using ccache: ${CCACHE_PATH}") + endif() +endif() + # Set build type (repeat here for C++ only consumers) set(CMAKE_BUILD_TYPE Release) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 9e7572db..99d1b4af 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -28,6 +28,10 @@ set(CMAKE_BUILD_TYPE Release) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(PYBIND11_NEWPYTHON ON) +find_package(Python COMPONENTS Interpreter Development.Module REQUIRED) +find_package(pybind11 CONFIG REQUIRED) + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../cpp/kiss_icp/) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../cpp/kiss_icp ${CMAKE_CURRENT_BINARY_DIR}/kiss_icp) else() diff --git a/python/README.md b/python/README.md index 8a05d11e..90de0415 100644 --- a/python/README.md +++ b/python/README.md @@ -58,9 +58,9 @@ This should print the following help message: ### Install Python API (developer mode) -If you plan to modify the code then you need to setup the dev dependencies, luckilly, the only real +If you plan to modify the code then you need to setup the dev dependencies, luckily, the only real requirements are a modern C++ compiler and the `pip` package manager, nothing else!, in Ubuntu-based -sytems this can be done with: +systems this can be done with: ```sh sudo apt install g++ python3-pip @@ -71,7 +71,7 @@ After that you can clone the code and install the python api: ```sh git clone https://github.com/PRBonn/kiss-icp.git cd kiss-icp -pip install --verbose . +make editable ``` ### Install Python API (expert mode) @@ -108,5 +108,3 @@ We envision KISS-ICP as a comunity-driven project, we love to see how the projec - -[![Star History Chart](https://api.star-history.com/svg?repos=PRBonn/kiss-icp&type=Date)](https://star-history.com/#PRBonn/kiss-icp&Date) diff --git a/python/kiss_icp/pybind/CMakeLists.txt b/python/kiss_icp/pybind/CMakeLists.txt index ca7c1de3..d1e14813 100644 --- a/python/kiss_icp/pybind/CMakeLists.txt +++ b/python/kiss_icp/pybind/CMakeLists.txt @@ -20,34 +20,6 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -# Simply ignore the warnings when using scikit-build as the build system -if(${SKBUILD}) - set(ignore ${PYTHON_NumPy_INCLUDE_DIRS}) - set(ignore ${Python3_EXECUTABLE}) - set(ignore ${Python3_INCLUDE_DIR}) - set(ignore ${Python3_LIBRARY}) - set(ignore ${Python3_NumPy_INCLUDE_DIRS}) - set(ignore ${Python_EXECUTABLE}) - set(ignore ${Python_INCLUDE_DIR}) - set(ignore ${Python_LIBRARY}) - set(ignore ${Python_NumPy_INCLUDE_DIRS}) - set(ignore ${Python3_FIND_REGISTRY}) - set(ignore ${Python3_ROOT_DIR}) - set(ignore ${Python_FIND_REGISTRY}) - set(ignore ${Python_ROOT_DIR}) -endif() - -option(USE_SYSTEM_PYBIND11 "Use system pre-installed pybind11" ON) -if(USE_SYSTEM_PYBIND11) - find_package(pybind11 QUIET) -endif() -if(NOT USE_SYSTEM_PYBIND11 OR NOT pybind11_FOUND) - set(USE_SYSTEM_PYBIND11 OFF) - include(${CMAKE_CURRENT_LIST_DIR}/pybind11/pybind11.cmake) -endif() - pybind11_add_module(kiss_icp_pybind MODULE kiss_icp_pybind.cpp) target_link_libraries(kiss_icp_pybind PRIVATE kiss_icp::core kiss_icp::metrics) -install(TARGETS kiss_icp_pybind DESTINATION . COMPONENT python_bindings) -add_custom_target(install_python_bindings ${CMAKE_COMMAND} -DCMAKE_INSTALL_COMPONENT=python_bindings -P - "${PROJECT_BINARY_DIR}/cmake_install.cmake" DEPENDS kiss_icp_pybind) +install(TARGETS kiss_icp_pybind DESTINATION .) diff --git a/python/kiss_icp/pybind/__init__.py b/python/kiss_icp/pybind/__init__.py deleted file mode 100644 index c4431a10..00000000 --- a/python/kiss_icp/pybind/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# MIT License -# -# Copyright (c) 2022 Ignacio Vizzo, Tiziano Guadagnino, Benedikt Mersch, Cyrill -# Stachniss. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. diff --git a/python/kiss_icp/pybind/pybind11/LICENSE b/python/kiss_icp/pybind/pybind11/LICENSE deleted file mode 100644 index e466b0df..00000000 --- a/python/kiss_icp/pybind/pybind11/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -Copyright (c) 2016 Wenzel Jakob , All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Please also refer to the file .github/CONTRIBUTING.md, which clarifies licensing of -external contributions to this project including patches, pull requests, etc. diff --git a/python/kiss_icp/pybind/pybind11/pybind11.cmake b/python/kiss_icp/pybind/pybind11/pybind11.cmake deleted file mode 100644 index 2cbf7ac2..00000000 --- a/python/kiss_icp/pybind/pybind11/pybind11.cmake +++ /dev/null @@ -1,27 +0,0 @@ -# MIT License -# -# Copyright (c) 2022 Ignacio Vizzo, Tiziano Guadagnino, Benedikt Mersch, Cyrill -# Stachniss. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -include(FetchContent) - -FetchContent_Declare(ext_pybind11 PREFIX pybind11 - URL https://github.com/pybind/pybind11/archive/refs/tags/v2.10.0.tar.gz) -FetchContent_MakeAvailable(ext_pybind11) diff --git a/python/pyproject.toml b/python/pyproject.toml index 2b66fb4a..b3c80350 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,11 +1,77 @@ [build-system] -requires = [ - "cmake", - "ninja", - "scikit-build>=0.17.4", - "setuptools<66.0.0", # https://github.com/pypa/setuptools/issues/3772 +requires = ["scikit_build_core", "pybind11"] +build-backend = "scikit_build_core.build" + +[project] +name = "kiss-icp" +version = "0.2.10" +description = "Simple yet effective 3D LiDAR-Odometry registration pipeline" +readme = "README.md" +authors = [ + { name = "Ignacio Vizzo", email = "ignaciovizzo@gmail.com" }, +] +requires-python = ">=3.7" +keywords = [ + "LiDAR", + "Localization", + "Odometry", + "SLAM", +] +classifiers = [ + "Intended Audience :: Developers", + "Intended Audience :: Education", + "Intended Audience :: Other Audience", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Operating System :: MacOS", + "Operating System :: Microsoft :: Windows", + "Operating System :: Unix", + "Programming Language :: C++", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", +] +dependencies = [ + "natsort", + "numpy", + "plyfile", + "pydantic <2", + "pyquaternion", + "rich", + "tqdm", + "typer[all]>=0.6.0", +] + +[project.optional-dependencies] +all = [ + "open3d>=0.13", + "ouster-sdk>=0.7.1", + "pyntcloud", + "PyYAML", + "trimesh", +] +visualizer = [ + "open3d>=0.13", ] -build-backend = "setuptools.build_meta" + +[project.scripts] +kiss_icp_pipeline = "kiss_icp.tools.cmd:run" + +[project.urls] +Homepage = "https://github.com/PRBonn/kiss-icp" + +[tool.scikit-build] +build-dir = "build/{wheel_tag}" +cmake.verbose = false +cmake.minimum-version = "3.16" +editable.mode = "redirect" +editable.rebuild = true +editable.verbose = true +sdist.exclude = ["pybind/"] +wheel.install-dir = "kiss_icp/pybind/" [tool.black] line-length = 100 diff --git a/python/setup.cfg b/python/setup.cfg deleted file mode 100644 index bf8f2e95..00000000 --- a/python/setup.cfg +++ /dev/null @@ -1,28 +0,0 @@ -[metadata] -name = kiss_icp -version = 0.2.10 -author = Ignacio Vizzo -author_email = ignaciovizzo@gmail.com -description = Simple yet effective 3D LiDAR-Odometry registration pipeline -long_description = file:README.md, -long_description_content_type = text/markdown -url = https://github.com/PRBonn/kiss-icp -license = MIT -license_files = LICENSE -keywords = SLAM, LiDAR, Odometry, Localization, -classifiers = - Operating System :: Unix - Operating System :: MacOS - Operating System :: Microsoft :: Windows - Programming Language :: C++ - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Intended Audience :: Developers - Intended Audience :: Education - Intended Audience :: Other Audience - Intended Audience :: Science/Research - License :: OSI Approved :: MIT License diff --git a/python/setup.py b/python/setup.py deleted file mode 100644 index 9b9cbf42..00000000 --- a/python/setup.py +++ /dev/null @@ -1,53 +0,0 @@ -# MIT License -# -# Copyright (c) 2022 Ignacio Vizzo, Tiziano Guadagnino, Benedikt Mersch, Cyrill -# Stachniss. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -from setuptools import find_packages -from skbuild import setup - -setup( - packages=find_packages(), - cmake_install_dir="kiss_icp/pybind/", - cmake_install_target="install_python_bindings", - entry_points={"console_scripts": ["kiss_icp_pipeline=kiss_icp.tools.cmd:run"]}, - install_requires=[ - "natsort", - "numpy", - "plyfile", - "pydantic <2", - "pyquaternion", - "rich", - "tqdm", - "typer[all]>=0.6.0", - ], - extras_require={ - "visualizer": [ - "open3d>=0.13", - ], - "all": [ - "PyYAML", - "open3d>=0.13", - "ouster-sdk>=0.7.1", - "pyntcloud", - "trimesh", - ], - }, -)