CMake Policy Implementation changes.

This commit is contained in:
BadQuanta
2026-05-16 21:37:44 +00:00
parent 15bb051619
commit 689d5e979d
12 changed files with 765 additions and 166 deletions
+49 -156
View File
@@ -6,9 +6,25 @@ Use classes without declaring pointers to them, knowing that copying or referenc
## Dependencies
- holodeck-grid
- [hdk-grid](https://git.ufp.institute/ufp/hdk-grid.git)
- [SDL3](https://www.libsdl.org/)
## Building
To build the hdk-sdl, checkout the source, change into the source directory, make a build directory & run the following commands in the root of the repository:
```bash
git clone https://git.ufp.institute/ufp/hdk-sdl.git
mkdir build-hdk-sdl
cd build-hdk-sdl
cmake ../hdk-sdl
cmake --build .
```
This may require the building of SDL if your system does not have the required version installed.
See [SDL3 Build Dependencies](https://wiki.libsdl.org/SDL3/README-linux#build-dependencies) if SDL fails to build on your machine.
## Naming Conventions
API that is 1 to 1 with SDL with otherwise minimal wrapping will be as close to the original SDL function call as possible: for example, `SDL_CreateWindow` will be wrapped by `hd::sdl::Window::Create`.
@@ -29,162 +45,39 @@ Within `include/hdk/sdl` there are folders for each SDL3 header files, and withi
With this entirely header-only and inline design, there is no need for a corresponding .cpp and the resulting compiled code should be as efficient as if you were using the raw SDL3 API directly, while still benefiting from the safety and convenience of C++ RAII and wrapper classes.
## SDL API Coverage
## Dependency Resolution
Most links are from Links from [API by Category](https://wiki.libsdl.org/SDL3/APIByCategory), then those respective pages are used to fill in the rest of the checklist.
`hdk-sdl` resolves SDL3 with a system-first policy by default:
In progress/complete:
1. Try `find_package(SDL3 <minimum>)`.
2. If unavailable or too old, fall back to `FetchContent`.
- By category:
- [ ] BASICS
- [~] [Category Video][]
- [x] `hdk::sdl::Window`
- [x] `hdk::sdl::Display`
- [ ] [Category Surface][]
- [x] `hdk::sdl::Surface`
- [ ] [Category Main][]
- [ ] [Category Init][]
- [ ] [Category Hints][]
- [x] [Category Properties][]
- [ ] [Category Error][]
- [ ] [Category Log][]
- [ ] [Category Assert][]
- [ ] [Category Version][]
- [ ] [Category Events][]
- [ ] [Category Keyboard][]
- [ ] [Category Keycode][]
- [ ] [Category Scancode][]
- [ ] [Category Mouse][]
- [ ] [Category Joystick][]
- [ ] [Category Gamepad][]
- [ ] [Category Touch][]
- [ ] [Category Pen][]
- [ ] [Category Sensor][]
- [ ] [Category HIDAPI][]
- [ ] [Category Render][]
- [ ] [Category Pixels][]
- [ ] [Category Blendmode][]
- [ ] [Category Rect][]
- [ ] [Category Clipboard][]
- [ ] [Category Vulkan][]
- [ ] [Category Metal][]
- [ ] [Category Camera][]
- [ ] HAPTIC
- [ ] [Category Haptic][]
- [ ] AUDIO
- [ ] [Category Audio][]
- [ ] GPU
- [ ] [Category GPU][]
- [ ] Time
- [ ] [Category Timer][]
- [ ] [Category Time][]
- [ ] THREADS
- [ ] [Category Thread][]
- [ ] [Category Mutex][]
- [ ] [Category Atomic][]
- [ ] FILE I/O
- [ ] [Category Filesystem][]
- [ ] [Category Storage][]
- [ ] [Category IOStream][]
- [ ] [Category AsyncIO][]
- [ ] PLATFORM
- [ ] [Category Platform][]
- [ ] [Category CPUInfo][]
- [ ] [Category Intrinsics][]
- [ ] [Category Endian][]
- [ ] [Category Bits][]
- [ ] MISC
- [N] [Category Shared Object][]
- [ ] [Category Process][]
- [ ] [Category Power][]
- [ ] [Category Messagebox][]
- [ ] [Category Dialog][]
- [ ] [Category Tray][]
- [ ] [Category Locale][]
- [ ] [Category System][]
- [ ] [Category Stdinc][]
- [ ] [Category GUID][]
- [ ] [Category Misc][]
Relevant CMake options:
<!--A-->
[Category Shared Object]: <https://wiki.libsdl.org/SDL3/CategorySharedObject>
[Category Assert]: https://wiki.libsdl.org/SDL3/CategoryAssert
[Category AsyncIO]: <https://wiki.libsdl.org/SDL3/CategoryAsyncIO>
[Category Atomic]: <https://wiki.libsdl.org/SDL3/CategoryAtomic>
[Category Audio]: <https://wiki.libsdl.org/SDL3/CategoryAudio>
<!--B-->
[Category Bits]: <https://wiki.libsdl.org/SDL3/CategoryBits>
[Category Blendmode]: <https://wiki.libsdl.org/SDL3/CategoryBlendmode>
<!--C-->
[Category Camera]: <https://wiki.libsdl.org/SDL3/CategoryCamera>
[Category CPUInfo]: <https://wiki.libsdl.org/SDL3/CategoryCPUInfo>
<!--D-->
[Category Dialog]: <https://wiki.libsdl.org/SDL3/CategoryDialog>
<!--E-->
[Category Endian]: <https://wiki.libsdl.org/SDL3/CategoryEndian>
[Category Error]: https://wiki.libsdl.org/SDL3/CategoryError
[Category Events]: <https://wiki.libsdl.org/SDL3/CategoryEvents>
<!--F-->
[Category Filesystem]: <https://wiki.libsdl.org/SDL3/CategoryFilesystem>
<!--G-->
[Category Gamepad]: <https://wiki.libsdl.org/SDL3/CategoryGamepad>
[Category GPU]: <https://wiki.libsdl.org/SDL3/CategoryGPU>
[Category GUID]: <https://wiki.libsdl.org/SDL3/CategoryGUID>
<!--H-->
[Category Haptic]: <https://wiki.libsdl.org/SDL3/CategoryHaptic>
[Category HIDAPI]: <https://wiki.libsdl.org/SDL3/CategoryHIDAPI>
[Category Hints]: https://wiki.libsdl.org/SDL3/CategoryHints
<!--I-->
[Category Init]: https://wiki.libsdl.org/SDL3/CategoryInit
[Category Intrinsics]: <https://wiki.libsdl.org/SDL3/CategoryIntrinsics>
[Category IOStream]: <https://wiki.libsdl.org/SDL3/CategoryIOStream>
<!--J-->
[Category Joystick]: <https://wiki.libsdl.org/SDL3/CategoryJoystick>
<!--K-->
[Category Keyboard]: <https://wiki.libsdl.org/SDL3/CategoryKeyboard>
[Category Keycode]: <https://wiki.libsdl.org/SDL3/CategoryKeycode>
<!--L-->
[Category Locale]: <https://wiki.libsdl.org/SDL3/CategoryLocale>
[Category Log]: https://wiki.libsdl.org/SDL3/CategoryLog
<!--M-->
[Category Main]: https://wiki.libsdl.org/SDL3/CategoryMain
[Category Messagebox]: <https://wiki.libsdl.org/SDL3/CategoryMessagebox>
[Category Metal]: <https://wiki.libsdl.org/SDL3/CategoryMetal>
[Category Misc]: <https://wiki.libsdl.org/SDL3/CategoryMisc>
[Category Mouse]: <https://wiki.libsdl.org/SDL3/CategoryMouse>
[Category Mutex]: <https://wiki.libsdl.org/SDL3/CategoryMutex>
<!--N-->
<!--O-->
<!--P-->
[Category Pen]: <https://wiki.libsdl.org/SDL3/CategoryPen>
[Category Pixels]: <https://wiki.libsdl.org/SDL3/CategoryPixels>
[Category Platform]: <https://wiki.libsdl.org/SDL3/CategoryPlatform>
[Category Power]: <https://wiki.libsdl.org/SDL3/CategoryPower>
[Category Process]: <https://wiki.libsdl.org/SDL3/CategoryProcess>
[Category Properties]: https://wiki.libsdl.org/SDL3/CategoryProperties
<!--Q-->
<!--R-->
[Category Rect]: <https://wiki.libsdl.org/SDL3/CategoryRect>
[Category Render]: <https://wiki.libsdl.org/SDL3/CategoryRender>
<!--S-->
[Category Scancode]: <https://wiki.libsdl.org/SDL3/CategoryScancode>
[Category Sensor]: <https://wiki.libsdl.org/SDL3/CategorySensor>
[Category Stdinc]: <https://wiki.libsdl.org/SDL3/CategoryStdinc>
[Category Storage]: <https://wiki.libsdl.org/SDL3/CategoryStorage>
[Category Surface]: <https://wiki.libsdl.org/SDL3/CategorySurface>
[Category System]: <https://wiki.libsdl.org/SDL3/CategorySystem>
<!--T-->
[Category Thread]: <https://wiki.libsdl.org/SDL3/CategoryThread>
[Category Time]: <https://wiki.libsdl.org/SDL3/CategoryTime>
[Category Timer]: <https://wiki.libsdl.org/SDL3/CategoryTimer>
[Category Touch]: <https://wiki.libsdl.org/SDL3/CategoryTouch>
[Category Tray]: <https://wiki.libsdl.org/SDL3/CategoryTray>
<!--U-->
<!--V-->
[Category Version]: https://wiki.libsdl.org/SDL3/CategoryVersion
[Category Video]: https://wiki.libsdl.org/SDL3/CategoryVideo
[Category Vulkan]: <https://wiki.libsdl.org/SDL3/CategoryVulkan>
<!--W-->
<!--X-->
<!--Y-->
<!--Z-->
- `HDK_SDL_SYSTEM_SDL3`
- `HDK_SDL_FETCH_SDL3_FALLBACK`
- `HDK_SDL_MIN_SDL3_VERSION`
## Example Assets
When building examples, `hdk-sdl` resolves shared assets in this order:
1. Repository checkout assets (when building inside the HDK monorepo)
2. Installed `hdk-assets` package with minimum version
3. `FetchContent` fallback from `HDK_SDL_EXAMPLES_ASSETS_GIT_REPOSITORY`
Relevant CMake options:
- `HDK_SDL_EXAMPLES_FETCH_ASSETS`
- `HDK_SDL_EXAMPLES_ASSETS_MIN_VERSION`
- `HDK_SDL_EXAMPLES_ASSETS_GIT_REPOSITORY`
- `HDK_SDL_EXAMPLES_ASSETS_GIT_TAG`
## Installation Layout
Installed examples and assets are organized under one prefix using GNU install dirs.
- Example binaries: `${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}`
- Shared assets: `${CMAKE_INSTALL_PREFIX}/${HDK_SDL_EXAMPLES_INSTALL_ASSETSDIR}`
The default shared assets directory is `assets`, giving `${CMAKE_INSTALL_PREFIX}/assets`.