forked from jaildesigner-jailgames/jaildoctors_dilemma
3.7 KiB
3.7 KiB
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:
- Build System Independence - Can compile with CMake, Make, or other build systems
- Offline Builds - No internet required during compilation
- Version Control - Exact versions committed to repository
- Portability - Works on any platform without external package managers
- Consistency - All team members use identical library versions
Using With Different Build Systems
CMake (Recommended)
# 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.
CXXFLAGS = -I./source -I./source/external/yaml-cpp/include
# Compile yaml-cpp sources and link
Manual Compilation
# 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
- Download the header file(s)
- Place in
source/external/ - Include in code:
#include "external/library.h"
Source Libraries
- Create subdirectory:
source/external/library-name/ - Place headers in
library-name/include/ - Place sources in
library-name/src/ - Update CMakeLists.txt:
add_subdirectory(source/external/library-name)
Updating Dependencies
yaml-cpp
To update yaml-cpp to a newer version:
cd source/external
rm -rf yaml-cpp
git clone https://github.com/jbeder/yaml-cpp.git
cd yaml-cpp
git checkout <version-tag> # e.g., 0.8.0
rm -rf .git # Remove git history to reduce size
STB Libraries
Download latest from: https://github.com/nothings/stb
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