Skip to content

Commit f91cfdb

Browse files
Fix third party dependencies & CI (#201)
Author: [email protected]
1 parent 33ebf86 commit f91cfdb

File tree

12 files changed

+118
-242
lines changed

12 files changed

+118
-242
lines changed

.github/workflows/main.yml

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,49 @@
1-
name: build
2-
3-
on:
1+
name: build
2+
on:
43
push:
5-
branches:
4+
branches:
65
- master
76
pull_request:
87
branches:
98
- master
10-
119
jobs:
12-
1310
build-debug:
1411
name: CMake Debug Build
15-
runs-on: ubuntu-20.04
16-
12+
runs-on: ubuntu-latest
1713
steps:
18-
- uses: actions/checkout@v2
19-
- name: install-eigen
14+
- uses: actions/checkout@v4
15+
- name: install-dependencies
2016
run: sudo apt install libeigen3-dev
2117
- name: configure
2218
run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug ..
2319
- name: build
2420
run: cmake --build build
25-
2621
build-release:
2722
name: CMake Release Build
28-
runs-on: ubuntu-20.04
29-
23+
runs-on: ubuntu-latest
3024
steps:
31-
- uses: actions/checkout@v2
32-
- name: install-eigen
25+
- uses: actions/checkout@v4
26+
- name: install-dependencies
3327
run: sudo apt install libeigen3-dev
3428
- name: configure
3529
run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release ..
3630
- name: build
3731
run: cmake --build build
3832
- name: test
3933
run: cd build && ctest all
40-
34+
python:
35+
name: Python Build
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
- name: setup-python
40+
uses: actions/setup-python@v5
41+
with: {python-version: '3.x'}
42+
- name: install-dependencies
43+
run: sudo apt install libeigen3-dev
44+
- name: upgrade-pip
45+
run: python -m pip install --upgrade pip
46+
- name: build
47+
run: python -m pip install ${{github.workspace}}
48+
- name: test
49+
run: python -c "import teaserpp_python; print('☺')"

CMakeLists.txt

Lines changed: 3 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10)
1+
cmake_minimum_required(VERSION 3.16)
22
project(teaserpp VERSION 1.0.0)
33

44
set(CMAKE_CXX_STANDARD 14)
@@ -18,10 +18,11 @@ if (DEFINED SKBUILD)
1818
endif ()
1919

2020
# Options
21+
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
2122
option(BUILD_TESTS "Build tests" ON)
2223
option(BUILD_TEASER_FPFH "Build TEASER++ wrappers for PCL FPFH estimation." OFF)
2324
option(BUILD_MATLAB_BINDINGS "Build MATLAB bindings" OFF)
24-
option(BUILD_PYTHON_BINDINGS "Build Python bindings" ON)
25+
option(BUILD_PYTHON_BINDINGS "Build Python bindings" OFF)
2526
option(BUILD_DOC "Build documentation" ON)
2627
option(BUILD_WITH_MARCH_NATIVE "Build with flag march=native" OFF)
2728
option(ENABLE_MKL "Try to use Eigen with MKL" OFF)
@@ -32,11 +33,6 @@ if (ENABLE_DIAGNOSTIC_PRINT)
3233
add_definitions(-DTEASER_DIAG_PRINT)
3334
endif ()
3435

35-
# Cache Variables
36-
if (NOT TEASERPP_PYTHON_VERSION)
37-
set(TEASERPP_PYTHON_VERSION "" CACHE STRING "Python version to use for TEASER++ bindings.")
38-
endif ()
39-
4036
# Find dependencies
4137
# Eigen3
4238
find_package(Eigen3 3.2 QUIET REQUIRED NO_MODULE)
@@ -78,44 +74,6 @@ if (BUILD_TEASER_FPFH)
7874
endif()
7975
endif ()
8076

