# 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) | | **yaml-cpp** | v0.8.0 | Source library | 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) └── yaml-cpp/ # YAML parser library ├── include/ # Public headers │ └── yaml-cpp/ ├── src/ # Source files (.cpp) └── CMakeLists.txt # Build configuration ``` ## 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 # yaml-cpp add_subdirectory(source/external/yaml-cpp) target_link_libraries(${PROJECT_NAME} PRIVATE yaml-cpp::yaml-cpp) # Include path target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_SOURCE_DIR}/source") ``` ### Makefile See `Makefile.example` in the project root for a complete example. ```makefile CXXFLAGS = -I./source -I./source/external/yaml-cpp/include # Compile yaml-cpp sources and link ``` ### Manual Compilation ```bash # Compile yaml-cpp sources g++ -c source/external/yaml-cpp/src/*.cpp -I./source/external/yaml-cpp/include # Link with your project 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. Create subdirectory: `source/external/library-name/` 2. Place headers in `library-name/include/` 3. Place sources in `library-name/src/` 4. Update CMakeLists.txt: ```cmake add_subdirectory(source/external/library-name) ``` ## Updating Dependencies ### yaml-cpp To update yaml-cpp to a newer version: ```bash cd source/external rm -rf yaml-cpp git clone https://github.com/jbeder/yaml-cpp.git cd yaml-cpp git checkout # e.g., 0.8.0 rm -rf .git # Remove git history to reduce size ``` ### 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.c ``` ## License Information Each library has its own license: - **jail_audio** - Custom (see source files) - **stb libraries** - Public Domain / MIT - **nlohmann/json** - MIT License - **yaml-cpp** - MIT License See individual library directories/files for full license texts. ## Notes - All dependencies are compatible with C++20 - Header-only libraries require no compilation - Source libraries (yaml-cpp, jail_audio) are compiled as part of the main build - Keep dependencies minimal to reduce build times and binary size