Build polish (#18)

Improve build process and documentation.
Improved ray versus capsule accuracy.
UI improvements
This commit is contained in:
Erin Catto 2026-06-28 10:44:34 -07:00 • committed by GitHub
commit 69037feaba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 1719 additions and 158 deletions

View file

@ -49,6 +49,19 @@ Box3D is a 3D physics engine for games.
- Install [git](https://git-scm.com/)
- Ensure these run from the command line
## Building with CMake presets
The presets in `CMakePresets.json` give one build flow on every platform and are picked up automatically by Visual Studio, VS Code, and CLion (open the folder and choose a preset). From the command line:
- Windows: `cmake --preset windows` then `cmake --build --preset windows-release`
- Linux: `cmake --preset linux-release` then `cmake --build --preset linux-release`
- macOS: `cmake --preset macos` then `cmake --build --preset macos-release`
Run the samples app (must be in the Box3D directory).
- Bash: `./build/bin/Release/samples`
- Cmd: `.\build\bin\Release\samples.exe`
## Building for Visual Studio
- Install [Visual Studio](https://visualstudio.microsoft.com/)
@ -77,6 +90,42 @@ Box3D is a 3D physics engine for games.
- cmake --build . --config Release
- cmake --install . (might need sudo)
## Using Box3D in your project
The core library has no dependencies beyond the C runtime (and `libm` on Unix). Linking it
gives you the `box3d::box3d` target. When Box3D is consumed as a subproject it builds the
library only; samples, tests, and benchmarks are skipped.
The recommended path is FetchContent, which pins a tag and needs no separate install step:
```cmake
include(FetchContent)
FetchContent_Declare(box3d
GIT_REPOSITORY https://github.com/erincatto/box3d.git
GIT_TAG v0.1.0)
FetchContent_MakeAvailable(box3d)
target_link_libraries(my_app PRIVATE box3d::box3d)
```
For a vendored copy or git submodule, point `add_subdirectory` at it:
```cmake
add_subdirectory(extern/box3d)
target_link_libraries(my_app PRIVATE box3d::box3d)
```
To use a copy installed with `cmake --install`, find the package:
```cmake
find_package(box3d 0.1 REQUIRED)
target_link_libraries(my_app PRIVATE box3d::box3d)
```
See [`docs/hello.md`](docs/hello.md) for a minimal first program.
## Compatibility
The Box3D library and samples build and run on Windows, Linux, and Mac.