Phichain is built with Rust and the Bevy game engine. This guide will walk you through setting up your development environment and building the project from source.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ivan-1f/phichain/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Required Software
Clone the Repository
Building the Project
Phichain is a workspace project containing multiple crates. The main binary is
phichain (the editor).Development Build
Build with optimized dependencies but faster compile times:- Project code compiled with minimal optimization (
opt-level = 1) - Dependencies compiled with full optimization (
opt-level = 3)
Release Build
Build all binaries with full optimizations:- Link-Time Optimization (LTO) enabled
- Single codegen unit for maximum optimization
- All debug symbols stripped
Build Artifacts
Compiled binaries are located in:- Debug builds:
target/debug/ - Release builds:
target/release/
phichain- Main chart editor applicationphichain-converter- Chart format conversion toolphichain-renderer- Chart rendering utility
Running Phichain
Running Tests
Run the full test suite:Code Quality Checks
The project enforces code quality through formatting and linting.Format Check
Clippy Lints
Run Clippy with project settings:type_complexity- Common in Bevy ECS systemstoo_many_arguments- Common in Bevy system parameters
Platform-Specific Builds
Build for specific targets:You may need to install the target with
rustup target add <target-triple> first.Troubleshooting
Compilation is very slow
Compilation is very slow
First-time builds can take 15-30 minutes due to Bevy and dependencies.Tips to speed up compilation:
- Use
cargo build(development) instead of--releaseduring development - Enable parallel compilation:
cargo build -j $(nproc) - Use a faster linker like
mold(Linux) orlld - Consider using
cargo-cheffor Docker builds
Linker errors on Linux
Linker errors on Linux
Ensure all system dependencies are installed:
Out of memory during compilation
Out of memory during compilation
Bevy projects can require significant RAM. Solutions:
- Reduce parallel jobs:
cargo build -j 2 - Close other applications
- Add swap space
- Use a development build instead of release
Git dependency issues (bevy_prototype_lyon)
Git dependency issues (bevy_prototype_lyon)
The project uses a git dependency for
bevy_prototype_lyon (Bevy 0.16 compatibility).If you encounter network issues:Runtime errors or missing assets
Runtime errors or missing assets
Ensure you run the binary from the project root directory:The application expects
assets/ and lang/ directories to be present.Build Configuration
The workspace is configured inCargo.toml with optimized profile settings:
Cargo.toml
Next Steps
Architecture
Learn about Phichain’s crate structure and design
Contributing
Start contributing to the project