fix(v1.0.1): VDE-016 root cause + VDE-017 submodule path
CI / Build & Test (push) Failing after 32s
CI / Release Build (push) Failing after 31s
Build & Test / build-and-test (push) Has been cancelled
Build & Test / python-bindings (push) Has been cancelled

VDE-016 (High): GCC two-phase lookup — root cause is anonymous namespace
- Move SSICurveData OUT of anonymous namespace into vde::brep
- Add #include <iterator> 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
This commit is contained in:
茂之钳
2026-07-27 23:34:18 +08:00
parent 7a955bac7f
commit b48ffec290
4 changed files with 91 additions and 27 deletions
+1 -1
View File
@@ -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
)
+30 -16
View File
@@ -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 <algorithm>`,但仍无法通过 GCC 编译。根本原因是 **匿名命名空间** 在 GCC 两阶段查找下不能被外部引用。
| 符号 | 所在命名空间 | 补了 using 但缺啥 |
|------|-------------|-------------------|
| `face_normal` | `vde::brep::` 或全局 | 缺少 `using` 声明或 `#include` |
| `face_bounds` | `vde::brep::` 或全局 | 同上 |
| `SSICurveData` | `vde::brep::{anonymous}::` | 匿名命名空间中的类型需要完全限定名 |
| `begin` / `end` | `std::` | 需要 `#include <iterator>` |
## 编译错误
## 剩余编译错误
```
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 <iterator>, 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 不会通过 `<algorithm>` 传递引入 `std::begin`/`std::end`,需要显式 `#include <iterator>`
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 <iterator>` 解决 `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 <iterator>
// 3. 添加 using vde::brep::ClassResult;
```
+48
View File
@@ -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
)
```
+12 -10
View File
@@ -10,6 +10,7 @@
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <iterator>
#include <limits>
#include <map>
#include <mutex>
@@ -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<Point3D> 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<Point3D> 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)
// ═══════════════════════════════════════════════════════════