To clean at:
~/Desktop/myCpp
rm -rf build
************To configure (generate build files) at:
~/Desktop/myCpp
bash
Copy code
cmake -S . -B build -G Ninja
cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++ for my comp
**********To build at:
~/Desktop/myCpp
bash
Copy code
cmake --build build
***********To run at project root:
~/Desktop/myCpp
bash
Copy code
*********use this one dumby
./build/myCpp
To run from build directory:
~/Desktop/myCpp/build
bash
Copy code
./myCpp
📁 Project Structure
objectivec
Copy code
myCpp/
├── CMakeLists.txt
├── Dockerfile
├── main.cpp
├── build/ # Generated by CMake (do not edit manually)
│ ├── myCpp # Final executable
│ └── other build files...
🧠 Core Mental Model
Docker = environment (OS + tools)
CMake = generates build files
Ninja = builds the code
Executable = what you actually run
Docker does not replace CMake.
CMake does not replace Ninja.
Once built, you just run the binary.
🐳 Docker Usage
All build and run commands are executed inside the Docker container.
Typical flow:
Start / enter container
cd into the project directory
Use CMake + Ninja as normal
🔁 When to Update Things
✅ Edit .cpp files
Do not touch CMake or Docker
Just rebuild
✅ Add new .cpp files or folders
Update CMakeLists.txt
Rebuild (sometimes reconfigure)
✅ Add libraries (OpenGL, GLFW, etc.)
Update CMakeLists.txt
Clean + reconfigure
✅ Add system dependencies
Update Dockerfile
Rebuild Docker image
🚫 Do NOT Edit Manually
build/
CMakeCache.txt
CMakeFiles/
build.ninja
These are generated automatically.
📌 Golden Rule
Enter Docker → Run CMake → Build → Run Binary
If the executable exists, nothing else matters.
🧠 Professional Advice / Reminder
Keep source files in src/ and headers in include/ as project grows.
Use out-of-source builds (build/) always.
Only edit CMakeLists.txt when adding files, folders, or libraries.
Docker is only for environment consistency — do not touch it for normal builds.