diff --git a/.gitignore b/.gitignore
index 2427ca2ce..ad66e34e9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,6 +52,7 @@ builds/gnu/*.pc
bin
build
obj
+non-persistent
# KDevelop IDE
/*.kdev4
diff --git a/builds/cmake/CMakeLists.txt b/builds/cmake/CMakeLists.txt
index bb1c98b6f..00b13459b 100644
--- a/builds/cmake/CMakeLists.txt
+++ b/builds/cmake/CMakeLists.txt
@@ -168,6 +168,15 @@ endif()
#------------------------------------------------------------------------------
include(CheckLinkerFlag)
+#------------------------------------------------------------------------------
+# Configurable file(s).
+#------------------------------------------------------------------------------
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../include/bitcoin/database/version.hpp.in
+ ${CMAKE_CURRENT_BINARY_DIR}/include/bitcoin/database/version.hpp
+ @ONLY )
+
#------------------------------------------------------------------------------
# libbitcoin-database library
#------------------------------------------------------------------------------
@@ -209,6 +218,10 @@ target_sources( libbitcoin-database
BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../include"
FILES
${libbitcoin_database_HEADERS}
+ FILE_SET HEADERS
+ BASE_DIRS "${CMAKE_CURRENT_BINARY_DIR}/include"
+ FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/include/bitcoin/database/version.hpp"
PRIVATE
${libbitcoin_database_SOURCES}
)
diff --git a/builds/gnu/Makefile.am b/builds/gnu/Makefile.am
index 4a9e0b34c..1873cf7d5 100644
--- a/builds/gnu/Makefile.am
+++ b/builds/gnu/Makefile.am
@@ -37,6 +37,7 @@ lib_LTLIBRARIES = src/libbitcoin-database.la
src_libbitcoin_database_la_LIBS = src/libbitcoin-database.la
src_libbitcoin_database_la_CPPFLAGS = \
+ -I${top_builddir}/include \
-I${srcdir}/../../include \
${libbitcoin_system_BUILD_CPPFLAGS}
@@ -79,7 +80,7 @@ include_bitcoin_database_HEADERS = \
${srcdir}/../../include/bitcoin/database/query.hpp \
${srcdir}/../../include/bitcoin/database/settings.hpp \
${srcdir}/../../include/bitcoin/database/store.hpp \
- ${srcdir}/../../include/bitcoin/database/version.hpp
+ include/bitcoin/database/version.hpp
include_bitcoin_database_filedir = \
${includedir}/bitcoin/database/file
diff --git a/builds/gnu/configure.ac b/builds/gnu/configure.ac
index ac071ccf1..58c2b5a3b 100644
--- a/builds/gnu/configure.ac
+++ b/builds/gnu/configure.ac
@@ -288,6 +288,7 @@ AS_IF([(test "x${with_tests}" != "xno")],
AC_CONFIG_FILES([
Makefile
libbitcoin-database.pc
+ include/bitcoin/database/version.hpp:${repository_root_dir}/include/bitcoin/database/version.hpp.in
])
AC_OUTPUT
diff --git a/builds/msvc/properties/GitSubstitute.ps1 b/builds/msvc/properties/GitSubstitute.ps1
new file mode 100644
index 000000000..4b90a2724
--- /dev/null
+++ b/builds/msvc/properties/GitSubstitute.ps1
@@ -0,0 +1,89 @@
+# GitSubstitute.ps1
+# Substitutes @TOKEN@ placeholders in a template (.in) file using values passed from MSBuild.
+# Intended to be invoked by GitSubstitution.props.
+
+[CmdletBinding()]
+param(
+ [Parameter(Mandatory = $true)]
+ [string] $InputPath,
+
+ [Parameter(Mandatory = $true)]
+ [string] $OutputPath,
+
+ [Parameter(Mandatory = $true)]
+ [string] $VersionMajorToken,
+
+ [Parameter(Mandatory = $true)]
+ [string] $VersionMinorToken,
+
+ [Parameter(Mandatory = $true)]
+ [string] $VersionPatchToken,
+
+ [Parameter(Mandatory = $true)]
+ [string] $GitCommitHashToken,
+
+ [Parameter(Mandatory = $true)]
+ [string] $GitOriginUrlToken,
+
+ [Parameter(Mandatory = $true)]
+ [string] $GitDirtyToken,
+
+ [Parameter(Mandatory = $true)]
+ [string] $VersionMajorValue,
+
+ [Parameter(Mandatory = $true)]
+ [string] $VersionMinorValue,
+
+ [Parameter(Mandatory = $true)]
+ [string] $VersionPatchValue,
+
+ [Parameter(Mandatory = $true)]
+ [AllowEmptyString()]
+ [string] $GitCommitHash,
+
+ [Parameter(Mandatory = $true)]
+ [AllowEmptyString()]
+ [string] $GitOriginUrl,
+
+ [Parameter(Mandatory = $true)]
+ [string] $GitDirty
+)
+
+$ErrorActionPreference = 'Stop'
+
+function Escape-RegexLiteral {
+ param([string] $Text)
+ return [regex]::Escape($Text)
+}
+
+if (-not (Test-Path -LiteralPath $InputPath)) {
+ throw "Input template not found: $InputPath"
+}
+
+$outDir = Split-Path -Parent $OutputPath
+if ($outDir -and -not (Test-Path -LiteralPath $outDir)) {
+ New-Item -ItemType Directory -Path $outDir -Force | Out-Null
+}
+
+$content = Get-Content -LiteralPath $InputPath -Raw
+
+# -replace treats the pattern as regex; escape tokens so '@...@' is matched literally.
+$replacements = @(
+ @{ Token = $VersionMajorToken; Value = $VersionMajorValue }
+ @{ Token = $VersionMinorToken; Value = $VersionMinorValue }
+ @{ Token = $VersionPatchToken; Value = $VersionPatchValue }
+ @{ Token = $GitCommitHashToken; Value = $GitCommitHash }
+ @{ Token = $GitOriginUrlToken; Value = $GitOriginUrl }
+ @{ Token = $GitDirtyToken; Value = $GitDirty }
+)
+
+foreach ($r in $replacements) {
+ $pattern = '@' + (Escape-RegexLiteral $r.Token) + '@'
+ # Replacement string: use MatchEvaluator so $ and other specials in values stay literal.
+ $content = [regex]::Replace($content, $pattern, { param($m) $r.Value })
+}
+
+# -NoNewline matches the previous inline script behavior.
+Set-Content -LiteralPath $OutputPath -Value $content -NoNewline -Encoding utf8
+
+Write-Host "Generated: $OutputPath"
diff --git a/builds/msvc/properties/GitSubstitution.props b/builds/msvc/properties/GitSubstitution.props
new file mode 100644
index 000000000..544fa6dc8
--- /dev/null
+++ b/builds/msvc/properties/GitSubstitution.props
@@ -0,0 +1,104 @@
+
+
+
+
+ <_PropertySheetDisplayName>Git Substitution (ConfigurableFile)
+
+
+ $(IntDir)generated\include\
+
+
+ LIBBITCOIN_VERSION_MAJOR
+ LIBBITCOIN_VERSION_MINOR
+ LIBBITCOIN_VERSION_PATCH
+ GIT_COMMIT_HASH
+ GIT_ORIGIN_URL
+ GIT_DIRTY
+
+
+ 4
+ 0
+
+
+
+
+
+
+ $(GeneratedIncludeDir);%(AdditionalIncludeDirectories)
+
+
+
+
+
+
+
+
+ <_GitRepoRoot Condition="'$(RepoRoot)' != ''">$([System.IO.Path]::GetFullPath('$(RepoRoot)').TrimEnd('\'))
+ <_GitRepoRoot Condition="'$(RepoRoot)' == ''">.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ unknown
+ unknown
+
+
+ 0
+ 0
+
+
+
+
+
+
+ 1
+ 0
+
+ $(GitCommitHeight)
+
+
+
+
+
+
+
+
+
diff --git a/builds/msvc/vs2026/libbitcoin-database-test/libbitcoin-database-test.props b/builds/msvc/vs2026/libbitcoin-database-test/libbitcoin-database-test.props
index 235f7e94b..ff0586a0e 100644
--- a/builds/msvc/vs2026/libbitcoin-database-test/libbitcoin-database-test.props
+++ b/builds/msvc/vs2026/libbitcoin-database-test/libbitcoin-database-test.props
@@ -1,6 +1,10 @@
+
+
+
+
<_PropertySheetDisplayName>Libbitcoin Database Test Common Settings
AllRules.ruleset
diff --git a/builds/msvc/vs2026/libbitcoin-database-tools/libbitcoin-database-tools.props b/builds/msvc/vs2026/libbitcoin-database-tools/libbitcoin-database-tools.props
index 61b127550..e7bfc2e5b 100644
--- a/builds/msvc/vs2026/libbitcoin-database-tools/libbitcoin-database-tools.props
+++ b/builds/msvc/vs2026/libbitcoin-database-tools/libbitcoin-database-tools.props
@@ -1,6 +1,10 @@
+
+
+
+
<_PropertySheetDisplayName>Libbitcoin Database Tools Common Settings
AllRules.ruleset
diff --git a/builds/msvc/vs2026/libbitcoin-database.import.props b/builds/msvc/vs2026/libbitcoin-database.import.props
index de00e1d24..532750910 100644
--- a/builds/msvc/vs2026/libbitcoin-database.import.props
+++ b/builds/msvc/vs2026/libbitcoin-database.import.props
@@ -16,6 +16,7 @@
$(ProjectDir)..\..\..\..\..\libbitcoin-database\include\;%(AdditionalIncludeDirectories)
+ $(ProjectDir)..\..\..\..\..\libbitcoin-database\non-persistent\include\;%(AdditionalIncludeDirectories)
BCD_STATIC;%(PreprocessorDefinitions)
@@ -32,4 +33,4 @@
-
\ No newline at end of file
+
diff --git a/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.props b/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.props
index 18e49f789..d27349b2a 100644
--- a/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.props
+++ b/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.props
@@ -1,6 +1,10 @@
+
+
+
+
<_PropertySheetDisplayName>Libbitcoin Database Library Common Settings
AllRules.ruleset
@@ -53,4 +57,4 @@
-
\ No newline at end of file
+
diff --git a/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.vcxproj b/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.vcxproj
index cfb5daf05..5031829a7 100644
--- a/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.vcxproj
+++ b/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.vcxproj
@@ -109,6 +109,22 @@
x64
+
+ $(ProjectDir)..\..\..\..\non-persistent\
+ $(GeneratedIncludeDirBase)include\
+
+
+
+ $(RepoRoot)include\bitcoin\database\version.hpp.in
+ $(GeneratedIncludeDirBase)include\bitcoin\database\version.hpp
+
+
+
+
+
+ %(ConfigurableFile.FileInput)
+
+
StaticLibrary
DynamicLibrary
@@ -241,7 +257,6 @@
-
@@ -331,6 +346,7 @@
+
diff --git a/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.vcxproj.filters b/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.vcxproj.filters
index 61558e599..7a96d3752 100644
--- a/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.vcxproj.filters
+++ b/builds/msvc/vs2026/libbitcoin-database/libbitcoin-database.vcxproj.filters
@@ -449,9 +449,6 @@
include\bitcoin\database\unspent
-
- include\bitcoin\database
-
@@ -715,6 +712,9 @@
include\bitcoin\database\impl\unspent
+
+ include\bitcoin\database
+
diff --git a/builds/msvc/vs2026/libbitcoin-system.import.props b/builds/msvc/vs2026/libbitcoin-system.import.props
index e0bfc2478..2d45bfff1 100644
--- a/builds/msvc/vs2026/libbitcoin-system.import.props
+++ b/builds/msvc/vs2026/libbitcoin-system.import.props
@@ -52,6 +52,8 @@
$(ProjectDir)..\..\..\..\..\libbitcoin-system\include\;%(AdditionalIncludeDirectories)
+ $(ProjectDir)..\..\..\..\..\libbitcoin-system\non-persistent\include\;%(AdditionalIncludeDirectories)
+
WIN32_LEAN_AND_MEAN;NOMINMAX;_WIN32_WINNT=0x0A00;%(PreprocessorDefinitions)
diff --git a/include/bitcoin/database/version.hpp b/include/bitcoin/database/version.hpp.in
similarity index 51%
rename from include/bitcoin/database/version.hpp
rename to include/bitcoin/database/version.hpp.in
index 47798c5a7..0dca45f3f 100644
--- a/include/bitcoin/database/version.hpp
+++ b/include/bitcoin/database/version.hpp.in
@@ -12,9 +12,12 @@
* For interpretation of the versioning scheme see: http://semver.org
*/
-#define LIBBITCOIN_DATABASE_VERSION "4.0.0"
-#define LIBBITCOIN_DATABASE_MAJOR_VERSION 4
-#define LIBBITCOIN_DATABASE_MINOR_VERSION 0
-#define LIBBITCOIN_DATABASE_PATCH_VERSION 0
+#define LIBBITCOIN_DATABASE_VERSION "@LIBBITCOIN_VERSION_MAJOR@.@LIBBITCOIN_VERSION_MINOR@.@LIBBITCOIN_VERSION_PATCH@"
+#define LIBBITCOIN_DATABASE_MAJOR_VERSION @LIBBITCOIN_VERSION_MAJOR@
+#define LIBBITCOIN_DATABASE_MINOR_VERSION @LIBBITCOIN_VERSION_MINOR@
+#define LIBBITCOIN_DATABASE_PATCH_VERSION @LIBBITCOIN_VERSION_PATCH@
+#define LIBBITCOIN_DATABASE_COMMIT_HASH "@GIT_COMMIT_HASH@"
+#define LIBBITCOIN_DATABASE_REPOSITORY_URL "@GIT_ORIGIN_URL@"
+#define LIBBITCOIN_DATABASE_IS_DIRTY @GIT_DIRTY@
#endif