Inspired by a Joma Tech YouTube video. I found it interesting and wanted to try it myself.
This is originally Andy Sloane's work; the math and code walkthrough are in his blog post.
Some of the original code no longer built cleanly because its libraries and APIs were outdated, so I replaced those parts with supported equivalents.
Credit goes to both sources above.
얼마전에 유튜브 비디오 보다가 재밌기도 하고 궁금 하기도 해서 한번 따라해 본거에요.
원본 코드 를 그대로 돌리면 에러가 나더라고요.
왜냐하면 쓰던 코드가 조금 오래되서 몇개 라이브러리 function 들이 더이상 support 되지 않아요.
그래서 한번 고쳐봤어요.
모든 Credit 은 원본 코드 만드신 분께 가요.
- cmake
- make
The CMake project compiles src/donut.c (and links libm) into an executable named like the project: donut on Unix, donut.exe on Windows. From the repository root:
-
Configure — generates
Makefile(and related files) fromCMakeLists.txt:cmake . -
Build — compile and link:
make
Or run
./build.sh, which runscmake .thenmake.
Alternatively, without CMake:
gcc -Iinclude -o donut src/donut.c -lm./donut.exe./donut