# Use CMake's modern FindPython support across all wheel platforms.
set(PYBIND11_FINDPYTHON ON)
find_package(pybind11 CONFIG REQUIRED)

# Creamos el módulo Python llamado _varsculpt
pybind11_add_module(_varsculpt MODULE
  varsculpt/cpp/c_api.cpp
  varsculpt/cpp/c_api_compute_boundaries.cc
  varsculpt/cpp/c_api_mdlp.cc
  varsculpt/cpp/c_api_preprocess.cc
  varsculpt/cpp/c_api_binning.cc
  varsculpt/cpp/c_api_analytics.cc
)

# Vinculamos el módulo Python con la librería del core C++
target_link_libraries(_varsculpt PRIVATE varsculpt_core)

# Let scikit-build-core install the extension from CMake's install tree.
# This is portable across single- and multi-config generators (MSVC/Xcode).
if(SKBUILD)
  set_target_properties(_varsculpt PROPERTIES
    BUILD_RPATH "$ORIGIN"
    INSTALL_RPATH "$ORIGIN"
  )

  install(
    TARGETS _varsculpt
    LIBRARY DESTINATION varsculpt
    RUNTIME DESTINATION varsculpt
  )
endif()
