forked from jaildesigner-jailgames/jaildoctors_dilemma
migrat jail_audio a un .hpp (segur que ja no funciona res)
This commit is contained in:
63
source/external/README.md
vendored
63
source/external/README.md
vendored
@@ -10,7 +10,7 @@ This directory contains third-party libraries used by JailDoctor's Dilemma.
|
||||
| **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 |
|
||||
| **fkYAML** | v3.x | Header-only | YAML parsing for room files |
|
||||
|
||||
## Structure
|
||||
|
||||
@@ -21,11 +21,7 @@ external/
|
||||
├── 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
|
||||
└── fkyaml_node.hpp # fkYAML parser library (header-only)
|
||||
```
|
||||
|
||||
## Why Dependencies Are Here
|
||||
@@ -42,28 +38,30 @@ All dependencies are kept in `source/external/` for several reasons:
|
||||
|
||||
### CMake (Recommended)
|
||||
```cmake
|
||||
# yaml-cpp
|
||||
add_subdirectory(source/external/yaml-cpp)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE yaml-cpp::yaml-cpp)
|
||||
|
||||
# Include path
|
||||
# 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 -I./source/external/yaml-cpp/include
|
||||
# Compile yaml-cpp sources and link
|
||||
CXXFLAGS = -I./source
|
||||
# Compile jail_audio.cpp and link with your sources
|
||||
```
|
||||
|
||||
### Manual Compilation
|
||||
```bash
|
||||
# Compile yaml-cpp sources
|
||||
g++ -c source/external/yaml-cpp/src/*.cpp -I./source/external/yaml-cpp/include
|
||||
# Compile jail_audio (only non-header-only library)
|
||||
g++ -c source/external/jail_audio.cpp -I./source
|
||||
|
||||
# Link with your project
|
||||
# Compile your project sources
|
||||
g++ -c source/game/*.cpp -I./source
|
||||
|
||||
# Link everything together
|
||||
g++ *.o -o game -lSDL3
|
||||
```
|
||||
|
||||
@@ -75,35 +73,34 @@ g++ *.o -o game -lSDL3
|
||||
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:
|
||||
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
|
||||
add_subdirectory(source/external/library-name)
|
||||
# Most dependencies are header-only
|
||||
# For source libraries, add to SOURCES list
|
||||
```
|
||||
|
||||
## Updating Dependencies
|
||||
|
||||
### yaml-cpp
|
||||
To update yaml-cpp to a newer version:
|
||||
### fkYAML
|
||||
To update fkYAML 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 <version-tag> # e.g., 0.8.0
|
||||
rm -rf .git # Remove git history to reduce size
|
||||
# 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.c
|
||||
curl -O https://raw.githubusercontent.com/nothings/stb/master/stb_vorbis.h
|
||||
```
|
||||
|
||||
## License Information
|
||||
@@ -113,13 +110,13 @@ 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
|
||||
- **fkYAML** - MIT License
|
||||
|
||||
See individual library directories/files for full license texts.
|
||||
See individual library 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
|
||||
- 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
|
||||
|
||||
Reference in New Issue
Block a user