diff --git a/.clangd b/.clangd index ec0b890..ee4a3f8 100644 --- a/.clangd +++ b/.clangd @@ -1,2 +1,7 @@ CompileFlags: CompilationDatabase: build + +If: + PathMatch: .*\.in$ +Diagnostics: + Suppress: "*" \ No newline at end of file diff --git a/core/BuildInfo.hpp.in b/core/BuildInfo.hpp.in new file mode 100644 index 0000000..8c7634c --- /dev/null +++ b/core/BuildInfo.hpp.in @@ -0,0 +1,16 @@ +#pragma once + +#include + +namespace retroforge::core { + +class BuildInfo { + public: + static constexpr int major = @PROJECT_VERSION_MAJOR@; + static constexpr int minor = @PROJECT_VERSION_MINOR@; + static constexpr int patch = @PROJECT_VERSION_PATCH@; + + static constexpr std::string_view version_string() { return "@PROJECT_VERSION@"; } +}; + +} // namespace retroforge::core \ No newline at end of file diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 2a22c06..2e19eea 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -15,4 +15,14 @@ target_include_directories(retroforge_core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/BuildInfo.hpp.in + ${CMAKE_BINARY_DIR}/generated/BuildInfo.hpp + @ONLY +) + +target_include_directories(retroforge_core PUBLIC + ${CMAKE_BINARY_DIR}/generated +) + target_compile_features(retroforge_core PUBLIC cxx_std_20) \ No newline at end of file