Files
ViewDesignEngine/python/setup.py
T
茂之钳 bd37f2249d
CI / Build & Test (push) Failing after 33s
CI / Release Build (push) Failing after 32s
feat: Python 绑定 — pybind11 核心/曲线/网格模块
- 使用 pybind11 v2.11.1 (FetchContent) 构建 _vde 原生模块
- 模块化结构: bind_core.cpp / bind_curves.cpp / bind_mesh.cpp
- 暴露核心类型: Point2D, Point3D, Vector3D, AABB3D, Polygon2D
- 暴露曲线: BezierCurve, BSplineCurve, NurbsCurve
- 暴露网格: delaunay_2d/3d, DelaunayResult, HalfedgeMesh
- 变换函数: translate, rotate, scale 等
- Python 包 vde/ 含 __init__.py 及子模块封装
- setup.py 支持 pip install -e . 可编辑安装
- VDE_BUILD_PYTHON CMake 选项 (默认 OFF),通过 -DVDE_BUILD_PYTHON=ON 启用
2026-07-24 03:58:19 +00:00

70 lines
2.1 KiB
Python

"""
ViewDesignEngine — CAD computational geometry engine.
Build and install:
pip install -e . # editable install
pip install . # regular install
Requires:
- CMake >= 3.16
- C++17 compiler
- Eigen3 (auto-fetched if not found)
"""
from setuptools import setup, find_packages
from pybind11.setup_helpers import Pybind11Extension, build_ext
import sys
from pathlib import Path
# ── Configure the native extension ──────────────────
ext_modules = [
Pybind11Extension(
"vde._vde",
sorted([
"src/bind_module.cpp",
"src/bind_core.cpp",
"src/bind_curves.cpp",
"src/bind_mesh.cpp",
]),
include_dirs=[
"../include", # vde headers
],
extra_compile_args=["-std=c++17"],
# Propagate Eigen3 (set up via CMake or system path)
cxx_std=17,
),
]
setup(
name="vde",
version="1.0.0",
author="ViewDesignEngine Contributors",
description="CAD computational geometry engine",
long_description=Path(__file__).parent.joinpath("..", "README.md").read_text(
encoding="utf-8"
) if Path(__file__).parent.joinpath("..", "README.md").exists() else "",
long_description_content_type="text/markdown",
url="https://github.com/ViewDesignEngine/ViewDesignEngine",
packages=find_packages(),
ext_modules=ext_modules,
cmdclass={"build_ext": build_ext},
python_requires=">=3.8",
install_requires=[
"pybind11>=2.11.0",
],
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Programming Language :: C++",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
],
zip_safe=False,
)