diff --git a/barretenberg/cpp/CMakeLists.txt b/barretenberg/cpp/CMakeLists.txt index cca88d9a442..057c6b32580 100644 --- a/barretenberg/cpp/CMakeLists.txt +++ b/barretenberg/cpp/CMakeLists.txt @@ -9,6 +9,13 @@ project( VERSION 0.7.10 # x-release-please-version LANGUAGES CXX C ) +# Insert version into `bb` config file +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/src/barretenberg/bb/config.hpp.in + ${CMAKE_CURRENT_SOURCE_DIR}/src/barretenberg/bb/config.hpp + @ONLY +) + option(DISABLE_ASM "Disable custom assembly" OFF) option(DISABLE_ADX "Disable ADX assembly variant" OFF) diff --git a/barretenberg/cpp/src/barretenberg/bb/.gitignore b/barretenberg/cpp/src/barretenberg/bb/.gitignore new file mode 100644 index 00000000000..d1a04366d84 --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/bb/.gitignore @@ -0,0 +1 @@ +config.hpp \ No newline at end of file diff --git a/barretenberg/cpp/src/barretenberg/bb/config.hpp.in b/barretenberg/cpp/src/barretenberg/bb/config.hpp.in new file mode 100644 index 00000000000..1345e27971d --- /dev/null +++ b/barretenberg/cpp/src/barretenberg/bb/config.hpp.in @@ -0,0 +1,6 @@ +#ifndef INCLUDE_GUARD +#define INCLUDE_GUARD + +#define BB_VERSION "@CMAKE_PROJECT_VERSION@" + +#endif // INCLUDE_GUARD diff --git a/barretenberg/cpp/src/barretenberg/bb/main.cpp b/barretenberg/cpp/src/barretenberg/bb/main.cpp index 72f0a95990c..81c4a2bfb49 100644 --- a/barretenberg/cpp/src/barretenberg/bb/main.cpp +++ b/barretenberg/cpp/src/barretenberg/bb/main.cpp @@ -1,3 +1,4 @@ +#include "config.hpp" #include "get_bytecode.hpp" #include "get_crs.hpp" #include "get_witness.hpp" @@ -334,7 +335,10 @@ int main(int argc, char* argv[]) bool recursive = flagPresent(args, "-r") || flagPresent(args, "--recursive"); // Skip CRS initialization for any command which doesn't require the CRS. - if (command == "info") { + if (command == "--version") { + writeStringToStdout(BB_VERSION); + return 0; + } else if (command == "info") { std::string output_path = getOption(args, "-o", "info.json"); acvmInfo(output_path); return 0;