Files
create/src/Mod/Assembly/Solver/CMakeLists.txt
forbes 7ea0078ba3
All checks were successful
Build and Test / build (pull_request) Successful in 29m19s
feat(kcsolve): pybind11 bindings and Python solver support
Add the kcsolve pybind11 module exposing the KCSolve C++ API to Python:

- PyIKCSolver trampoline enabling Python IKCSolver subclasses
- Bindings for all 5 enums, 10 structs, IKCSolver, and OndselAdapter
- Module functions wrapping SolverRegistry (available, load, joints_for,
  set_default, get_default, register_solver)
- PySolverHolder class forwarding virtual calls with GIL acquisition
- register_solver() for runtime Python solver registration

IKCSolver constructor moved from protected to public for pybind11
trampoline access (class remains abstract via 3 pure virtuals).

Includes 16 Python tests covering module import, type bindings, enum
values, registry functions, Python solver subclassing, and full
register/load/solve round-trip.

Closes #288
2026-02-19 18:04:49 -06:00

47 lines
916 B
CMake

# SPDX-License-Identifier: LGPL-2.1-or-later
set(KCSolve_SRCS
KCSolveGlobal.h
Types.h
IKCSolver.h
SolverRegistry.h
SolverRegistry.cpp
OndselAdapter.h
OndselAdapter.cpp
)
add_library(KCSolve SHARED ${KCSolve_SRCS})
target_include_directories(KCSolve
PUBLIC
${CMAKE_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/src
)
target_compile_definitions(KCSolve
PRIVATE
CMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}"
)
target_link_libraries(KCSolve
PRIVATE
FreeCADBase
OndselSolver
)
# Platform-specific dynamic loading library
if(NOT WIN32)
target_link_libraries(KCSolve PRIVATE ${CMAKE_DL_LIBS})
endif()
if(FREECAD_WARN_ERROR)
target_compile_warn_error(KCSolve)
endif()
SET_BIN_DIR(KCSolve KCSolve /Mod/Assembly)
INSTALL(TARGETS KCSolve DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(FREECAD_USE_PYBIND11)
add_subdirectory(bindings)
endif()