Skip to content

Commit d80e30a

Browse files
committed
Merge branch 'marco-ippolito-feat/include-version-header'
2 parents da51af3 + a478212 commit d80e30a

5 files changed

Lines changed: 55 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ test/perftest
5353
debug
5454
cmake-build-debug
5555
/build-afl
56+
.vscode

CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
cmake_minimum_required(VERSION 3.12)
2+
if(POLICY CMP0135)
3+
cmake_policy(SET CMP0135 NEW)
4+
set(CMAKE_POLICY_DEFAULT_CMP0135 NEW)
5+
endif()
6+
7+
file(STRINGS "include/hdr/hdr_histogram_version.h" HDR_VERSION_HEADER)
8+
string(REGEX MATCH ".*#define HDR_HISTOGRAM_VERSION \"(.*)\".*" HDR_BLACK_HOLE ${HDR_VERSION_HEADER})
29

310
project(hdr_histogram
4-
VERSION 0.11.6
11+
VERSION ${CMAKE_MATCH_1}
512
LANGUAGES C
613
DESCRIPTION "C port of the HdrHistogram"
714
HOMEPAGE_URL "http://hdrhistogram.github.io/HdrHistogram/")
@@ -21,7 +28,7 @@ include(CMakePackageConfigHelpers)
2128

2229
set(HDR_SOVERSION_CURRENT 6)
2330
set(HDR_SOVERSION_AGE 1)
24-
set(HDR_SOVERSION_REVISION 2)
31+
set(HDR_SOVERSION_REVISION 3)
2532

2633
set(HDR_VERSION ${HDR_SOVERSION_CURRENT}.${HDR_SOVERSION_AGE}.${HDR_SOVERSION_REVISION})
2734
set(HDR_SOVERSION ${HDR_SOVERSION_CURRENT})

include/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
configure_file(hdr/hdr_histogram_version.h hdr/hdr_histogram_version.h @ONLY)
2+
13
set(HDR_HISTOGRAM_PUBLIC_HEADERS
24
hdr/hdr_histogram.h
35
hdr/hdr_histogram_log.h
46
hdr/hdr_interval_recorder.h
57
hdr/hdr_thread.h
68
hdr/hdr_time.h
7-
hdr/hdr_writer_reader_phaser.h)
9+
hdr/hdr_writer_reader_phaser.h
10+
hdr/hdr_histogram_version.h)
811

912
install(
1013
FILES ${HDR_HISTOGRAM_PUBLIC_HEADERS}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* @file hdr_histogram_version.h
3+
* @brief Definitions for HdrHistogram's version number.
4+
*/
5+
6+
#ifndef HDR_HISTOGRAM_VERSION_H
7+
#define HDR_HISTOGRAM_VERSION_H
8+
9+
#define HDR_HISTOGRAM_VERSION "0.11.7"
10+
11+
#endif // HDR_HISTOGRAM_VERSION_H

tools/update-version.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
set -e
3+
# Shell script to update HDR_HISTOGRAM_VERSION_H to a specific version
4+
5+
BASE_DIR=$(cd "$(dirname "$0")/.." && pwd)
6+
HDR_DIR="$BASE_DIR/include/hdr"
7+
HDR_HISTOGRAM_VERSION_H=$HDR_DIR/hdr_histogram_version.h
8+
NEW_VERSION=$1
9+
10+
if [ "$#" -le 0 ]; then
11+
echo "Error: please provide a version to update to"
12+
exit 1
13+
fi
14+
15+
CURRENT_VERSION=$(grep "#define HDR_HISTOGRAM_VERSION_H" $HDR_HISTOGRAM_VERSION_H | sed -n "s/^.*VERSION_H \"\(.*\)\"/\1/p")
16+
17+
echo "Comparing $NEW_VERSION with $CURRENT_VERSION"
18+
19+
if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then
20+
echo "Skipped because is already on the latest version."
21+
exit 0
22+
fi
23+
24+
echo "Replacing $CURRENT_VERSION with new version $NEW_VERSION"
25+
26+
sed -i '' -e "s/#define HDR_HISTOGRAM_VERSION_H \"$CURRENT_VERSION\"/#define HDR_HISTOGRAM_VERSION_H \"$NEW_VERSION\"/g" $HDR_HISTOGRAM_VERSION_H
27+
28+
echo "All done!"
29+
30+
echo "NEW_VERSION=$NEW_VERSION"

0 commit comments

Comments
 (0)