Skip to content

airone01/ft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

284 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ft

Last commit License Stars Issues Repo Size Zig workflow status

ft is a monorepo of all my projects related to 42. It's mainly meant for personal archiving, but I also share some cool stuff.


Foreword

This is a monorepository, meaning these projects are tightly coupled and share dependencies to work properly.

Why Zig instead of Make? The 42 curriculum relies heavily on GNU Make to teach students the fundamentals of compilation. However, maintaining 30+ nearly identical Makefiles in a monorepo quickly becomes tedious. Because I enjoy DevOps and reproducibility, I migrated this repository to the Zig build system. I now only generate a standard Makefile and clean the repo right before pushing a project for grading. I used to use Bazel to build my projects, but it's somewhat incompatible with Nix, so I moved to the Zig build system.

Caution

A natural side effect of this Zig setup is that it makes it harder to blindly copy-paste my projects and submit them as your own. While deterring cheating wasn't my primary technical goal, I fully support the result. Copying defeats the core principles of 42 and goes against what I personally believe in. This repository is meant to serve as an example of what you can build at this school, not as a shortcut. It's called a school for a reason. Learn; Write your own tests; and "By Odin! By Thor! Use your brain!".

Projects

Projects statuses
Milestone Project Finished Grade
0 libft logo
(with bonuses)
125
1 born2beroot logo
(with bonuses)
125
ft_printf logo 100
get_next_line logo 100
2 pipex logo
(with bonuses)
125
push_swap logo 100
fdf logo
(with bonuses)
125
3 minishell logo
with @maximart
101
philosophers logo 100
4 cub3d logo
with @maximart

(with bonuses)
125
CPP logo
CPP 00-04
(various grades)
NetPractice logo
100
5 ft_irc logo
with @maximart & @nahamida
125
inception logo
90
CPP logo
CPP 05-09
(various grades)
6 ft_transcendence logo
with @vblanc, @enpassel & @scottene
125

Notable projects

fdf
cub3d (and its 3DS port)
ft_linux
ft_transcendence

Extra tools/projects

During a boring weekend, I set up a Bazel1 target to cross-compile a 3DS home-brew app. If you have a modded 3DS on hand, you can compile it and try yourself. It's very limited, laggy, and crashes on quit though. You have been warned. The level packaged is also very basic.

A program to flex on your friends by visualizing your push_swap algorithm in Minecraft. It uses Valence to control the game packets and visualize the sorting algorithm on your 1.20.1 client.

In-game screenshot Minecraft push_swap visualizer in-game screenshot

A simple script to convert a BMP2 image into a fdf file. It currently only works for bitmap images smaller than 255 * 255, because I don't really know how to reliably get the width of the image in the header.

Building and packaging

Zig

Note

Did you read the foreword?

You can build all3 the projects in this monorepo using Zig.

  • See the list of project in the main build file.
  • Run zig build to make all projects at once (as well as the required external libs).

As per Zig fashion, building the entirety of the repo at once is pretty fast.

Nix

This project's dev dependencies are packaged using Nix in a devShell that I personally use with nix-direnv. There is a central flake.nix that loads all nix files using import-tree.

I might eventually package the projects of this repo into this flake when I find the time.

Additional notes

LSPs and compile_commands.json

If you use an IDE or LSP server and the constant clangd type errors appearing when browsing this repo hurt your eyes, I might have a solution for you. The compile_commands.json file! It instructs your LSP server on where to locate the headers, and in which order, and how your build system (Zig in this case) manages your compilation.

To compile this file for the whole project using Zig and Bear4:

bear -- zig build

Note

The compile_commands.json is gitignore'd for your inconvenience :-)

License

This project is licensed under the MIT License. See the LICENSE file for details.

Footnotes

  1. I used to use Bazel to build my projects, but it's somewhat incompatible with Nix, so I moved to the Zig build system.

  2. You can convert PNG images to BMP using convert from ImageMagick, or online with EzGIF.

  3. I haven't bothered to make everything compile using the Zig build system. At the time of writing and understandably, transcendence and the 3ds cub3d port must be compiled individually with their own tooling. I don't update the README as often as I update projects though, so take a look around and see for yourself!

  4. From https://github.com/rizsotto/Bear: "Bear generates a compilation database for Clang tooling."

About

Monorepo of all my projects related to 42

Topics

Resources

License

Stars

Watchers

Forks

Contributors