gmsh_ffi 0.1.0

Safe Rust FFI bindings to the Gmsh SDK
# Gmsh Rust Bindings

本项目提供 Rust 对 [Gmsh](https://gmsh.info/) SDK 的 FFI 绑定。

## 生成 `src/bindings.rs`

绑定文件由 [bindgen](https://github.com/rust-lang/rust-bindgen) 命令行工具从 Gmsh 的 C API 头文件生成。**不要在构建时自动生成**,因为 Windows 下 bindgen 库可能无法正常运行,且头文件很少变动,手动生成即可。

### 前提

- 已安装 [bindgen]https://github.com/rust-lang/rust-bindgen#command-line 命令行工具:
  ```bash
  cargo install bindgen-cli@0.72
  ```
- Gmsh SDK 已下载到 `external/<platform>/gmsh/`(运行 `cargo build` 会自动下载)。

### 命令

```bash
bindgen \
  --allowlist-function "gmsh.*" \
  --use-core \
  --no-layout-tests \
  --generate-inline-functions \
  --blocklist-type "__int32|__int64|__int128" \
  -o src/bindings.rs \
  external/<platform>/gmsh/include/gmshc.h
```

其中 `<platform>` 根据您的操作系统选择:
- Linux: `linux`
- Windows: `windows`
- macOS (Intel): `macos`
- macOS (Apple Silicon): `macos_arm`

**Windows 示例:**
```bash
bindgen ^
  --allowlist-function "gmsh.*" ^
  --use-core ^
  --no-layout-tests ^
  --generate-inline-functions ^
  -o src\bindings.rs ^
  external\windows\gmsh\include\gmshc.h
```

### 注意事项

- 绑定仅在安装有对应平台 Gmsh SDK 的开发机上生成一次,生成结果提交到版本管理,后续其他开发者直接使用。
- 如需升级 Gmsh SDK 版本,更新 `build.rs` 中的 `GMSH_VERSION` 常量后重新执行上述命令。