From 6d66606601da24b79f0bac51eccc816aba543e0b Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Mon, 20 Nov 2023 17:07:41 +0800 Subject: [PATCH 1/6] Fix DB version call --- CMakeLists.txt | 2 ++ src/CMakeLists.txt | 1 - src/include/common/constants.h | 4 +--- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d3d2237f4..cd9c88add6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.11) project(Kuzu VERSION 0.0.12.3 LANGUAGES CXX C) +add_definitions(-DKUZU_CMAKE_VERSION="${CMAKE_PROJECT_VERSION}") + find_package(Threads REQUIRED) set(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS TRUE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 350330cfa3..7c6bc9ed8c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,4 @@ 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 diff --git a/src/include/common/constants.h b/src/include/common/constants.h index b367576a49..3b42375b4d 100644 --- a/src/include/common/constants.h +++ b/src/include/common/constants.h @@ -1,13 +1,11 @@ #pragma once -#define TO_STRING(ARG) #ARG - #include namespace kuzu { namespace common { -constexpr char KUZU_VERSION[] = TO_STRING(KUZU_CMAKE_VERSION); +constexpr char KUZU_VERSION[] = KUZU_STORAGE_VERSION; constexpr uint64_t DEFAULT_VECTOR_CAPACITY_LOG_2 = 11; constexpr uint64_t DEFAULT_VECTOR_CAPACITY = (uint64_t)1 << DEFAULT_VECTOR_CAPACITY_LOG_2; From 41bad671d6369b789fbeac5eaeb0f95a28fea960 Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Mon, 20 Nov 2023 17:13:12 +0800 Subject: [PATCH 2/6] X --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cd9c88add6..4d3d2237f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.11) project(Kuzu VERSION 0.0.12.3 LANGUAGES CXX C) -add_definitions(-DKUZU_CMAKE_VERSION="${CMAKE_PROJECT_VERSION}") - find_package(Threads REQUIRED) set(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS TRUE) From 35a41ea45a7e64de0632a3d8fe8d79878a39bf0d Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Mon, 20 Nov 2023 17:39:07 +0800 Subject: [PATCH 3/6] TO_STRING --- src/include/common/constants.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/include/common/constants.h b/src/include/common/constants.h index 3b42375b4d..40b75b08e1 100644 --- a/src/include/common/constants.h +++ b/src/include/common/constants.h @@ -1,11 +1,13 @@ #pragma once +#define TO_STRING(ARG) #ARG + #include namespace kuzu { namespace common { -constexpr char KUZU_VERSION[] = KUZU_STORAGE_VERSION; +constexpr char KUZU_VERSION[] = TO_STRING(KUZU_STORAGE_VERSION); constexpr uint64_t DEFAULT_VECTOR_CAPACITY_LOG_2 = 11; constexpr uint64_t DEFAULT_VECTOR_CAPACITY = (uint64_t)1 << DEFAULT_VECTOR_CAPACITY_LOG_2; From 8d242d4ee1a325e5c0248c1e6b3da8091b8a2d4b Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Mon, 20 Nov 2023 17:40:48 +0800 Subject: [PATCH 4/6] Rename var --- CMakeLists.txt | 2 +- src/include/common/constants.h | 2 +- src/storage/storage_info.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d3d2237f4..e7dac746eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,7 +171,7 @@ function(add_kuzu_api_test TEST_NAME) endfunction() add_definitions(-DKUZU_ROOT_DIRECTORY="${PROJECT_SOURCE_DIR}") -add_definitions(-DKUZU_STORAGE_VERSION="${CMAKE_PROJECT_VERSION}") +add_definitions(-DKUZU_CMAKE_VERSION="${CMAKE_PROJECT_VERSION}") include_directories(src/include) include_directories(third_party/antlr4_cypher/include) diff --git a/src/include/common/constants.h b/src/include/common/constants.h index 40b75b08e1..b367576a49 100644 --- a/src/include/common/constants.h +++ b/src/include/common/constants.h @@ -7,7 +7,7 @@ namespace kuzu { namespace common { -constexpr char KUZU_VERSION[] = TO_STRING(KUZU_STORAGE_VERSION); +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; diff --git a/src/storage/storage_info.cpp b/src/storage/storage_info.cpp index 3aa00f2945..c033027d6a 100644 --- a/src/storage/storage_info.cpp +++ b/src/storage/storage_info.cpp @@ -5,8 +5,8 @@ namespace storage { storage_version_t StorageVersionInfo::getStorageVersion() { auto storageVersionInfo = getStorageVersionInfo(); - if (!storageVersionInfo.contains(KUZU_STORAGE_VERSION)) { - // If the current KUZU_STORAGE_VERSION is not in the map, + if (!storageVersionInfo.contains(KUZU_CMAKE_VERSION)) { + // If the current KUZU_CMAKE_VERSION is not in the map, // then we must run the newest version of kuzu // LCOV_EXCL_START storage_version_t maxVersion = 0; @@ -16,7 +16,7 @@ storage_version_t StorageVersionInfo::getStorageVersion() { return maxVersion; // LCOV_EXCL_STOP } - return storageVersionInfo.at(KUZU_STORAGE_VERSION); + return storageVersionInfo.at(KUZU_CMAKE_VERSION); } } // namespace storage From 46ad0f63c2bdbcfe844cd21d16216060f2f15846 Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Mon, 20 Nov 2023 18:02:13 +0800 Subject: [PATCH 5/6] Remove TO_STRING --- src/include/common/constants.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/include/common/constants.h b/src/include/common/constants.h index b367576a49..11092b2fe6 100644 --- a/src/include/common/constants.h +++ b/src/include/common/constants.h @@ -1,13 +1,11 @@ #pragma once -#define TO_STRING(ARG) #ARG - #include namespace kuzu { namespace common { -constexpr char KUZU_VERSION[] = TO_STRING(KUZU_CMAKE_VERSION); +constexpr char KUZU_VERSION[] = 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; From f32070b9cbb02726dc074cdde36d261df5f846d8 Mon Sep 17 00:00:00 2001 From: Benjamin Winger Date: Mon, 20 Nov 2023 10:34:02 -0500 Subject: [PATCH 6/6] Define KUZU_VERSION as an extern global Since it's set using a compile definition, we want to avoid that definition being required to include the header --- src/common/CMakeLists.txt | 1 + src/common/constants.cpp | 6 ++++++ src/include/common/constants.h | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 src/common/constants.cpp diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 680ffcd75c..7bbbc189ac 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -10,6 +10,7 @@ add_subdirectory(vector) add_library(kuzu_common OBJECT + constants.cpp expression_type.cpp file_utils.cpp in_mem_overflow_buffer.cpp diff --git a/src/common/constants.cpp b/src/common/constants.cpp new file mode 100644 index 0000000000..3c2a823d60 --- /dev/null +++ b/src/common/constants.cpp @@ -0,0 +1,6 @@ +namespace kuzu { +namespace common { + +const char* KUZU_VERSION = KUZU_CMAKE_VERSION; +} +} // namespace kuzu diff --git a/src/include/common/constants.h b/src/include/common/constants.h index 11092b2fe6..2d3fee9dc1 100644 --- a/src/include/common/constants.h +++ b/src/include/common/constants.h @@ -5,7 +5,7 @@ namespace kuzu { namespace common { -constexpr char KUZU_VERSION[] = KUZU_CMAKE_VERSION; +extern const char* KUZU_VERSION; constexpr uint64_t DEFAULT_VECTOR_CAPACITY_LOG_2 = 11; constexpr uint64_t DEFAULT_VECTOR_CAPACITY = (uint64_t)1 << DEFAULT_VECTOR_CAPACITY_LOG_2;