Getting Started
🖥️ Installation
Dependencies
There are some dependencies you need to install on your system to use the MacroLibX.
🐧 Linux
Here are a few common cases for different Linux distributions:
For Ubuntu/Debian-based distros:
sudo apt updatesudo apt install libsdl2-2.0-0 libsdl2-dev build-essentialFor ArchLinux-based distros:
sudo pacman -S sdl2Note that you need to have up do date video drivers with libvulkan.so installed.
🍎 MacOS
MacroLibX on MacOS requires SDL2 and MoltenVK. You can install both using the Homebrew package manager:
brew install molten-vkbrew install SDL2🪟 Windows
To build on Windows you may need to use the xmake build. Here’s how you can use it.
Clone and Build
Finally, you can clone the Git repository. When inside it, run the GNU make command to compile MacroLibX.
git clone https://github.com/seekrs/MacroLibX.gitcd MacroLibXmake🔨 Compilation
To compile your project with MacroLibX, you just provide the shared library path in your compilation/linking command:
clang myApp.c /path/to/MacroLibX/[libmlx.so/libmlx.dylib/libmlx.dll] -lSDL2And you can enjoy your project
⚙️ Some compilation configurations
Compile mode
By default the mlx is built in release mode but you can switch to debug by using make DEBUG=true or make debug.
Safety
MacroLibX has a strong safety support, mainly by checking every pointer that you pass to it. But this safety has a cost that can be avoided by enabling DISABLE_ALL_SAFETIES=true before compiling but don’t be afraid to recieve segmentation faults from the mlx.
Set the toolchain
If you want to use GCC to build the mlx you can use make TOOLCHAIN=gcc
Force the integrated GPU (not recommended)
You can force the mlx to use your integrated GPU by using make FORCE_INTEGRATED_GPU=true. Note that there are a lot of chances that your application crashes by using that.
Dump the graphics memory
The mlx can dump it’s graphics memory use to json files every two seconds by enabling this option make GRAPHICS_MEMORY_DUMP=true.