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/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/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 b367576a49..2d3fee9dc1 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); +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; 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