-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Minimal CMake
By :
With as-c-math added to our CMakeLists.txt file (see ch3/part-7/CMakeLists.txt), we can now include the library in our project. We simply add #include <as-ops.h> at the top of main.c (notice the use of angle brackets (<>) to indicate that this is an external dependency. Quotation marks ("") also work, but using <> has the advantage of advertising to the reader that this file is outside the main project).
If we review main.c, we can see it’s changed quite significantly. Instead of thinking of the board as a table with rows and columns, the logic has been updated to treat it as a grid with x and y coordinates. This is to make things a little more idiomatic when it comes to integration with the math library, but the transition can be a little jarring as the ordering of elements has changed. We traditionally write rows, then columns (r, c), which is the vertical position first, then horizontal. With x and y coordinates, we...