diff --git a/NothinFancy/CMakeLists.txt b/NothinFancy/CMakeLists.txt index a16590d..4c7515d 100644 --- a/NothinFancy/CMakeLists.txt +++ b/NothinFancy/CMakeLists.txt @@ -7,3 +7,9 @@ set_property(TARGET NothinFancy PROPERTY CXX_STANDARD 20) # Use precompiled header target_precompile_headers(NothinFancy PUBLIC "src/pch.h") target_include_directories(NothinFancy PUBLIC "src/") + +# Generate version.h +find_package(Git) +execute_process(COMMAND ${GIT_EXECUTABLE} describe OUTPUT_VARIABLE NFVERSION OUTPUT_STRIP_TRAILING_WHITESPACE) +configure_file(src/version.h.in version.h) +target_include_directories(NothinFancy PUBLIC "${PROJECT_BINARY_DIR}/NothinFancy") diff --git a/NothinFancy/src/Engine.cpp b/NothinFancy/src/Engine.cpp index a17544d..e36fbaa 100644 --- a/NothinFancy/src/Engine.cpp +++ b/NothinFancy/src/Engine.cpp @@ -1,9 +1,11 @@ // NF startup #include "pch.h" +#include "version.h" + namespace nf { - void test() { - std::cout << "NothinFancy\n"; + void startEngine() { + std::cout << std::format("Nothin' Fancy {}\n", NFVERSION); std::cin.get(); } } diff --git a/NothinFancy/src/include/nf.h b/NothinFancy/src/include/nf.h index 7f847df..1aa4a6a 100644 --- a/NothinFancy/src/include/nf.h +++ b/NothinFancy/src/include/nf.h @@ -2,5 +2,5 @@ #pragma once namespace nf { - void test(); + void startEngine(); } diff --git a/NothinFancy/src/version.h.in b/NothinFancy/src/version.h.in new file mode 100644 index 0000000..0d12158 --- /dev/null +++ b/NothinFancy/src/version.h.in @@ -0,0 +1,2 @@ +// Version configured header +#define NFVERSION "@NFVERSION@" diff --git a/TestGame/src/TestGame.cpp b/TestGame/src/TestGame.cpp index aeba065..3ac770d 100644 --- a/TestGame/src/TestGame.cpp +++ b/TestGame/src/TestGame.cpp @@ -2,6 +2,6 @@ #include "nf.h" int main(int argc, char* argv[]) { - nf::test(); + nf::startEngine(); return 0; }