Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cmake project version number in code #2428

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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