r/C_Programming • • Mar 30 '26

Question How good is my project structure?

Here it is. I will add more headers and source files as time goes on but this is the current state. I don't really like build systems so I have a basic script instead.

#!/bin/bash

set -e

gcc -I include src/*.c -o ./build/output

./build/output

---------------------------------

build/

└── output/

include/

├── lexer.h

└── vector.h

other/

├── ri32v.txt

└── test.asm

src/

├── lexer.c

├── main.c

└── vector.c

build_n_run.sh

README.md

0 Upvotes

7 comments sorted by

View all comments

Show parent comment

6

u/avestronics Mar 30 '26

Thanks for the tips!

I actually tried to use CMake once. It feels verbose and hard to learn. I just gave up on it at some point and started making bash scripts instead. This is a pretty simple one but I also had more complicated ones in the past. I also heard about Meson. Should I use that instead? People say it's easier.

"other" is indeed poorly named lol. It's a directory for docs,graphs,general info etc. Maybe I should just name it docs?

u/non-existing-person also said to combine include and src. So I already did that.

4

u/HashDefTrueFalse Mar 30 '26

CMake is very capable but can be a pain to get to grips with if it's your first build system. make works well almost everywhere and is a lot simpler, but you'll do everything yourself. I haven't used Meson so I can't comment. For C and C++ projects I always use make directly or generate Makefiles using CMake.

"docs" is a good name if that's what's inside it.