feat(cmat): add cmake build for course material

Add a CMakeLists.txt to each exercise directory, included from
cmat/CMakeLists.txt, so every exercise and solution becomes a buildable
target. GUI exercises link the curses-based DOS_Unix implementations on
Unix-like systems; the Windows-specific DOS variants are not compiled.
Exercises without a portable path or with missing dependencies (Boost)
are reported as not available at configure time.

Targets are excluded from the default build and built by name, e.g.
`cmake --build build --target Ex11`, so intentionally buggy exercises
such as Ex21 do not break the default build.

Also fix two portability issues: rename Ex11bug/pole.h to Pole.h for
case-sensitive filesystems and drop the extra Light:: qualification in
SolutionEx71A/Light.h. Document build commands and layout in AGENTS.md.

Co-authored-by: Qwen 3.8 27B <qwen3.8_27b-q3_k_xl@lmstudio.local>
This commit is contained in:
2026-10-05 11:55:00 +02:00
co-authored by Qwen 3.8 27B
parent e8241fd1ff
commit e09540c2b2
701 changed files with 27282 additions and 16 deletions
+85
View File
@@ -0,0 +1,85 @@
#include "Pixel.h"
#include <algorithm>
#include <iostream>
#include <vector>
void pixelPrint(const Pixel &pixel) { pixel.print(); }
void pixelPtrPrint(const Pixel *pixel) { pixel->print(); }
int main() {
using namespace std;
// preamble
Pixel pixel0;
cout << "Preamble:" << endl;
pixel0.print();
cout << endl;
Pixel pixel1(1, 2);
Pixel pixel2(3, 3);
Pixel pixel3(2, 4);
Pixel pixel4(5, 2);
Pixel pixel5(4, 2);
// 3.1 part 1
cout << "3.1 Part 1:" << endl;
vector<Pixel> pixelVec;
pixelVec.push_back(pixel1);
pixelVec.push_back(pixel2);
pixelVec.push_back(pixel3);
pixelVec.push_back(pixel4);
pixelVec.push_back(pixel5);
for (unsigned int i = 0; i < pixelVec.size(); ++i) {
pixelVec[i].print();
}
cout << endl;
// 3.1 part 2
cout << "3.1 Part 2:" << endl;
for (vector<Pixel>::iterator iter = pixelVec.begin(); iter != pixelVec.end(); ++iter) {
iter->print();
}
cout << endl;
for (vector<Pixel>::reverse_iterator r_iter = pixelVec.rbegin(); r_iter != pixelVec.rend(); ++r_iter) {
r_iter->print();
}
cout << endl;
// 3.1 part 3
cout << "3.1 Part 3:" << endl;
for_each(pixelVec.begin(), pixelVec.end(), pixelPrint);
cout << endl;
sort(pixelVec.begin(), pixelVec.end());
for_each(pixelVec.begin(), pixelVec.end(), pixelPrint);
cout << endl;
// 3.2
cout << "3.2, Part 1:" << endl;
vector<Pixel *> pixelPtrVec;
pixelPtrVec.push_back(&pixel1);
pixelPtrVec.push_back(&pixel2);
pixelPtrVec.push_back(&pixel3);
pixelPtrVec.push_back(&pixel4);
pixelPtrVec.push_back(&pixel5);
for_each(pixelPtrVec.begin(), pixelPtrVec.end(), pixelPtrPrint);
cout << endl;
PixelPtrCompare pixelPtrComp;
sort(pixelPtrVec.begin(), pixelPtrVec.end(), pixelPtrComp);
for_each(pixelPtrVec.begin(), pixelPtrVec.end(), pixelPtrPrint);
cout << endl;
pixelPtrComp.setSortOnY(true);
sort(pixelPtrVec.begin(), pixelPtrVec.end(), pixelPtrComp);
for_each(pixelPtrVec.begin(), pixelPtrVec.end(), pixelPtrPrint);
cout << endl;
cout << endl;
// insert code here...
return 0;
}