Skip to content

Conversation

@petrasvestartas
Copy link
Collaborator

@petrasvestartas petrasvestartas commented Mar 19, 2025

Split bindings into separate targets using the following CMake workflow:

# Add the booleans module
nanobind_add_module(
    booleans_ext
    STABLE_ABI
    NB_STATIC
    src/booleans.cpp)

# Set include directories for the extension
target_include_directories(booleans_ext PRIVATE
    ${CGAL_INCLUDE_DIR}
    ${BOOST_INCLUDE_DIR}
    ${EIGEN_INCLUDE_DIR}
)

# Add the meshing module
nanobind_add_module(
    meshing_ext
    STABLE_ABI
    NB_STATIC
    src/meshing.cpp)

# Set include directories for the extension
target_include_directories(meshing_ext PRIVATE
    ${CGAL_INCLUDE_DIR}
    ${BOOST_INCLUDE_DIR}
    ${EIGEN_INCLUDE_DIR}
)

# Make sure external dependencies are downloaded before building the extension
add_dependencies(booleans_ext external_downloads)
add_dependencies(meshing_ext external_downloads)

# Install directive for scikit-build-core
install(TARGETS booleans_ext LIBRARY DESTINATION compas_cgal)
install(TARGETS meshing_ext LIBRARY DESTINATION compas_cgal)

from compas.plugins import plugin

from compas_cgal.compas_cgal_ext import booleans
from compas_cgal import booleans_ext
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we not add this _ext suffix? it is ugly :)

@tomvanmele tomvanmele merged commit d1e86b1 into compas-dev:main Mar 20, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants