Skip to content

Commit 7001839

Browse files
author
Artur Bać
committed
add version definition to code, v3.1.0
1 parent 6a85c2b commit 7001839

18 files changed

+54
-26
lines changed

CMakeLists.txt

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
cmake_minimum_required(VERSION 3.20 FATAL_ERROR )
22
include(CheckCXXCompilerFlag)
3-
3+
include(cmake/extract_version.cmake)
44
project(small_vectors
5-
VERSION 3.0.3
5+
VERSION ${small_vectors_version}
66
LANGUAGES CXX
77
HOMEPAGE_URL "https://github.com/arturbac/small_vectors"
88
)
99
include(GNUInstallDirs)
1010
include(FeatureSummary)
1111

12-
12+
if( PROJECT_IS_TOP_LEVEL )
13+
message(STATUS "small_vectors v${small_vectors_version}")
14+
endif()
1315
if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
1416
message(
1517
FATAL_ERROR

cmake/extract_version.cmake

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
cmake_minimum_required(VERSION 3.14) # Require at least CMake 3.14 for string(PREPEND ...)
2+
3+
# Read the version header file
4+
file(READ include/small_vectors/version.h version_file_contents)
5+
6+
# Extract the version number
7+
string(REGEX MATCH "SMALL_VECTORS_VERSION \"([0-9]+\\.[0-9]+\\.[0-9]+)\"" _ ${version_file_contents})
8+
set(small_vectors_version ${CMAKE_MATCH_1})
9+

git_tag.sh

+17-16
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
#!/bin/bash
22

3-
# Path to the top level CMakeLists.txt file
4-
CMAKE_FILE="CMakeLists.txt"
3+
# Path to the version header file
4+
VERSION_FILE="include/small_vectors/version.h"
55

6-
# Extract the version number
7-
#VERSION=$(grep "VERSION" $CMAKE_FILE | head -n 1 | awk '{print $2}')
8-
#VERSION=$(grep "VERSION" $CMAKE_FILE | head -n 1 | sed -E 's/.*VERSION ([0-9]+.[0-9]+.[0-9]+).*/\1/')
9-
#VERSION=$(grep "^project(" $CMAKE_FILE | sed -n 's/.*VERSION \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p')
10-
VERSION=$(tail -n +2 $CMAKE_FILE | grep "VERSION" | head -n 1 | awk '{print $2}')
6+
# Extract the version number from the file
7+
VERSION=$(grep 'SMALL_VECTORS_VERSION' $VERSION_FILE | sed 's/.*"\(.*\)".*/\1/')
118

12-
# Check if VERSION is empty
9+
# Check if the version was successfully extracted
1310
if [ -z "$VERSION" ]; then
14-
echo "Version not found in $CMAKE_FILE"
15-
exit 1
11+
echo "Error: Could not extract version from $VERSION_FILE"
12+
exit 1
1613
fi
1714

18-
# Prefix the version with a 'v'
15+
# Create a git tag with the extracted version, prefixed by 'v'
1916
TAG="v$VERSION"
2017

21-
# Add a git tag
22-
git tag -a $TAG -m "Release $TAG"
18+
echo "Creating git tag: $TAG"
2319

24-
# Optional: Push the tag to remote repository
25-
# git push origin $TAG
20+
# Check if the tag already exists
21+
if git rev-parse "$TAG" >/dev/null 2>&1; then
22+
echo "Error: Tag $TAG already exists."
23+
exit 1
24+
else
25+
git tag -a "$TAG" -m "Version $VERSION"
26+
echo "Git tag $TAG created successfully."
2627

27-
echo "Tag $TAG created and ready to be pushed."
28+
fi

include/small_vectors/algo/bound_leaning_lower_bound.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#pragma once
2+
3+
#include <small_vectors/version.h>
24
#include <concepts>
35
#include <iterator>
46

include/small_vectors/concepts/concepts.h

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#pragma once
2+
#include <small_vectors/version.h>
23
#include <concepts>
34
#include <type_traits>
45
#include <cstdint>

include/small_vectors/concepts/hashable.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#pragma once
2+
3+
#include <small_vectors/version.h>
24
#include <concepts>
35
#include <functional>
46

include/small_vectors/concepts/integral_or_byte.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#pragma once
2+
3+
#include <small_vectors/version.h>
24
#include <concepts>
35
#include <cstddef>
46

include/small_vectors/concepts/iterator_traits.h

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
22

3+
#include <small_vectors/version.h>
34
#include <iterator>
45
#include <type_traits>
56

include/small_vectors/interprocess/atomic_mutex.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#pragma once
2-
2+
#include <small_vectors/version.h>
33
#include <atomic>
44
#include <thread>
55

include/small_vectors/interprocess/fork.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#pragma once
2+
#include <small_vectors/version.h>
23
#include <concepts>
34
#include <optional>
45
#include <functional>
@@ -54,4 +55,4 @@ inline auto fork(function const & fn, Args... args) noexcept -> std::optional<fo
5455
else
5556
return {};
5657
}
57-
} // namespace ip
58+
} // namespace small_vectors::inline v3_0::ip

include/small_vectors/interprocess/ring_queue.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#pragma once
2+
3+
#include <small_vectors/version.h>
24
#include <type_traits>
35
#include <concepts>
46
#include <atomic>

include/small_vectors/interprocess/shared_mem_utils.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#pragma once
2+
#include <small_vectors/version.h>
23
#include <type_traits>
34
#include <concepts>
45
#include <cstdint>
@@ -75,4 +76,4 @@ inline auto ref(detail::concept_mapped_region auto & region) noexcept -> typenam
7576
return *std::launder(reinterpret_cast<type *>(addr));
7677
}
7778

78-
} // namespace ip
79+
} // namespace small_vectors::inline v3_0::ip

include/small_vectors/small_vector.h

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <small_vectors/detail/vector_storage.h>
2525
#include <small_vectors/detail/vector_func.h>
2626
#include <small_vectors/detail/adapter_iterator.h>
27+
2728
#include <span>
2829

2930
namespace small_vectors::inline v3_0::detail

include/small_vectors/utils/endian.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#pragma once
2-
2+
#include <small_vectors/utils/utility_cxx20.h>
33
#include <concepts>
44
#include <bit>
55
#include <cstdint>
66
#include <algorithm>
7-
#include <small_vectors/utils/utility_cxx20.h>
87

98
namespace small_vectors::inline v3_0::utils
109
{

include/small_vectors/utils/enum_support.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#pragma once
22

3-
#include <concepts>
43
#include <small_vectors/utils/utility_cxx20.h>
5-
4+
#include <concepts>
65
#include <cstdint>
76
#include <type_traits>
87
#include <string_view>

include/small_vectors/utils/static_call_operator.h

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#pragma once
2+
#include <small_vectors/version.h>
23
#include <cstdint>
34

45
#if defined(__cpp_static_call_operator)

include/small_vectors/utils/utility_cxx20.h

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#if !defined(SMALL_VECTORS_CXX_UTILITY)
2525
#define SMALL_VECTORS_CXX_UTILITY 1
2626

27+
#include <small_vectors/version.h>
2728
#include <type_traits>
2829
#include <cstdint>
2930
#include <limits>

include/small_vectors/version.h

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
#define SMALL_VECTORS_VERSION "3.1.0"

0 commit comments

Comments
 (0)