81-
# googletest
82-
configure_file(cmake/GoogleTest.CMakeLists.txt.in googletest-download/CMakeLists.txt)
83-
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
84-
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/googletest-download")
85-
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
86-
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/googletest-download")
87-
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
88-
add_subdirectory("${CMAKE_BINARY_DIR}/googletest-src"
89-
"${CMAKE_BINARY_DIR}/googletest-build" EXCLUDE_FROM_ALL)
90-
91-
# pmc (Parallel Maximum Clique)
92-
configure_file(cmake/pmc.CMakeLists.txt.in pmc-download/CMakeLists.txt)
93-
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
94-
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/pmc-download")
95-
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
96-
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/pmc-download")
97-
add_subdirectory("${CMAKE_BINARY_DIR}/pmc-src"
98-
"${CMAKE_BINARY_DIR}/pmc-build")
99-
100-
# tinyply
101-
configure_file(cmake/tinyply.CMakeLists.txt.in tinyply-download/CMakeLists.txt)
102-
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
103-
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/tinyply-download")
104-
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
105-
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/tinyply-download")
106-
add_subdirectory("${CMAKE_BINARY_DIR}/tinyply-src"
107-
"${CMAKE_BINARY_DIR}/tinyply-build")
108-
target_include_directories(tinyply PUBLIC
109-
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/tinyply-src/source>)
110-
111-
# spectra
112-
configure_file(cmake/spectra.CMakeLists.txt.in spectra-download/CMakeLists.txt)
113-
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
114-
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/spectra-download")
115-
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
116-
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/spectra-download")
117-
set(SPECTRA_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/spectra-src/include")
118-
11977
# Building Targets
12078
set(TEASERPP_ROOT ${CMAKE_CURRENT_LIST_DIR})
12179
add_subdirectory(teaser)
@@ -135,17 +93,6 @@ if (BUILD_MATLAB_BINDINGS)
13593
endif ()
13694

13795
if (BUILD_PYTHON_BINDINGS)
138-
set(PYBIND11_PYTHON_VERSION ${TEASERPP_PYTHON_VERSION})
139-
140-
# download the pybind11 repo
141-
configure_file(cmake/pybind11.CMakeLists.txt.in pybind11-download/CMakeLists.txt)
142-
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
143-
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/pybind11-download")
144-
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
145-
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/pybind11-download")
146-
add_subdirectory("${CMAKE_BINARY_DIR}/pybind11-src"
147-
"${CMAKE_BINARY_DIR}/pybind11-build")
148-
14996
message(STATUS "TEASER++ Python binding will be built.")
15097
add_subdirectory(python)
15198
endif ()

cmake/GoogleTest.CMakeLists.txt.in

Lines changed: 0 additions & 14 deletions
This file was deleted.

cmake/pmc.CMakeLists.txt.in

Lines changed: 0 additions & 15 deletions
This file was deleted.

cmake/spectra.CMakeLists.txt.in

Lines changed: 0 additions & 15 deletions
This file was deleted.

cmake/tinyply.CMakeLists.txt.in

Lines changed: 0 additions & 15 deletions
This file was deleted.

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,15 @@ Homepage = "https://github.com/MIT-SPARK/TEASER-plusplus"
4646

4747
[tool.scikit-build]
4848
build-dir = "build/{wheel_tag}"
49-
build.verbose = false
49+
build.verbose = true
5050
cmake.version = ">=3.16"
5151
wheel.install-dir = "teaserpp_python.libs"
5252

53+
[tool.scikit-build.cmake.define]
54+
BUILD_PYTHON_BINDINGS = "ON"
55+
BUILD_TESTS = "OFF"
56+
BUILD_SHARED_LIBS = "OFF"
57+
5358
[tool.cibuildwheel]
5459
archs = ["auto64"]
5560
skip = ["*-musllinux*", "pp*", "cp36-*"]

python/CMakeLists.txt

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,12 @@
1-
cmake_minimum_required(VERSION 3.10)
2-
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
3-
4-
project(teaser_python_bindings)
1+
find_package(pybind11 REQUIRED)
52

63
pybind11_add_module(teaserpp_python teaserpp_python/teaserpp_python.cc)
7-
8-
message(STATUS "Python Interpreter Version: ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
9-
if (NOT (PYTHON_VERSION_MAJOR EQUAL 2 AND PYTHON_VERSION_MINOR EQUAL 7))
10-
# Hack: VTK used in PCL might add /usr/include/python2.7 to all targets'
11-
# INCLUDE_DIRECTORIES properties. We need to remove it.
12-
get_target_property(TEASERPY_NEW_INCLUDE_DIRS teaserpp_python INTERFACE_INCLUDE_DIRECTORIES)
13-
list(FILTER TEASERPY_NEW_INCLUDE_DIRS EXCLUDE REGEX ".*python2.7$")
14-
set_target_properties(teaserpp_python
15-
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${TEASERPY_NEW_INCLUDE_DIRS}")
16-
endif ()
17-
184
target_link_libraries(teaserpp_python PUBLIC teaser_registration)
195

206
# fix for clang
217
# see: https://github.com/pybind/pybind11/issues/1818
228
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
23-
target_compile_options(teaserpp_python PUBLIC -fno-sized-deallocation)
9+
target_compile_options(teaserpp_python PUBLIC -fno-sized-deallocation)
2410
endif ()
2511

2612
# make sure to output the build file to teaserpp_python folder
@@ -29,35 +15,8 @@ SET_TARGET_PROPERTIES(teaserpp_python
2915
OUTPUT_NAME "_teaserpp"
3016
PREFIX ""
3117
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/teaserpp_python"
32-
INSTALL_RPATH "$ORIGIN/../teaserpp_python.libs/lib;$ORIGIN/../../teaser/"
33-
BUILD_WITH_INSTALL_RPATH TRUE
3418
)
3519

36-
# copy package __init__.py file
37-
configure_file(teaserpp_python/__init__.py
38-
${CMAKE_CURRENT_BINARY_DIR}/teaserpp_python/__init__.py
39-
)
40-
41-
configure_file(teaserpp_python/__init__.py
42-
${CMAKE_CURRENT_BINARY_DIR}/teaserpp_python/_teaserpp.pyi
43-
)
44-
45-
# copy setup.py file
46-
configure_file(setup.py.in
47-
${CMAKE_CURRENT_BINARY_DIR}/setup.py
48-
)
49-
50-
file(COPY .
51-
DESTINATION .
52-
FILES_MATCHING
53-
PATTERN *.py)
54-
5520
if (DEFINED SKBUILD)
56-
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/teaserpp/
57-
DESTINATION "../teaserpp"
58-
FILES_MATCHING PATTERN "*.py"
59-
PATTERN "*.pyi"
60-
PATTERN "*.so"
61-
)
6221
install(TARGETS teaserpp_python DESTINATION "../teaserpp_python")
6322
endif ()

python/setup.py.in

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)