Skip to content

Commit

Permalink
feat(bb): add bb --version command
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Sep 22, 2023
1 parent 3995de9 commit 32921d5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
7 changes: 7 additions & 0 deletions barretenberg/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions barretenberg/cpp/src/barretenberg/bb/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.hpp
6 changes: 6 additions & 0 deletions barretenberg/cpp/src/barretenberg/bb/config.hpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef INCLUDE_GUARD
#define INCLUDE_GUARD

#define BB_VERSION "@CMAKE_PROJECT_VERSION@"

#endif // INCLUDE_GUARD
6 changes: 5 additions & 1 deletion barretenberg/cpp/src/barretenberg/bb/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.hpp"
#include "get_bytecode.hpp"
#include "get_crs.hpp"
#include "get_witness.hpp"
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 32921d5

Please sign in to comment.