Skip to content

Commit 2f49baa

Browse files
authored
Add CHDB_VERION for cmake (#96)
1 parent f10a172 commit 2f49baa

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

chdb/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_THINLTO=0 -DENABLE_TESTS=0 -DENABLE_CL
8282
${CPU_FEATURES} \
8383
${CMAKE_TOOLCHAIN_FILE} \
8484
-DENABLE_AVX512=0 -DENABLE_AVX512_VBMI=0 \
85+
-DCHDB_VERSION=${CHDB_VERSION} \
8586
..
8687
ninja
8788

chdb/vars.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ BUILD_DIR="$PROJ_DIR/buildlib" # build directory
55
CHDB_DIR="$PROJ_DIR/chdb" # chdb directory
66
CHDB_PY_MOD="_chdb"
77
CHDB_PY_MODULE=${CHDB_PY_MOD}$(python3 -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
8+
pushd ${PROJ_DIR}
9+
CHDB_VERSION=$(python3 -c 'import setup; print(setup.get_latest_git_tag())')
10+
popd
811

912
# check current os type, and make ldd command
1013
if [ "$(uname)" == "Darwin" ]; then
@@ -14,4 +17,4 @@ elif [ "$(uname)" == "Linux" ]; then
1417
else
1518
echo "OS not supported"
1619
exit 1
17-
fi
20+
fi

src/Functions/chdbVersion.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <DataTypes/DataTypeString.h>
44
#include <Functions/FunctionFactory.h>
55
#include <Functions/FunctionConstantBase.h>
6+
#include <Common/FunctionDocumentation.h>
67

78
namespace DB
89
{
@@ -21,14 +22,15 @@ namespace
2122

2223
REGISTER_FUNCTION(ChdbVersion)
2324
{
24-
factory.registerFunction<FunctionChdbVersion>(
25+
factory.registerFunction<FunctionChdbVersion>(FunctionDocumentation
2526
{
26-
R"(
27+
.description=R"(
2728
Returns the version of chDB. The result type is String.
28-
)",
29-
Documentation::Examples{{"chdb", "SELECT chdb()"}},
30-
Documentation::Categories{"String"}
31-
}, FunctionFactory::CaseInsensitive);
29+
)",
30+
.examples{{"chdb", "SELECT chdb();", ""}},
31+
.categories{"String"}
32+
},
33+
FunctionFactory::CaseInsensitive);
3234
}
3335
}
3436
#endif

0 commit comments

Comments
 (0)