a7da4ea728
Каркас Python-пакета `cuframes`: - python/pyproject.toml — scikit-build-core конфиг - python/CMakeLists.txt — pybind11 module через FetchContent - python/src/_native.cpp — module entry, error таксономия, enum mirrors (PixelFormat, SubscriberMode), version - python/cuframes/__init__.py — re-export публичного API - python/tests/test_smoke.py — smoke tests без real subscribe - python/README.md — статус + build instructions - CMakeLists.txt — подключение python/ при BUILD_PYTHON_BINDINGS=ON Реальный subscriber/frame wrapper в следующих коммитах (tasks #198-#202). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
53 lines
1.8 KiB
CMake
53 lines
1.8 KiB
CMake
# Python bindings for cuframes — pybind11 module.
|
|
#
|
|
# Buildup: используется как subdirectory из root CMakeLists.txt при
|
|
# BUILD_PYTHON_BINDINGS=ON, либо standalone через scikit-build-core
|
|
# (см. pyproject.toml).
|
|
#
|
|
# Output: единый shared module `_native.so` который импортируется из
|
|
# Python package `cuframes` (cuframes/__init__.py re-export'ит публичный API).
|
|
|
|
include(FetchContent)
|
|
|
|
# pybind11 — header-only + helper functions. FetchContent чтобы не требовать
|
|
# system install; pinned tag для воспроизводимых билдов.
|
|
FetchContent_Declare(
|
|
pybind11
|
|
GIT_REPOSITORY https://github.com/pybind/pybind11.git
|
|
GIT_TAG v2.13.6
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
FetchContent_MakeAvailable(pybind11)
|
|
|
|
pybind11_add_module(_native MODULE
|
|
src/_native.cpp
|
|
)
|
|
|
|
target_include_directories(_native PRIVATE
|
|
${PROJECT_SOURCE_DIR}/include
|
|
)
|
|
|
|
target_link_libraries(_native PRIVATE
|
|
cuframes # imported target из libcuframes/CMakeLists.txt
|
|
)
|
|
|
|
# Версия модуля соответствует libcuframes (см. cuframes.h)
|
|
target_compile_definitions(_native PRIVATE
|
|
CUFRAMES_PY_BINDING_VERSION="${PROJECT_VERSION}"
|
|
)
|
|
|
|
set_target_properties(_native PROPERTIES
|
|
CXX_STANDARD 17
|
|
CXX_STANDARD_REQUIRED ON
|
|
CXX_VISIBILITY_PRESET hidden
|
|
INTERPROCEDURAL_OPTIMIZATION TRUE
|
|
)
|
|
|
|
# При scikit-build-core билде модуль попадает в wheel рядом с Python-исходниками
|
|
# пакета. При standalone CMake — устанавливается в site-packages по умолчанию.
|
|
if(SKBUILD)
|
|
install(TARGETS _native DESTINATION cuframes)
|
|
else()
|
|
install(TARGETS _native LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/cuframes)
|
|
endif()
|