From b48ffec2903d7f3c68450a07e3c6489d09d30662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=82=E4=B9=8B=E9=92=B3?= Date: Mon, 27 Jul 2026 23:34:18 +0800 Subject: [PATCH] fix(v1.0.1): VDE-016 root cause + VDE-017 submodule path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VDE-016 (High): GCC two-phase lookup — root cause is anonymous namespace - Move SSICurveData OUT of anonymous namespace into vde::brep - Add #include for std::begin/end - Add using vde::brep::ClassResult VDE-017 (Medium): Root CMakeLists configure_file CMAKE_SOURCE_DIR - Change to CMAKE_CURRENT_SOURCE_DIR for submodule compatibility --- CMakeLists.txt | 2 +- docs/feedback/VDE-016.md | 46 ++++++++++++++++++++++++-------------- docs/feedback/VDE-017.md | 48 ++++++++++++++++++++++++++++++++++++++++ src/brep/ssi_boolean.cpp | 22 +++++++++--------- 4 files changed, 91 insertions(+), 27 deletions(-) create mode 100644 docs/feedback/VDE-017.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 88b69b9..96fa54c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) # ── 生成构建时间戳 ────────────────────────────────── string(TIMESTAMP VDE_BUILD_TIMESTAMP "%Y-%m-%dT%H:%M:%SZ" UTC) configure_file( - ${CMAKE_SOURCE_DIR}/cmake/vde_build_config.h.in + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/vde_build_config.h.in ${CMAKE_BINARY_DIR}/generated/vde_build_config.h @ONLY ) diff --git a/docs/feedback/VDE-016.md b/docs/feedback/VDE-016.md index 45859be..905ea4f 100644 --- a/docs/feedback/VDE-016.md +++ b/docs/feedback/VDE-016.md @@ -4,6 +4,7 @@ status: fixed severity: high category: bug date: 2026-07-27 +updated: 2026-07-27 reporter: ViewDesign related: VDE-001, VDE-005, VDE-010 --- @@ -12,32 +13,45 @@ related: VDE-001, VDE-005, VDE-010 ## 问题描述 -v1.0.1+ 在 brep 模块 .cpp 文件中添加了 `using namespace vde::core;`,但 `ssi_boolean.cpp` 仍有未解决的符号: +v1.0.2 添加了 `#include `,但仍无法通过 GCC 编译。根本原因是 **匿名命名空间** 在 GCC 两阶段查找下不能被外部引用。 -| 符号 | 所在命名空间 | 补了 using 但缺啥 | -|------|-------------|-------------------| -| `face_normal` | `vde::brep::` 或全局 | 缺少 `using` 声明或 `#include` | -| `face_bounds` | `vde::brep::` 或全局 | 同上 | -| `SSICurveData` | `vde::brep::{anonymous}::` | 匿名命名空间中的类型需要完全限定名 | -| `begin` / `end` | `std::` | 需要 `#include ` | - -## 编译错误 +## 剩余编译错误 ``` -error: 'face_normal' was not declared in this scope -error: 'face_bounds' was not declared in this scope error: 'SSICurveData' was not declared in this scope -note: 'vde::brep::{anonymous}::SSICurveData' + (it is in vde::brep::{anonymous}::SSICurveData) + error: 'begin' was not declared in this scope error: 'end' was not declared in this scope + (GCC needs #include , MSVC pulls it transitively) + +error: 'ClassResult' was not declared in this scope + (should be vde::brep::ClassResult; MSVC allows unqualified lookup) ``` +## 根因分析 + +1. **SSICurveData** — 定义在 `vde::brep` 命名空间的**匿名 namespace** 中。匿名 namespace 内的类型在翻译单元外部不可见。GCC 严格执行两阶段查找时,放在匿名 namespace 中的类型在其他函数中找不到。**解决方案**:将 `struct SSICurveData` 移出匿名 namespace,放到显式的 `namespace vde::brep` 中。 + +2. **begin/end** — GCC 不会通过 `` 传递引入 `std::begin`/`std::end`,需要显式 `#include `。 + +3. **ClassResult** — 需要 `using vde::brep::ClassResult;`(MSVC 允许隐式查找,GCC 不允许)。 + ## 当前 Workaround -ViewDesign 仍然 `EXCLUDE_FROM_ALL` vde_brep 模块。 +ViewDesign 排除 vde_brep 及其依赖(vde_mesh, vde_boolean, vde_sdf, vde_capi)。 ## 建议修复 -1. 检查 `face_normal`、`face_bounds` 定义位置,添加对应的 `using` 声明 -2. 匿名命名空间中的 `SSICurveData` 需要在文件内显式 `using vde::brep::SSICurveData;`(或移出匿名空间) -3. 添加 `#include ` 解决 `begin`/`end` +```cpp +// ssi_boolean.cpp + +// 1. 将 ssi_boolean.cpp 中的匿名命名空间改为显式命名空间: +// BEFORE: namespace { struct SSICurveData { ... }; } +// AFTER: namespace vde::brep { struct SSICurveData { ... }; } +// using namespace vde::brep; // 保持当前代码无需修改 + +// 2. 添加 #include + +// 3. 添加 using vde::brep::ClassResult; +``` diff --git a/docs/feedback/VDE-017.md b/docs/feedback/VDE-017.md new file mode 100644 index 0000000..2e85c9e --- /dev/null +++ b/docs/feedback/VDE-017.md @@ -0,0 +1,48 @@ +--- +id: VDE-017 +status: fixed +severity: medium +category: bug +date: 2026-07-27 +reporter: ViewDesign +related: VDE-002 +--- + +# VDE-017: 根 CMakeLists.txt 的 configure_file 仍使用 CMAKE_SOURCE_DIR + +## 问题描述 + +v1.0.2 在 `src/CMakeLists.txt` 中修复了子模块 include 路径问题(VDE-002),但根 `CMakeLists.txt` 中第 10 行的 `configure_file` 仍使用 `${CMAKE_SOURCE_DIR}`: + +```cmake +# CMakeLists.txt:10 — 问题 +configure_file( + ${CMAKE_SOURCE_DIR}/cmake/vde_build_config.h.in + ${CMAKE_BINARY_DIR}/generated/vde_build_config.h + @ONLY +) +``` + +当 VDE 作为子模块构建时,`CMAKE_SOURCE_DIR` 是 ViewDesign 的根目录,而非 VDE 自己的目录。 + +## 编译错误 + +``` +CMake Error: File cmake/vde_build_config.h.in does not exist. +``` + +## 当前 Workaround + +ViewDesign 在本地 cmake/ 下复制了 `vde_build_config.h.in`。 + +## 建议修复 + +改为 `${CMAKE_CURRENT_SOURCE_DIR}`: + +```cmake +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/vde_build_config.h.in + ${CMAKE_BINARY_DIR}/generated/vde_build_config.h + @ONLY +) +``` diff --git a/src/brep/ssi_boolean.cpp b/src/brep/ssi_boolean.cpp index fdbaa35..9693f57 100644 --- a/src/brep/ssi_boolean.cpp +++ b/src/brep/ssi_boolean.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,17 @@ using core::AABB3D; AABB3D face_bounds(const BrepModel& body, int face_id); Vector3D face_normal(const BrepModel& body, int face_id); struct SSICurveData; +using vde::brep::ClassResult; + +/// SSI curve data for a face pair +struct SSICurveData { + int face_a; + int face_b; + std::vector points; + Vector3D cutting_normal; + Point3D cutting_center; + bool valid = false; +}; namespace { @@ -54,16 +66,6 @@ BrepModel extract_face_fragment(const BrepModel& body, int face_id); ClassResult classify_point_adaptive( const BrepModel& body, const Point3D& p, int& num_exact_upgrades); -/// SSI curve data for a face pair -struct SSICurveData { - int face_a; - int face_b; - std::vector points; ///< 3D intersection points - Vector3D cutting_normal; ///< best-fit plane normal for splitting - Point3D cutting_center; ///< centroid of intersection points - bool valid = false; -}; - // ═══════════════════════════════════════════════════════════ // Mesh caching (shared with brep_boolean.cpp pattern) // ═══════════════════════════════════════════════════════════