https://github.com/osfabias/dementia.c
For when your memory starts losing track...
https://github.com/osfabias/dementia.c
c cmake library memory-management
Last synced: about 2 months ago
JSON representation
For when your memory starts losing track...
- Host: GitHub
- URL: https://github.com/osfabias/dementia.c
- Owner: osfabias
- License: apache-2.0
- Created: 2025-11-09T10:11:24.000Z (8 months ago)
- Default Branch: 0.1
- Last Pushed: 2025-11-09T13:10:50.000Z (8 months ago)
- Last Synced: 2025-11-09T13:19:27.227Z (8 months ago)
- Topics: c, cmake, library, memory-management
- Language: C
- Homepage:
- Size: 25.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dementia.c ðŸ§
`dementia.c` is a C library for memory management. It helps you to keep track of all your memory.
## Table of Contents
- [Building the Project](#building-the-project)
- [Build Options](#build-options)
- [Using as a CMake Subdirectory](#using-as-a-cmake-subdirectory)
## Building the Project
### Prerequisites
- CMake 3.16 or higher
- C17 compatible compiler (GCC, Clang, MSVC)
- Git (for cloning)
### Basic Build
```bash
# Clone the repository
git clone git@github.com:osfabias/dementia.c.git
cd dementia
# Create build directory
mkdir build
cd build
# Configure and build
cmake ..
make
```
### Build with Specific Options
```bash
# Build with all features enabled
cmake -DDEMENTIA_BUILD_SHARED=ON -DDEMENTIA_BUILD_EXAMPLE=ON -DDEMENTIA_BUILD_TESTS=ON ..
# Build in Release mode
cmake -DCMAKE_BUILD_TYPE=Release ..
```
## Build Options
The project supports several CMake options to customize the build:
| Option | Default | Description |
|--------|---------|-------------|
| `CMAKE_BUILD_TYPE` | `Debug` | Build type: `Debug`, `Release`, `RelWithDebInfo`, `MinSizeRel` |
| `DEMENTIA_BUILD_SHARED` | `OFF` | Build library as a shared library instead of static |
| `DEMENTIA_BUILD_EXAMPLE` | `ON` (standalone) | Build example program demonstrating library usage |
| `DEMENTIA_BUILD_TESTS` | `ON` (standalone) | Build test programs |
### Build Type Details
- **Debug**: Includes debug symbols, no optimization, enables `__DEMENTIA_DEBUG__` macro
- **Release**: Optimized for performance, no debug symbols
- **RelWithDebInfo**: Optimized with debug symbols
- **MinSizeRel**: Optimized for minimal size
### Compiler-Specific Features
- **GCC/Clang**: Uses `-Wall -Wextra -Wpedantic` with additional warnings
- **MSVC**: Uses `/W4` for high warning level
- **All**: Position-independent code enabled, C17 standard enforced
## Using as a CMake Subdirectory
To use this library in your own CMake project:
```cmake
# Add the library as a subdirectory
add_subdirectory(dementia)
# Link the library to your target
target_link_libraries(your_target PRIVATE dementia)
```
The library will be built as a static library by default. To use as a shared library:
```cmake
set(DEMENTIA_BUILD_SHARED ON)
add_subdirectory(dementia)
target_link_libraries(your_target PRIVATE dementia)
```