Files
jaildoctors_dilemma/source/external/README.md

123 lines
3.7 KiB
Markdown

# External Dependencies
This directory contains third-party libraries used by JailDoctor's Dilemma.
## Current Dependencies
| Library | Version | Type | Purpose |
|---------|---------|------|---------|
| **jail_audio** | Custom | Source (.cpp/.h) | Audio playback engine (OGG/WAV) |
| **stb_image** | v2.x | Header-only | Image loading (PNG, GIF) |
| **stb_vorbis** | v1.x | Header-only | OGG Vorbis audio decoding |
| **json** | nlohmann/json | Header-only | JSON parsing (if needed) |
| **fkYAML** | v3.x | Header-only | YAML parsing for room files |
## Structure
```
external/
├── jail_audio.cpp # Custom audio library implementation
├── jail_audio.h # C interface for jail_audio
├── stb_image.h # STB image loader (header-only)
├── stb_vorbis.h # STB Vorbis decoder (header-only)
├── json.hpp # nlohmann JSON library (header-only)
└── fkyaml_node.hpp # fkYAML parser library (header-only)
```
## Why Dependencies Are Here
All dependencies are kept in `source/external/` for several reasons:
1. **Build System Independence** - Can compile with CMake, Make, or other build systems
2. **Offline Builds** - No internet required during compilation
3. **Version Control** - Exact versions committed to repository
4. **Portability** - Works on any platform without external package managers
5. **Consistency** - All team members use identical library versions
## Using With Different Build Systems
### CMake (Recommended)
```cmake
# Include path for header-only libraries (fkYAML, json, stb)
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_SOURCE_DIR}/source")
# All external dependencies are header-only except jail_audio
# jail_audio.cpp is compiled as part of the main build
```
### Makefile
See `Makefile.example` in the project root for a complete example.
```makefile
CXXFLAGS = -I./source
# Compile jail_audio.cpp and link with your sources
```
### Manual Compilation
```bash
# Compile jail_audio (only non-header-only library)
g++ -c source/external/jail_audio.cpp -I./source
# Compile your project sources
g++ -c source/game/*.cpp -I./source
# Link everything together
g++ *.o -o game -lSDL3
```
## Adding New Dependencies
### Header-Only Libraries
1. Download the header file(s)
2. Place in `source/external/`
3. Include in code: `#include "external/library.h"`
### Source Libraries
1. Place source files (.cpp) directly in `source/external/`
2. Place header files (.h/.hpp) in `source/external/`
3. Add to CMakeLists.txt if needed:
```cmake
# Most dependencies are header-only
# For source libraries, add to SOURCES list
```
## Updating Dependencies
### fkYAML
To update fkYAML to a newer version:
```bash
cd source/external
# Download the single-header version from the releases page
curl -L -O https://github.com/fktn-k/fkYAML/releases/download/v3.x.x/fkyaml_node.hpp
```
Or download from: https://github.com/fktn-k/fkYAML/releases
### STB Libraries
Download latest from: https://github.com/nothings/stb
```bash
cd source/external
curl -O https://raw.githubusercontent.com/nothings/stb/master/stb_image.h
curl -O https://raw.githubusercontent.com/nothings/stb/master/stb_vorbis.h
```
## License Information
Each library has its own license:
- **jail_audio** - Custom (see source files)
- **stb libraries** - Public Domain / MIT
- **nlohmann/json** - MIT License
- **fkYAML** - MIT License
See individual library files for full license texts.
## Notes
- All dependencies are compatible with C++20
- Most libraries are header-only and require no compilation
- Only jail_audio (source library) is compiled as part of the main build
- Keep dependencies minimal to reduce build times and binary size