Skip to content

Commit

Permalink
Merge pull request #2428 from kuzudb/cmake-version
Browse files Browse the repository at this point in the history
Use cmake project version number in code
  • Loading branch information
benjaminwinger committed Nov 16, 2023
2 parents a616abf + e895007 commit 093e627
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_compile_definitions(KUZU_CMAKE_VERSION=v${CMAKE_PROJECT_VERSION})
# Avoid the import annotation when building on windows
# Really this should be set per target,
# but the targets are split among many files and only the object files are linked against here
Expand Down
4 changes: 3 additions & 1 deletion src/include/common/constants.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#pragma once

#define TO_STRING(ARG) #ARG

#include <cstdint>

namespace kuzu {
namespace common {

constexpr char KUZU_VERSION[] = "v0.0.12.1";
constexpr char KUZU_VERSION[] = TO_STRING(KUZU_CMAKE_VERSION);

constexpr uint64_t DEFAULT_VECTOR_CAPACITY_LOG_2 = 11;
constexpr uint64_t DEFAULT_VECTOR_CAPACITY = (uint64_t)1 << DEFAULT_VECTOR_CAPACITY_LOG_2;
Expand Down
2 changes: 1 addition & 1 deletion test/include/test_runner/test_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class TestParser {
// Example: ${KUZU_ROOT_DIRECTORY} will be replaced by
// KUZU_ROOT_DIRECTORY
std::unordered_map<std::string, std::string> variableMap = {
{"KUZU_ROOT_DIRECTORY", KUZU_ROOT_DIRECTORY}};
{"KUZU_ROOT_DIRECTORY", KUZU_ROOT_DIRECTORY}, {"KUZU_VERSION", common::KUZU_VERSION}};
};

} // namespace testing
Expand Down
2 changes: 1 addition & 1 deletion test/test_files/tinysnb/call/call.test
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ height
-LOG ReturnDBVersion
-STATEMENT CALL db_version() RETURN version
---- 1
v0.0.12.1
${KUZU_VERSION}

-LOG ReturnTableConnection
-STATEMENT CALL show_connection('knows') RETURN *
Expand Down

0 comments on commit 093e627

Please sign in to comment.