Skip to content

Commit d1e86b1

Browse files
authored
Merge pull request #41 from petrasvestartas/split_targets
Split bindings into separate targets.
2 parents a507e1f + 33e5fa3 commit d1e86b1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+9988
-2314
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
matrix:
1717
os: [ubuntu-latest, macos-latest, windows-latest]
18-
python: ["3.10", "3.11", "3.12"]
18+
python: ["3.10"]
1919

2020
steps:
2121
- uses: compas-dev/compas-actions.build@v4

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020

2121
### Changed
2222

23+
* Split binding into separate dynamic libraries.
24+
2325
### Removed
2426

2527

CMakeLists.txt

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -198,46 +198,43 @@ find_package(nanobind CONFIG REQUIRED)
198198
#
199199
# Important: If you add a new .cpp file, you must rebuild the project with:
200200
# pip install --no-build-isolation -ve . -Ceditable.rebuild=true
201-
file(GLOB CPP_SOURCES
202-
CONFIGURE_DEPENDS
203-
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
204-
)
205201

206-
# Verify we found all expected source files and remind about type handling
207-
message(STATUS "Found C++ source files (ensure proper type conversion in each):")
202+
# Enhanced PCH configuration
203+
if (ENABLE_PRECOMPILED_HEADERS)
204+
set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON)
205+
set(CMAKE_PCH_WARN_INVALID ON)
206+
endif()
208207

209-
foreach(source ${CPP_SOURCES})
210-
message(STATUS " ${source}")
211-
endforeach()
208+
# Function to add a nanobind module with include directories
209+
function(add_nanobind_module module_name source_file)
210+
nanobind_add_module(${module_name} STABLE_ABI NB_STATIC ${source_file})
212211

213-
nanobind_add_module(
214-
compas_cgal_ext
215-
STABLE_ABI
216-
NB_STATIC
217-
${CPP_SOURCES}
218-
)
212+
target_include_directories(${module_name} PRIVATE
213+
${CGAL_INCLUDE_DIR}
214+
${BOOST_INCLUDE_DIR}
215+
${EIGEN_INCLUDE_DIR}
216+
)
219217

220-
# Set include directories for the extension
221-
target_include_directories(compas_cgal_ext PRIVATE
222-
${CGAL_INCLUDE_DIR}
223-
${BOOST_INCLUDE_DIR}
224-
${EIGEN_INCLUDE_DIR}
225-
)
218+
add_dependencies(${module_name} external_downloads)
226219

227-
# Make sure external dependencies are downloaded before building the extension
228-
add_dependencies(compas_cgal_ext external_downloads)
220+
if (ENABLE_PRECOMPILED_HEADERS)
221+
target_precompile_headers(${module_name} PRIVATE src/compas.h)
222+
endif()
229223

230-
if (ENABLE_PRECOMPILED_HEADERS)
231-
# Enhanced PCH configuration
232-
set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON)
233-
set(CMAKE_PCH_WARN_INVALID ON)
224+
install(TARGETS ${module_name} LIBRARY DESTINATION compas_cgal)
225+
endfunction()
226+
227+
# Add new modules here
228+
add_nanobind_module(types_std src/types_std.cpp)
229+
add_nanobind_module(booleans_ext src/booleans.cpp)
230+
add_nanobind_module(meshing_ext src/meshing.cpp)
231+
add_nanobind_module(intersections_ext src/intersections.cpp)
232+
add_nanobind_module(measure_ext src/measure.cpp)
233+
add_nanobind_module(reconstruction_ext src/reconstruction.cpp)
234+
add_nanobind_module(skeletonization_ext src/skeletonization.cpp)
235+
add_nanobind_module(slicer_ext src/slicer.cpp)
236+
add_nanobind_module(straight_skeleton_2_ext src/straight_skeleton_2.cpp)
237+
add_nanobind_module(triangulation_ext src/triangulation.cpp)
238+
add_nanobind_module(subdivision_ext src/subdivision.cpp)
234239

235-
# Configure PCH for the extension
236-
target_precompile_headers(compas_cgal_ext
237-
PRIVATE
238-
src/compas.h
239-
)
240-
endif()
241240

242-
# Install directive for scikit-build-core
243-
install(TARGETS compas_cgal_ext LIBRARY DESTINATION compas_cgal)

data/elephant.off

Lines changed: 8336 additions & 1888 deletions
Large diffs are not rendered by default.

docs/api.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,5 @@ API Reference
66
:maxdepth: 1
77

88
api/compas_cgal.booleans
9-
api/compas_cgal.intersections
10-
api/compas_cgal.measure
119
api/compas_cgal.meshing
12-
api/compas_cgal.slicer
13-
api/compas_cgal.skeletonization
14-
api/compas_cgal.subdivision
15-
api/compas_cgal.triangulation
16-
api/compas_cgal.types
1710

docs/api/compas_cgal.intersections.rst

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

docs/api/compas_cgal.measure.rst

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

docs/api/compas_cgal.skeletonization.rst

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

docs/api/compas_cgal.slicer.rst

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

docs/api/compas_cgal.subdivision.rst

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

0 commit comments

Comments
 (0)