Skip to content

Commit 98ee883

Browse files
authored
README.md fix for git submodule sync & --version / --help (#45)
* add instructions to do `git` submodule sync * `--help` and `--version`
1 parent c96b6a4 commit 98ee883

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

QUICKSTART.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
Go from zero to your first shader in minutes.
44

5+
## 0) Populate submodules
6+
```sh
7+
git submodule update --init --recursive
8+
```
9+
510
## 1) Install + Build
611

712
### macOS (Homebrew)

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ sudo apt-get install -y \
7575
### Linux/macOS
7676
```sh
7777
# FFmpeg is optional; set `-DDISABLE_FFMPEG=ON` (see `CMakeLists.txt`) to build without it.
78+
git submodule update --init --recursive
7879
cmake -B build .
7980
cmake --build build
8081
./build/vsdf {filepath}.frag
@@ -83,6 +84,7 @@ cmake --build build
8384
### Windows
8485
```powershell
8586
# FFmpeg is optional; set `-DDISABLE_FFMPEG=ON` (see `CMakeLists.txt`) to build without it.
87+
git submodule update --init --recursive
8688
cmake -B build -DCMAKE_TOOLCHAIN_FILE="C:/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake" .
8789
cmake --build build --config Release
8890
.\build\Release\vsdf.exe {filepath}.frag
@@ -176,6 +178,7 @@ Also by running the test suite it will check this automatically
176178

177179
### Linux/macOS
178180
```sh
181+
git submodule update --init --recursive
179182
cmake -B build -DBUILD_TESTS=ON -DDEBUG=ON
180183
cmake --build build
181184
./build/tests/vsdf_tests
@@ -184,6 +187,7 @@ cmake --build build
184187

185188
### Windows
186189
```powershell
190+
git submodule update --init --recursive
187191
cmake -B build -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE="C:/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake" .
188192
cmake --build build --config Debug
189193
.\build\tests\vsdf_tests\Debug\vsdf_tests.exe

src/main.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,22 @@
88
#include <cstdint>
99
#include <filesystem>
1010
#include <optional>
11+
#include <spdlog/fmt/fmt.h>
1112
#include <spdlog/spdlog.h>
1213
#include <string>
1314
#include <unordered_map>
1415

1516
namespace {
17+
constexpr const char kVersion[] = "vsdf dev";
18+
19+
void printHelp(const char *exe) {
20+
fmt::print("Usage: {} [options] <shader.frag>\nExample: {} --toy "
21+
"shaders/testtoyshader.frag\n",
22+
exe, exe);
23+
}
24+
25+
void printVersion() { fmt::print("{}\n", kVersion); }
26+
1627
spdlog::level::level_enum parseLogLevel(const std::string &levelStr) {
1728
static const std::unordered_map<std::string, spdlog::level::level_enum>
1829
kLevels = {{"trace", spdlog::level::trace},
@@ -55,7 +66,13 @@ int main(int argc, char **argv) {
5566
std::string arg;
5667
for (int i = 1; i < argc; ++i) {
5768
arg = argv[i];
58-
if (arg == "--toy") {
69+
if (arg == "--help") {
70+
printHelp(argv[0]);
71+
return 0;
72+
} else if (arg == "--version") {
73+
printVersion();
74+
return 0;
75+
} else if (arg == "--toy") {
5976
useToyTemplate = true;
6077
continue;
6178
} else if (arg == "--headless") {

0 commit comments

Comments
 (0)