|
1 |
| -# MacroLibX |
| 1 | +# MacroLibX [![linux clang workflow][linux-clang_badge]][linux-clang_wf] [![linux gcc workflow][linux-gcc_badge]][linux-gcc_wf] [![macos workflow][macos_badge]][macos_wf] |
| 2 | +###### A rewrite of 42 School's MiniLibX using SDL2 and Vulkan. |
2 | 3 |
|
3 |
| -[](https://github.com/420verfl0w/MacroLibX/actions/workflows/linux_clang.yml) |
4 |
| -[](https://github.com/420verfl0w/MacroLibX/actions/workflows/linux_gcc.yml) |
5 |
| -[](https://github.com/420verfl0w/MacroLibX/actions/workflows/macos_x86.yml) |
| 4 | +The goal of this version is to provide a light, fast, and modern graphical tool while keeping the same API. |
6 | 5 |
|
7 |
| -A rewrite of School 42's MiniLibX using SDL2 and Vulkan. The goal of this version is to give a light, fast and modern graphical tool while keeping the same API as the version currently used at 42. |
| 6 | +## 🖥️ Installation |
8 | 7 |
|
9 |
| -# Installation |
| 8 | +### Dependencies |
10 | 9 |
|
11 |
| -## Linux |
12 |
| -Dependances : |
| 10 | +You first need to install the proper dependencies for your operating-system. |
13 | 11 |
|
14 |
| -For Ubuntu/Debian |
15 |
| -```bash |
16 |
| -~ sudo apt update |
17 |
| -~ sudo apt install libsdl2-2.0-0 libsdl2-dev build-essential |
| 12 | +#### 🐧 Linux |
| 13 | + |
| 14 | +Here are a few common cases for different Linux distributions: |
| 15 | + |
| 16 | +<details> |
| 17 | + <summary> |
| 18 | + For <a href="https://ubuntu.com">Ubuntu</a>/<a href="https://debian.org">Debian</a>-based distros: |
| 19 | + </summary> |
| 20 | +<pre><code><!-- |
| 21 | +-->sudo apt update |
| 22 | +sudo apt install libsdl2-2.0-0 libsdl2-dev build-essential |
| 23 | +</code></pre> |
| 24 | +</details> |
| 25 | + |
| 26 | +<details> |
| 27 | + <summary> |
| 28 | + For <a href="https://archlinux.org">ArchLinux</a>-based distros: |
| 29 | + </summary> |
| 30 | +<pre><code>sudo pacman -S sdl2</code></pre> |
| 31 | +</details> |
| 32 | + |
| 33 | +#### 🍎 macOS |
| 34 | + |
| 35 | +[MacroLibX](#) on macOS requires [SDL2](#) and [MoltenVK](https://github.com/KhronosGroup/MoltenVK). You can install both using the [Homebrew](https://brew.sh) package manager: |
| 36 | +```sh |
| 37 | +brew install molten-vk |
| 38 | +brew install SDL2 |
18 | 39 | ```
|
19 | 40 |
|
20 |
| -For Arch based distros |
| 41 | +### Clone and Build |
| 42 | + |
| 43 | +Finally, you can clone the Git repository. When inside it, run the GNU `make` command to compile MacroLibX. |
21 | 44 | ```bash
|
22 |
| -~ sudo pacman -S sdl2 |
| 45 | +git clone https://github.com/420verfl0w/MacroLibX.git |
| 46 | +cd MacroLibX |
| 47 | +make |
23 | 48 | ```
|
24 | 49 |
|
25 |
| -### MacOS |
26 |
| -Dependances : |
27 |
| -* [MoltenVK](https://github.com/KhronosGroup/MoltenVK/) |
28 |
| -* SDL2 `brew install SDL2` |
| 50 | +## 🔨 Compile your project |
29 | 51 |
|
30 |
| -# Get MacroLibX |
| 52 | +To compile your project with MacroLibX, you just provide the shared library path in your compilation/linking command: |
31 | 53 |
|
32 |
| -```bash |
33 |
| -~ git clone https://github.com/420verfl0w/MacroLibX.git |
34 |
| -~ cd MacroLibX |
35 |
| -~ make |
| 54 | +```sh |
| 55 | +clang myApp.c /path/to/MacroLibX/libmlx.so -lSDL2 |
36 | 56 | ```
|
37 | 57 |
|
38 |
| -# Compile your project |
| 58 | +### ⚠️ Troubleshooting |
39 | 59 |
|
40 |
| -```bash |
41 |
| -clang myApp.c MacroLibX/libmlx.so -lSDL2 |
| 60 | +#### If you run into glitches when writing or reading pixels from images |
| 61 | + |
| 62 | +You need to add `IMAGES_OPTIMIZED=false` to your `make` command: |
| 63 | + |
| 64 | +```sh |
| 65 | +# In your cloned environment, inside the MacroLibX folder |
| 66 | +make IMAGES_OPTIMIZED=false |
42 | 67 | ```
|
43 | 68 |
|
44 |
| -## /!\ If you run into glitches when writing or reading pixels from images /!\ |
| 69 | +## License |
45 | 70 |
|
46 |
| -You need to add `IMAGES_OPTIMIZED=false` to your make mlx command |
| 71 | +This project and all its files, except the [`third_party`](./third_party) directory or unless otherwise mentionned, are licenced under the [GNU GPL v2.0](./LICENSE). |
47 | 72 |
|
48 |
| -```bash |
49 |
| -~ git clone https://github.com/420verfl0w/MacroLibX.git |
50 |
| -~ cd MacroLibX |
51 |
| -~ make IMAGES_OPTIMIZED=false |
52 |
| -``` |
| 73 | +<!-- Links --> |
| 74 | + |
| 75 | +[linux-clang_badge]: https://github.com/420verfl0w/MacroLibX/actions/workflows/linux_clang.yml/badge.svg |
| 76 | +[linux-gcc_badge]: https://github.com/420verfl0w/MacroLibX/actions/workflows/linux_gcc.yml/badge.svg |
| 77 | +[macos_badge]: https://github.com/420verfl0w/MacroLibX/actions/workflows/macos_x86.yml/badge.svg |
| 78 | +[linux-clang_wf]: https://github.com/420verfl0w/MacroLibX/actions/workflows/linux_clang.yml |
| 79 | +[linux-gcc_wf]: https://github.com/420verfl0w/MacroLibX/actions/workflows/linux_gcc.yml |
| 80 | +[macos_wf]: https://github.com/420verfl0w/MacroLibX/actions/workflows/macos_x86.yml |
0 commit comments