Compile Chain
Why a compile chain exists
Your .c and .h files are source code for humans and compilers. They are not directly executable.
To obtain a program such as ./build/freud.exe, you need a toolchain that can compile source files, link libraries, and organize the build process.
In this project, that chain is mainly based on GCC, Make, and CMake.
GCC
GCC is the compiler collection used here to translate your C code into machine code.
In practical terms, GCC is the tool that reads files such as src/features.c, checks whether the C syntax and types are valid, and produces object files that can later be linked into an executable.
It is also the tool that emits most compilation errors and warnings.
If GCC says something is wrong, you should read the message carefully and fix the source code rather than guessing.
Makefile
A Makefile describes build targets and dependencies.
Its role is to answer questions such as:
- what needs to be compiled
- in which order
- with which commands
- what can be reused without recompiling everything
You will see generated Makefiles inside the build process. They help automate repeated compilation work and avoid rebuilding everything from scratch unnecessarily.
CMake
CMake is a build-system generator.
You do not usually write compiler commands by hand for every file. Instead, CMake reads CMakeLists.txt, understands the structure of the project, checks dependencies, and generates the concrete build files needed on your machine.
In this project, CMake is the main entry point for building.
Useful commands
Configure the project:
cmake -B buildThis creates or refreshes the ./build/ folder.
Build the project:
cmake --build buildThis compiles the code and produces the executable in ./build/.
Install the project:
cmake --install buildThis copies the built result to the install location defined by the project. For day-to-day work, you mainly need configure plus build.
The usual local workflow
cmake -B build
cmake --build build
./build/freud.exe -f images/input/test.jpg -c color_blueThe first command is needed once after cloning, and again when build configuration changes. The second command is the one you will run repeatedly after editing the code.
Running the resulting command
Once the build succeeds, you run the executable produced in the ./build/ directory.
Example:
./build/freud.exe -f images/input/test.jpg -c grayscaleThis is how you verify that your implementation really works on a concrete input.
For more details on command syntax, see Using the Command Line.