diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 33d95367..b26c578b 100755
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -18,26 +18,29 @@ jobs:
- os: ubuntu-latest
script: generate4.sh
branch: master
+ shell: bash
- os: macos-latest
script: generate4.sh
branch: master
+ shell: bash
- os: windows-latest
script: generate4.cmd
branch: master
+ shell: cmd
runs-on: ${{ matrix.os }}
steps:
- - name: Checkout repository
+ - name: Checkout repository [build]
uses: actions/checkout@v6
with:
fetch-depth: 1
path: 'libbitcoin-build'
repository: ${{ github.repository }}
- - name: Checkout repository
+ - name: Checkout repository [system]
uses: actions/checkout@v6
with:
fetch-depth: 1
@@ -45,23 +48,7 @@ jobs:
repository: '${{ github.repository_owner }}/libbitcoin-system'
ref: ${{ matrix.branch }}
- - name: Checkout repository
- uses: actions/checkout@v6
- with:
- fetch-depth: 1
- path: 'libbitcoin-protocol'
- repository: '${{ github.repository_owner }}/libbitcoin-protocol'
- ref: ${{ matrix.branch }}
-
- - name: Checkout repository
- uses: actions/checkout@v6
- with:
- fetch-depth: 1
- path: 'libbitcoin-client'
- repository: '${{ github.repository_owner }}/libbitcoin-client'
- ref: ${{ matrix.branch }}
-
- - name: Checkout repository
+ - name: Checkout repository [explorer]
uses: actions/checkout@v6
with:
fetch-depth: 1
@@ -69,7 +56,7 @@ jobs:
repository: '${{ github.repository_owner }}/libbitcoin-explorer'
ref: ${{ matrix.branch }}
- - name: Checkout repository
+ - name: Checkout repository [network]
uses: actions/checkout@v6
with:
fetch-depth: 1
@@ -77,15 +64,7 @@ jobs:
repository: '${{ github.repository_owner }}/libbitcoin-network'
ref: ${{ matrix.branch }}
- - name: Checkout repository
- uses: actions/checkout@v6
- with:
- fetch-depth: 1
- path: 'libbitcoin-consensus'
- repository: '${{ github.repository_owner }}/libbitcoin-consensus'
- ref: ${{ matrix.branch }}
-
- - name: Checkout repository
+ - name: Checkout repository [database]
uses: actions/checkout@v6
with:
fetch-depth: 1
@@ -93,15 +72,7 @@ jobs:
repository: '${{ github.repository_owner }}/libbitcoin-database'
ref: ${{ matrix.branch }}
- - name: Checkout repository
- uses: actions/checkout@v6
- with:
- fetch-depth: 1
- path: 'libbitcoin-blockchain'
- repository: '${{ github.repository_owner }}/libbitcoin-blockchain'
- ref: ${{ matrix.branch }}
-
- - name: Checkout repository
+ - name: Checkout repository [node]
uses: actions/checkout@v6
with:
fetch-depth: 1
@@ -109,7 +80,7 @@ jobs:
repository: '${{ github.repository_owner }}/libbitcoin-node'
ref: ${{ matrix.branch }}
- - name: Checkout repository
+ - name: Checkout repository [server]
uses: actions/checkout@v6
with:
fetch-depth: 1
@@ -117,7 +88,7 @@ jobs:
repository: '${{ github.repository_owner }}/libbitcoin-server'
ref: ${{ matrix.branch }}
- - name: Checkout repository
+ - name: Checkout repository [zeromq/gsl]
if: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') }}
uses: actions/checkout@v6
with:
@@ -125,30 +96,30 @@ jobs:
path: 'gsl'
repository: 'zeromq/gsl'
- - name: Prepare toolchain [macos]
+ - name: Prepare platform toolchain [macos]
if: ${{ startsWith(matrix.os, 'macos') }}
run: |
brew install pcre
- - name: Prepare toolchain [ubuntu]
+ - name: Prepare platform toolchain [ubuntu]
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt-get update
sudo apt-get install libpcre3-dev
- - name: Prepare toolchain [windows]
+ - name: Prepare platform toolchain [windows]
if: ${{ startsWith(matrix.os, 'windows') }}
uses: microsoft/setup-msbuild@v3
- - name: Build gsl [macos]
+ - name: Aquire gsl [macos]
if: ${{ startsWith(matrix.os, 'macos') }}
run: |
pushd "gsl/src"
CPPFLAGS="-I/opt/homebrew/include ${CPPFLAGS}" make --silent
sudo make install
popd
-
- - name: Build gsl [ubuntu]
+
+ - name: Aquire gsl [ubuntu]
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
pushd "gsl/src"
@@ -156,21 +127,28 @@ jobs:
sudo make install
popd
- - name: Retrieve gsl binary [windows]
+ - name: Aquire gsl [windows]
if: ${{ startsWith(matrix.os, 'windows') }}
shell: powershell
run: |
- Invoke-WebRequest -Uri "https://github.com/imatix/gsl/releases/download/NuGet-4.1.0.1/gsl.exe" -OutFile "${{ github.workspace }}\libbitcoin-build\gsl.exe"
+ echo "${{ github.workspace }}\libbitcoin-build\bin\winx64" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
- - name: Execute generation [macos, ubuntu]
- if: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') }}
- run: |
- pushd libbitcoin-build
+ - name: Execute generation [bash]
+ if: ${{ startsWith(matrix.shell, 'bash') }}
+ shell: bash
+ working-directory: ${{ github.workspace }}/libbitcoin-build
+ run: >
./${{ matrix.script }}
- popd
- - name: Execute generation [windows]
- if: ${{ startsWith(matrix.os, 'windows') }}
+ - name: Execute generation [cmd]
+ if: ${{ startsWith(matrix.shell, 'cmd') }}
shell: cmd
- run: .\libbitcoin-build\${{ matrix.script }}
+ working-directory: ${{ github.workspace }}\libbitcoin-build
+ run: .\\${{ matrix.script }}
+
+ - name: Execute generation [powershell]
+ if: ${{ startsWith(matrix.shell, 'powershell') }}
+ shell: pwsh
+ working-directory: ${{ github.workspace }}\libbitcoin-build
+ run: .\\${{ matrix.script }}
diff --git a/bin/winx64/gsl.exe b/bin/winx64/gsl.exe
new file mode 100755
index 00000000..bab148f8
Binary files /dev/null and b/bin/winx64/gsl.exe differ
diff --git a/generate.cmd b/generate.cmd
index af85ffd1..74b7bee0 100644
--- a/generate.cmd
+++ b/generate.cmd
@@ -1,6 +1,5 @@
@echo off
setlocal EnableDelayedExpansion
-
REM ###########################################################################
REM Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
REM
@@ -16,54 +15,98 @@ REM ###########################################################################
REM Do everything relative to this file location.
pushd %~dp0
+set "GSL_EXE=gsl -q"
+
if "%~1"=="" (
- echo Usage: %~nx0 configuration [targets...]
- echo.
- echo configuration required xml file
- echo targets all targets to be copied
+ call :msg "Usage: %~nx0 configuration [targets...]"
+ call :msg ""
+ call :msg " configuration required xml file"
+ call :msg " targets all targets to be copied"
exit /b 1
)
-set "configuration=%~1"
+set "CONFIG=%~1"
shift
-set "targets="
+set "TARGETS="
call :populate_targets %*
-set "names[1]=generate_artifacts"
-set "names[2]=copy_statics"
-set "names[3]=copy_projects"
-set "names.length=3"
-
-for /L %%i in (1,1,%names.length%) do (
- echo gsl -q -script:"process\!names[%%i]!.cmd.gsl" "!configuration!"
- gsl -q -script:"process\!names[%%i]!.cmd.gsl" "!configuration!"
- if %errorlevel% neq 0 (
- echo FAILURE: evaluating "process\!names[%%i]!.cmd.gsl".
- exit /b %errorlevel%
+set "NAMES[1]=generate_artifacts"
+set "NAMES[2]=copy_statics"
+set "NAMES[3]=copy_projects"
+set "NAMES.length=3"
+
+for /L %%i in (1,1,%NAMES.length%) do (
+ call :msg "!GSL_EXE! -q -script:'process\!NAMES[%%i]!.cmd.gsl' '!CONFIG!'"
+ !GSL_EXE! -q -script:"process\!NAMES[%%i]!.cmd.gsl" "!CONFIG!"
+ if %ERRORLEVEL% neq 0 (
+ echo FAILURE: evaluating "process\!NAMES[%%i]!.cmd.gsl".
+ exit /b %ERRORLEVEL%
)
)
REM Execute process scripts (explicit enumeration).
pushd process
-for /L %%i in (1,1,%names.length%) do (
- call !names[%%i]!.cmd !targets!
- if %errorlevel% neq 0 (
- exit /b %errorlevel%
+for /L %%i in (1,1,%NAMES.length%) do (
+ call !NAMES[%%i]!.cmd !targets!
+ if %ERRORLEVEL% neq 0 (
+ exit /b %ERRORLEVEL%
)
)
popd
-echo "Generation for configuration %CONFIGURATION% complete."
-::pause
+echo "Generation for configuration %CONFIG% complete."
+REM Commented out until calling script is obsolete
+REM if not defined CI (
+REM pause
+REM )
+
exit /b 0
+
+
:populate_targets
shift
- :begin
+:begin
if "%1"=="" goto done
- set "targets=%targets% %~1"
+ set "TARGETS=!TARGETS! %~1"
shift
goto begin
- :done
+:done
exit /b 0
+
+:msg_heading
+ call :msg "***************************************************************************"
+ call :msg "%~1"
+ call :msg "***************************************************************************"
+ exit /b %ERRORLEVEL%
+
+:msg
+ if "%~1" == "" (
+ echo.
+ ) else (
+ echo %~1
+ )
+ exit /b %ERRORLEVEL%
+
+:msg_empty
+ echo.
+ exit /b %ERRORLEVEL%
+
+:msg_verbose
+ if "!DISPLAY_VERBOSE!" == "yes" (
+ echo [96m%~1[0m
+ )
+ exit /b %ERRORLEVEL%
+
+:msg_success
+ echo [92m%~1[0m
+ exit /b %ERRORLEVEL%
+
+:msg_warn
+ echo [93m%~1[0m
+ exit /b %ERRORLEVEL%
+
+:msg_error
+ echo [91m%~1[0m
+ exit /b %ERRORLEVEL%
diff --git a/generate.sh b/generate.sh
index dac6ef50..1512db25 100755
--- a/generate.sh
+++ b/generate.sh
@@ -8,44 +8,141 @@
# See https://github.com/imatix/gsl for details.
###############################################################################
-generate_input()
+OPTS_ENABLE="set -eo pipefail"
+OPTS_DISABLE="set +e"
+
+eval "${OPTS_ENABLE}"
+trap 'msg_error "FATAL ERROR: Command failed at line ${LINENO}: ${BASH_COMMAND}" >&2' ERR
+
+GSL="gsl -q"
+COLOR_CYAN='\e[0;96m'
+COLOR_GREEN='\e[0;92m'
+COLOR_RED='\e[0;91m'
+COLOR_YELLOW='\e[0;93m'
+COLOR_RESET='\e[0m'
+
+main()
{
if [[ $# -eq 0 ]]; then
- echo "Usage: ${BASH_SOURCE[0]##*/} configuration [targets...]"
- echo ""
- echo " configuration required xml file"
- echo " targets all targets to be copied"
+ display_usage
exit 1
fi
CONFIGURATION=$1
shift
- echo "Generating for configuration ${CONFIGURATION}..."
+ # Do everything relative to this file location.
+ BUILD_PATH=`dirname "$0"`
+ push_directory ${BUILD_PATH}
+
+ msg "Generating for configuration ${CONFIGURATION}..."
# Generate process scripts (explict enumeration).
- eval gsl -q -script:process/generate_artifacts.sh.gsl ${CONFIGURATION}
- eval gsl -q -script:process/copy_statics.sh.gsl ${CONFIGURATION}
- eval gsl -q -script:process/copy_projects.sh.gsl ${CONFIGURATION}
+ msg_warn "${GSL} -script:process/generate_artifacts.sh.gsl ${CONFIGURATION}"
+ eval ${GSL} -script:process/generate_artifacts.sh.gsl ${CONFIGURATION}
+ msg_warn "${GSL} -script:process/copy_statics.sh.gsl ${CONFIGURATION}"
+ eval ${GSL} -script:process/copy_statics.sh.gsl ${CONFIGURATION}
+ msg_warn "${GSL} -script:process/copy_projects.sh.gsl ${CONFIGURATION}"
+ eval ${GSL} -script:process/copy_projects.sh.gsl ${CONFIGURATION}
# Make process scripts executable.
+ msg_verbose "Modifying properties of shell scripts."
eval chmod +x process/*.sh
# Execute process scripts (explicit enumeration).
- echo "Generating artifacts for configuration ${CONFIGURATION}..."
+ msg_warn "Generating artifacts for configuration ${CONFIGURATION}..."
eval ./process/generate_artifacts.sh
- pushd process
+ push_directory process
eval ./copy_statics.sh "$@"
eval ./copy_projects.sh "$@"
- popd
- echo "Generation for configuration ${CONFIGURATION} complete."
+ pop_directory
+ pop_directory
+ msg_success "Generation for configuration ${CONFIGURATION} completed successfully."
}
-# Exit this script on the first build error.
-set -e
+create_directory()
+{
+ local DIRECTORY="$1"
+ local MODE="$2"
+
+ if [[ -d "${DIRECTORY}" ]]; then
+ if [[ ${MODE} == "-f" ]]; then
+ msg_warn "Reinitializing '${DIRECTORY}'..."
+ rm -rf "${DIRECTORY}"
+ mkdir -p "${DIRECTORY}"
+ else
+ msg_warn "Reusing existing '${DIRECTORY}'..."
+ fi
+ else
+ msg "Initializing '${DIRECTORY}'..."
+ mkdir -p "${DIRECTORY}"
+ fi
+}
+
+display_usage()
+{
+ msg "Usage: ${BASH_SOURCE[0]##*/} configuration [targets...]"
+ msg ""
+ msg " configuration required xml file"
+ msg " targets all targets to be copied"
+}
-# Do everything relative to this file location.
-BUILD_PATH=`dirname "$0"`
-pushd ${BUILD_PATH}
+create_directory_force()
+{
+ create_directory "$@" -f
+}
+
+pop_directory()
+{
+ msg_verbose "*** move pre: '$(pwd)'"
+ popd >/dev/null
+ msg_verbose "*** move post: '$(pwd)'"
+}
+
+push_directory()
+{
+ msg_verbose "*** move pre: '$(pwd)'"
+ local DIRECTORY="$1"
+ pushd "${DIRECTORY}" >/dev/null
+ msg_verbose "*** move post: '$(pwd)'"
+}
+
+remove_directory_force()
+{
+ msg_verbose "*** removing: '$@'"
+ rm -rf "$@"
+}
+
+msg_heading()
+{
+ printf "\n********************** %b **********************\n" "$@"
+}
+
+msg_verbose()
+{
+ if [[ "${DISPLAY_VERBOSE}" == "yes" ]]; then
+ printf "${COLOR_CYAN}%b${COLOR_RESET}\n" "$@"
+ fi
+}
+
+msg()
+{
+ printf "%b\n" "$@"
+}
+
+msg_success()
+{
+ printf "${COLOR_GREEN}%b${COLOR_RESET}\n" "$@"
+}
+
+msg_warn()
+{
+ printf "${COLOR_YELLOW}%b${COLOR_RESET}\n" "$@"
+}
+
+msg_error()
+{
+ >&2 printf "${COLOR_RED}%b${COLOR_RESET}\n" "$@"
+}
-generate_input "$@"
+main "$@"
diff --git a/generate4.cmd b/generate4.cmd
index 3cd2f946..c62b04c8 100644
--- a/generate4.cmd
+++ b/generate4.cmd
@@ -1,4 +1,6 @@
@echo off
+setlocal EnableDelayedExpansion
+setlocal EnableExtensions
REM ###########################################################################
REM Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
REM
@@ -12,29 +14,137 @@ REM Extract gsl.exe from package using NuGet's File > Export
REM ###########################################################################
REM Do everything relative to this file location.
+set "PATH_INITIAL=!CD!"
pushd %~dp0
+set "PATH_FILE=!CD!"
+set "GSL_EXE=gsl -q"
REM Clean directories for generated build artifacts.
rmdir /s /q "output" 2>NUL
-REM Generate property copiers and artifact generators.
-gsl -q -script:gsl.copy_properties.cmd generate4.xml
-gsl -q -script:gsl.generate_artifacts.cmd generate4.xml
+call :msg "Current directory: !CD!"
+if not exist "!CD!\generate4.xml" (
+ call :msg_error "Error: 'generate4.xml' not found in '!CD!'."
+ exit /b 1
+) else (
+ call :msg_success "File 'generate4.xml' appears in '!CD!'."
+)
-REM Generate bindings from generated binding generators.
-REM The path to swig.exe must be in our path.
-REM for generate.repository by name as _repo
-REM call ..\\$(_repo.name)\\bindings.bat
-REM endfor
+call :msg_heading "Begin Execution context"
+call :msg "PATH_INITIAL : !PATH_INITIAL!"
+call :msg "PATH_FILE : !PATH_FILE!"
+call :msg "GSL_EXE : !GSL_EXE!"
+call :msg "GITHUB_PATH : !GITHUB_PATH!"
+call :msg_heading "End Execution context"
-REM Execute property copiers and artifact generators.
-call copy_properties.cmd
-call generate_artifacts.cmd
-call generate.cmd version4.xml %*
-call copy_projects.cmd %*
+!GSL_EXE! -q -script:"!CD!\gsl.copy_properties.cmd" "!CD!\generate4.xml"
+if %ERRORLEVEL% neq 0 (
+ call :msg_error "GSL execution failure."
+ exit /b 1
+)
+
+!GSL_EXE! -q -script:"!CD!\gsl.generate_artifacts.cmd" "!CD!\generate4.xml"
+if %ERRORLEVEL% neq 0 (
+ call :msg_error "GSL execution failure."
+ exit /b 1
+)
+
+if not exist "!CD!\copy_properties.cmd" (
+ call :msg_error "Error: 'copy_properties.cmd' not found in '!CD!'."
+ exit /b 1
+)
+
+call :msg "Execute copy_properties.cmd..."
+call "!CD!\copy_properties.cmd"
+if %ERRORLEVEL% neq 0 (
+ call :msg_error "Failure calling 'copy_properties.cmd'."
+ exit /b 1
+)
+
+if not exist "!CD!\generate_artifacts.cmd" (
+ call :msg_error "Error: 'generate_artifacts.cmd' not found in '!CD!'."
+ exit /b 1
+)
+
+call :msg "Execute generate_artifacts.cmd..."
+call "!CD!\generate_artifacts.cmd"
+if %ERRORLEVEL% neq 0 (
+ call :msg_error "Failure calling 'generate_artifacts.cmd'."
+ exit /b 1
+)
+
+if not exist "!CD!\generate.cmd" (
+ call :msg_error "Error: 'generate.cmd' not found in '!CD!'."
+ exit /b 1
+)
+
+if not exist "!CD!\version4.xml" (
+ call :msg_error "Error: 'version4.xml' not found in '!CD!'."
+ exit /b 1
+)
+
+call :msg "Execute generate.cmd..."
+call "!CD!\generate.cmd" "!CD!\version4.xml" %*
+if %ERRORLEVEL% neq 0 (
+ call :msg_error "Failure calling 'generate.cmd'."
+ exit /b 1
+)
+
+if not exist "!CD!\copy_projects.cmd" (
+ call :msg_error "Error: 'copy_projects.cmd' not found in '!CD!'."
+ exit /b 1
+)
+
+call :msg "Execute copy_projects.cmd..."
+call "!CD!\copy_projects.cmd" %*
+if %ERRORLEVEL% neq 0 (
+ call :msg_error "Failure calling 'copy_projects.cmd'."
+ exit /b 1
+)
REM Restore directory.
popd
+call :msg_success "Script execution completed successfully."
REM Delay for manual confirmation.
-call pause
+if not defined CI (
+ pause
+)
+
+exit /b 0
+
+:msg_heading
+ call :msg "***************************************************************************"
+ call :msg "%~1"
+ call :msg "***************************************************************************"
+ exit /b %ERRORLEVEL%
+
+:msg
+ if "%~1" == "" (
+ echo.
+ ) else (
+ echo %~1
+ )
+ exit /b %ERRORLEVEL%
+
+:msg_empty
+ echo.
+ exit /b %ERRORLEVEL%
+
+:msg_verbose
+ if "!DISPLAY_VERBOSE!" == "yes" (
+ echo [96m%~1[0m
+ )
+ exit /b %ERRORLEVEL%
+
+:msg_success
+ echo [92m%~1[0m
+ exit /b %ERRORLEVEL%
+
+:msg_warn
+ echo [93m%~1[0m
+ exit /b %ERRORLEVEL%
+
+:msg_error
+ echo [91m%~1[0m
+ exit /b %ERRORLEVEL%
diff --git a/generate4.sh b/generate4.sh
index d14a2d2f..745f385b 100755
--- a/generate4.sh
+++ b/generate4.sh
@@ -8,31 +8,128 @@
# See https://github.com/imatix/gsl for details.
###############################################################################
-# Exit this script on the first build error.
-set -e
-
-# Do everything relative to this file location.
-cd `dirname "$0"`
-
-# Clean directories for generated build artifacts.
-eval rm -rf "output"
-
-# Generate property copiers and artifact generators.
-eval gsl -q -script:gsl.copy_properties.sh generate4.xml
-eval gsl -q -script:gsl.generate_artifacts.sh generate4.xml
-
-# Generate bindings from generated binding generators.
-# The path to swig must be in our path.
-# for generate.repository by name as _repo
-# eval ../$(_repo.name)/bindings.sh
-# endfor
-
-# Make property copiers and artifact generators executable.
-eval chmod +x copy_properties.sh
-eval chmod +x generate_artifacts.sh
-
-# Execute property copiers and artifact generators.
-eval ./copy_properties.sh
-eval ./generate_artifacts.sh
-eval ./generate.sh version4.xml
-eval ./copy_projects.sh "$@"
+OPTS_ENABLE="set -eo pipefail"
+OPTS_DISABLE="set +e"
+
+eval "${OPTS_ENABLE}"
+trap 'msg_error "FATAL ERROR: Command failed at line ${LINENO}: ${BASH_COMMAND}" >&2' ERR
+
+GSL="gsl -q"
+COLOR_CYAN='\e[0;96m'
+COLOR_GREEN='\e[0;92m'
+COLOR_RED='\e[0;91m'
+COLOR_YELLOW='\e[0;93m'
+COLOR_RESET='\e[0m'
+
+main()
+{
+ # Do everything relative to this file location.
+ push_directory `dirname "$0"`
+
+ # Clean directories for generated build artifacts.
+ remove_directory_force "output"
+
+ # Generate property copiers and artifact generators.
+ msg_warn "${GSL} -script:gsl.copy_properties.sh generate4.xml"
+ eval ${GSL} -script:gsl.copy_properties.sh generate4.xml
+ msg_warn "${GSL} -script:gsl.generate_artifacts.sh generate4.xml"
+ eval ${GSL} -script:gsl.generate_artifacts.sh generate4.xml
+
+ # Make property copiers and artifact generators executable.
+ msg_verbose "Modifying properties of shell scripts."
+ eval chmod +x copy_properties.sh
+ eval chmod +x generate_artifacts.sh
+
+ # Execute property copiers and artifact generators.
+
+ msg "Execute copy_properties.sh..."
+ eval ./copy_properties.sh
+ msg "Execute generate_artifacts.sh..."
+ eval ./generate_artifacts.sh
+ msg "Execute generate.sh..."
+ eval ./generate.sh version4.xml
+ msg "Execute copy_projects.sh..."
+ eval ./copy_projects.sh "$@"
+
+ pop_directory
+ msg_success "Script execution completed successfully."
+}
+
+create_directory()
+{
+ local DIRECTORY="$1"
+ local MODE="$2"
+
+ if [[ -d "${DIRECTORY}" ]]; then
+ if [[ ${MODE} == "-f" ]]; then
+ msg_warn "Reinitializing '${DIRECTORY}'..."
+ rm -rf "${DIRECTORY}"
+ mkdir -p "${DIRECTORY}"
+ else
+ msg_warn "Reusing existing '${DIRECTORY}'..."
+ fi
+ else
+ msg "Initializing '${DIRECTORY}'..."
+ mkdir -p "${DIRECTORY}"
+ fi
+}
+
+create_directory_force()
+{
+ create_directory "$@" -f
+}
+
+pop_directory()
+{
+ msg_verbose "*** move pre: '$(pwd)'"
+ popd >/dev/null
+ msg_verbose "*** move post: '$(pwd)'"
+}
+
+push_directory()
+{
+ msg_verbose "*** move pre: '$(pwd)'"
+ local DIRECTORY="$1"
+ pushd "${DIRECTORY}" >/dev/null
+ msg_verbose "*** move post: '$(pwd)'"
+}
+
+remove_directory_force()
+{
+ msg_verbose "*** removing: '$@'"
+ rm -rf "$@"
+}
+
+msg_heading()
+{
+ printf "\n********************** %b **********************\n" "$@"
+}
+
+msg_verbose()
+{
+ if [[ "${DISPLAY_VERBOSE}" == "yes" ]]; then
+ printf "${COLOR_CYAN}%b${COLOR_RESET}\n" "$@"
+ fi
+}
+
+msg()
+{
+ printf "%b\n" "$@"
+}
+
+msg_success()
+{
+ printf "${COLOR_GREEN}%b${COLOR_RESET}\n" "$@"
+}
+
+msg_warn()
+{
+ printf "${COLOR_YELLOW}%b${COLOR_RESET}\n" "$@"
+}
+
+msg_error()
+{
+ >&2 printf "${COLOR_RED}%b${COLOR_RESET}\n" "$@"
+}
+
+main "$@"
diff --git a/generate4.xml b/generate4.xml
index f86abe3e..757c679f 100644
--- a/generate4.xml
+++ b/generate4.xml
@@ -193,7 +193,7 @@
@@ -407,7 +407,7 @@
@@ -416,7 +416,7 @@
@@ -622,7 +622,7 @@
@@ -630,7 +630,7 @@
@@ -788,7 +788,7 @@
@@ -797,7 +797,7 @@
@@ -993,7 +993,7 @@
@@ -1001,7 +1001,7 @@
@@ -1010,7 +1010,7 @@
@@ -1200,7 +1200,7 @@
@@ -1209,7 +1209,7 @@
@@ -1616,22 +1616,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/lib/cmake-output.gsl b/lib/cmake-output.gsl
new file mode 100644
index 00000000..aed7ef87
--- /dev/null
+++ b/lib/cmake-output.gsl
@@ -0,0 +1,74 @@
+.template 0
+###############################################################################
+# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
+#
+# GSL libbitcoin cmake utilities in the 'global' scope.
+#
+# This is a code generator built using the iMatix GSL code generation
+# language. See https://github.com/imatix/gsl for details.
+###############################################################################
+
+### requires: xml.gsl
+
+###############################################################################
+# Functions
+###############################################################################
+.endtemplate
+.template 1
+.
+.##############################################################################
+.# Macros
+.##############################################################################
+.
+.macro global.copyleft(name)
+###############################################################################
+# Copyright (c) 2014-2026 $(my.name) developers (see COPYING).
+#
+# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY
+#
+###############################################################################
+.endmacro
+.
+.macro global.heading(text)
+#------------------------------------------------------------------------------
+# $(my.text)
+#------------------------------------------------------------------------------
+.endmacro
+.
+.macro emit_find_dependency(dependency, target, repository, host, function_name)
+. define my.dependency = emit_find_dependency.dependency
+. define my.target = emit_find_dependency.target
+. define my.repository = emit_find_dependency.repository
+. define my.host = emit_find_dependency.host
+. define my.function_name = emit_find_dependency.function_name
+.
+. define my.indent = ""
+.
+
+. if defined(my.dependency.option)
+. my.indent = " "
+if ( $(get_option(my.dependency, my.target, my.repository)) )
+. endif
+.
+. define my.has_components = (count(my.dependency.component) > 0)
+. define my.eol = my.has_components ?? "" ? " )"
+. define my.version = defined(my.dependency.version) ?? " $(my.dependency.version)" ? ""
+. define my.name = package_name(my.dependency, my.host)
+.
+$(my.indent)$(my.function_name)( $(my.name)$(my.version) REQUIRED$(my.eol)
+.
+. if (my.has_components)
+ $(my.indent)COMPONENTS
+. for my.dependency.component as _component
+ $(my.indent)$(_component.name)
+. endfor
+$(my.indent))
+. endif
+.
+. if defined(my.dependency.option)
+endif()
+. endif
+.
+.endmacro # emit_find_dependency
+.
+.endtemplate
diff --git a/lib/cmake.gsl b/lib/cmake.gsl
deleted file mode 100644
index d14e846c..00000000
--- a/lib/cmake.gsl
+++ /dev/null
@@ -1,152 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL libbitcoin cmake utilities in the 'global' scope.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-
-###############################################################################
-# Functions
-###############################################################################
-function registry(registrar, query)
- define my.registrar = registry.registrar
- define my.query = registry.query
-
- if !defined(my.query.name)
- abort "Malformed query: $(my.query)"
- endif
-
- if !(count(my.registrar->element(element.name = my.query.name)) = 1)
- abort "Registrar lacks single entry for '$(my.query.name)'."
- endif
-
- return my.registrar->element(element.name = my.query.name)
-endfunction
-
-function package_name(query)
- define my.query = package_name.query
- define my.registry = registry(configuration->registrar(id = "dependency"), my.query)
-
- if !defined(my.registry)
- abort "Missing registry for '$(my.query)'."
- endif
-
- if !defined(my.registry->cmake) | !defined(my.registry->cmake.package)
- abort "Missing registry details for '$(my.query)'."
- endif
-
- return my.registry->cmake.package
-endfunction
-
-function find_option_declaration(name, target, repository)
- define my.name = find_option_declaration.name
- define my.target = find_option_declaration.target
- define my.repository = find_option_declaration.repository
-
- if (count(my.target.option, .name = my.name) > 0)
- define my.target_option = my.target->option(option.name = my.name)
-
- if defined(my.target_option)
- return my.target_option
- endif
- endif
-
- for my.target.dependency as _depend
- if (count(my.repository.library, library.name = _depend.name) > 0)
- if defined(my.repository->library(library.name = _depend.name)->option(option.name = my.name))
- return my.repository->library(name = _depend.name)->option(name = my.name)
- endif
- else
- for configuration.repository as _repo
- if (count(_repo.library, library.name = _depend.name) > 0)
- if defined(_repo->library(name = _depend.name)->option(name = my.name))
- return _repo->library(name = _depend.naem)->option(name = my.name)
- endif
- endif
- endfor
- endif
- endfor
-
- abort "Missing option matching name '$(my.name)'."
-endfunction
-
-function get_option(reference, target, repository)
- define my.reference = get_option.reference
- define my.target = get_option.target
- define my.repository = get_option.repository
- define my.result = ""
-
- if (defined(my.reference.option))
- define my.option = find_option_declaration(my.reference.option, my.target, my.repository)
-
- if (!defined(my.option))
- abort "Target '$(my.target.name)' missing option '$(my.reference.option)'."
- endif
-
- my.result = "$(my.option.type:lower)-$(my.option.name:lower)"
- endif
-
- return my.result
-endfunction
-
-.endtemplate
-.template 1
-.
-.##############################################################################
-.# Macros
-.##############################################################################
-.
-.macro global.copyleft(name)
-###############################################################################
-# Copyright (c) 2014-2026 $(my.name) developers (see COPYING).
-#
-# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY
-#
-###############################################################################
-.endmacro
-.
-.macro global.heading(text)
-#------------------------------------------------------------------------------
-# $(my.text)
-#------------------------------------------------------------------------------
-.endmacro
-.
-.macro emit_find_dependency(dependency, target, repository, function_name)
-. define my.dependency = emit_find_dependency.dependency
-. define my.target = emit_find_dependency.target
-. define my.repository = emit_find_dependency.repository
-. define my.function_name = emit_find_dependency.function_name
-.
-. define my.indent = ""
-.
-
-. if defined(my.dependency.option)
-. my.indent = " "
-if ( $(get_option(my.dependency, my.target, my.repository)) )
-. endif
-.
-. define my.has_components = (count(my.dependency.component) > 0)
-. define my.eol = my.has_components ?? "" ? " )"
-. define my.version = defined(my.dependency.version) ?? " $(my.dependency.version)" ? ""
-. define my.name = package_name(my.dependency)
-.
-$(my.indent)$(my.function_name)( $(my.name)$(my.version) REQUIRED$(my.eol)
-.
-. if (my.has_components)
- $(my.indent)COMPONENTS
-. for my.dependency.component as _component
- $(my.indent)$(_component.name)
-. endfor
-$(my.indent))
-. endif
-.
-. if defined(my.dependency.option)
-endif()
-. endif
-.
-.endmacro # emit_find_dependency
-.
-.endtemplate
diff --git a/lib/cmd-output.gsl b/lib/cmd-output.gsl
new file mode 100644
index 00000000..d2710174
--- /dev/null
+++ b/lib/cmd-output.gsl
@@ -0,0 +1,138 @@
+.template 0
+###############################################################################
+# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
+#
+# GSL libbitcoin windows shell utilities in the 'global' scope.
+#
+# This is a code generator built using the iMatix GSL code generation
+# language. See https://github.com/imatix/gsl for details.
+###############################################################################
+
+###############################################################################
+# Functions
+###############################################################################
+function global.path(input)
+ return string.replace(path.input, "/|\\")
+endfunction
+
+.endtemplate
+.template 1
+.
+.##############################################################################
+.# Macros
+.##############################################################################
+.
+.macro global.copyleft(name)
+REM ###########################################################################
+REM # Copyright (c) 2014-2026 $(my.name) developers (see COPYING).
+REM #
+REM # GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY
+REM #
+REM ###########################################################################
+.endmacro
+.
+.macro global.initialize_echo_local()
+@echo off
+setlocal EnableDelayedExpansion
+setlocal EnableExtensions
+.endmacro
+.
+.macro global.initialize_path()
+
+:: Do everything relative to this file location.
+push /d "%~dp0"
+.endmacro
+.
+.macro global.define_directory_functions()
+
+:create_directory
+ set "CD_DIRECTORY=%~1"
+ set "CD_MODE=%~2"
+
+ if exist "!CD_DIRECTORY!" (
+ if "!CD_MODE!" == "-f" (
+ call :msg_warn "Reinitializing '%CD_DIRECTORY%'..."
+ rmdir /S /Q "!CD_DIRECTORY!"
+ if %ERRORLEVEL% neq 0 (
+ exit /b %ERRORLEVEL%
+ )
+
+ mkdir "!CD_DIRECTORY!"
+ ) else (
+ call :msg_warn "Reusing existing '!CD_DIRECTORY!'..."
+ )
+ ) else (
+ call :msg "Initializing '!CD_DIRECTORY!'..."
+ )
+ exit /b %ERRORLEVEL%
+
+:create_directory_force
+ call :create_directory "%~1" -f
+ exit /b %ERRORLEVEL%
+
+:pop_directory
+ call :msg_verbose "*** move pre: '!CD!'"
+ popd
+ if %ERRORLEVEL% neq 0 (
+ exit /b %ERRORLEVEL%
+ )
+ call :msg_verbose "*** move post: '!CD!'"
+ exit /b %ERRORLEVEL%
+
+:push_directory
+ call :msg_verbose "*** move pre: '!CD!'"
+ pushd %1
+ if %ERRORLEVEL% neq 0 (
+ exit /b %ERRORLEVEL%
+ )
+ call :msg_verbose "*** move post: '!CD!'"
+ exit /b %ERRORLEVEL%
+
+:remove_directory_force
+ call :msg_verbose "*** removing: '%~1'"
+ rmdir /S /Q "%~1"
+ exit /b %ERRORLEVEL%
+.
+.endmacro
+.
+.macro global.define_display_functions()
+
+:msg_heading
+ call :msg "***************************************************************************"
+ call :msg "%~1"
+ call :msg "***************************************************************************"
+ exit /b %ERRORLEVEL%
+
+:msg
+ if "%~1" == "" (
+ echo.
+ ) else (
+ echo %~1
+ )
+ exit /b %ERRORLEVEL%
+
+:msg_empty
+ echo.
+ exit /b %ERRORLEVEL%
+
+:msg_verbose
+ if "!DISPLAY_VERBOSE!" == "yes" (
+ echo [96m%~1[0m
+ )
+ exit /b %ERRORLEVEL%
+
+:msg_success
+ echo [92m%~1[0m
+ exit /b %ERRORLEVEL%
+
+:msg_warn
+ echo [93m%~1[0m
+ exit /b %ERRORLEVEL%
+
+:msg_error
+ echo [91m%~1[0m
+ exit /b %ERRORLEVEL%
+.
+.endmacro
+.
+.endtemplate
diff --git a/lib/cmd.gsl b/lib/cmd.gsl
deleted file mode 100644
index 2242b9f6..00000000
--- a/lib/cmd.gsl
+++ /dev/null
@@ -1,45 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL libbitcoin windows shell utilities in the 'global' scope.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-
-###############################################################################
-# Functions
-###############################################################################
-function global.path(input)
- return string.replace(path.input, "/|\\")
-endfunction
-
-.endtemplate
-.template 1
-.
-.##############################################################################
-.# Macros
-.##############################################################################
-.
-.macro global.copyleft(name)
-REM ###########################################################################
-REM # Copyright (c) 2014-2026 $(my.name) developers (see COPYING).
-REM #
-REM # GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY
-REM #
-REM ###########################################################################
-.endmacro
-.
-.macro global.initialize_echo_local()
-@echo off
-setlocal EnableDelayedExpansion
-.endmacro
-.
-.macro global.initialize_path()
-:: Do everything relative to this file location.
-cd /d "%~dp0"
-.endmacro
-.
-.endtemplate
-
diff --git a/lib/sh-output.gsl b/lib/sh-output.gsl
new file mode 100644
index 00000000..7d3c7da8
--- /dev/null
+++ b/lib/sh-output.gsl
@@ -0,0 +1,163 @@
+.template 0
+###############################################################################
+# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
+#
+# GSL libbitcoin shell utilities in the 'global' scope.
+#
+# This is a code generator built using the iMatix GSL code generation
+# language. See https://github.com/imatix/gsl for details.
+###############################################################################
+
+###############################################################################
+# Functions
+###############################################################################
+
+function global.shebang(interpreter)
+ write_line("#!/bin/$(my.interpreter)")
+endfunction
+
+.endtemplate
+.template 1
+.
+.##############################################################################
+.# Macros
+.##############################################################################
+.
+.macro global.copyleft(name)
+###############################################################################
+# Copyright (c) 2014-2026 $(my.name) developers (see COPYING).
+#
+# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY
+#
+###############################################################################
+.endmacro
+.
+.macro global.heading1(text)
+
+# $(my.text)
+#==============================================================================
+.endmacro
+.
+.macro global.heading2(text)
+
+# $(my.text)
+#------------------------------------------------------------------------------
+.endmacro
+.
+.macro global.heading3(text)
+# $(my.text)
+.endmacro
+.
+.macro global.define_display_functions()
+
+COLOR_CYAN='\\e[0;96m'
+COLOR_GREEN='\\e[0;92m'
+COLOR_RED='\\e[0;91m'
+COLOR_YELLOW='\\e[0;93m'
+COLOR_RESET='\\e[0m'
+
+msg_heading()
+{
+ printf "\\n********************** %b **********************\\n" "$@"
+}
+
+msg_verbose()
+{
+ if [[ "${DISPLAY_VERBOSE}" == "yes" ]]; then
+ printf "${COLOR_CYAN}%b${COLOR_RESET}\\n" "$@"
+ fi
+}
+
+msg()
+{
+ printf "%b\\n" "$@"
+}
+
+msg_success()
+{
+ printf "${COLOR_GREEN}%b${COLOR_RESET}\\n" "$@"
+}
+
+msg_warn()
+{
+ printf "${COLOR_YELLOW}%b${COLOR_RESET}\\n" "$@"
+}
+
+msg_error()
+{
+ >&2 printf "${COLOR_RED}%b${COLOR_RESET}\\n" "$@"
+}
+.endmacro
+.
+.macro global.define_directory_functions()
+
+create_directory()
+{
+ local DIRECTORY="$1"
+ local MODE="$2"
+
+ if [[ -d "${DIRECTORY}" ]]; then
+ if [[ ${MODE} == "-f" ]]; then
+ msg_warn "Reinitializing '${DIRECTORY}'..."
+ rm -rf "${DIRECTORY}"
+ mkdir -p "${DIRECTORY}"
+ else
+ msg_warn "Reusing existing '${DIRECTORY}'..."
+ fi
+ else
+ msg "Initializing '${DIRECTORY}'..."
+ mkdir -p "${DIRECTORY}"
+ fi
+}
+
+create_directory_force()
+{
+ create_directory "$@" -f
+}
+
+pop_directory()
+{
+ msg_verbose "*** move pre: '\$(pwd)'"
+ popd >/dev/null
+ msg_verbose "*** move post: '\$(pwd)'"
+}
+
+push_directory()
+{
+ msg_verbose "*** move pre: '\$(pwd)'"
+ local DIRECTORY="$1"
+ pushd "${DIRECTORY}" >/dev/null
+ msg_verbose "*** move post: '\$(pwd)'"
+}
+
+remove_directory_force()
+{
+ msg_verbose "*** removing: '$@'"
+ rm -rf "$@"
+}
+.endmacro
+.
+.macro global.initialize_environment()
+
+OPTS_ENABLE="set -eo pipefail"
+OPTS_DISABLE="set +e"
+
+eval "${OPTS_ENABLE}"
+trap 'echo "FATAL ERROR: Command failed at line ${LINENO}: ${BASH_COMMAND}" >&2' ERR
+.endmacro
+.
+.macro global.define_error_functions()
+
+enable_exit_on_error()
+{
+ eval "${OPTS_ENABLE}"
+}
+
+disable_exit_on_error()
+{
+ eval "${OPTS_DISABLE}"
+}
+.endmacro
+.
+.endtemplate
+
diff --git a/lib/xml.gsl b/lib/xml.gsl
new file mode 100644
index 00000000..09663700
--- /dev/null
+++ b/lib/xml.gsl
@@ -0,0 +1,271 @@
+.template 0
+###############################################################################
+# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
+#
+# GSL libbitcoin xml utilities in the 'global' scope.
+#
+# This is a code generator built using the iMatix GSL code generation
+# language. See https://github.com/imatix/gsl for details.
+###############################################################################
+
+###############################################################################
+# Functions
+###############################################################################
+function global.is_defined_value(node, attribute, value)
+ define my.node = is_defined_value.node
+ define my.value = is_defined_value.value
+ if (!defined(my.node))
+ abort "Missing context node for attribute '$(my.attribute)'."
+ endif
+ return defined(my.node.$(my.attribute)) &\
+ (my.node.$(my.attribute) = my.value)
+endfunction
+
+function global.is_defined_negative(node, attribute)
+ define my.node = is_defined_negative.node
+ if (!defined(my.node))
+ abort "Missing context node for attribute '$(my.attribute)'."
+ endif
+ return defined(my.node.$(my.attribute)) &\
+ ((my.node.$(my.attribute) = "false") | (my.node.$(my.attribute) = "no"))
+endfunction
+
+function global.is_defined_positive(node, attribute)
+ define my.node = is_defined_positive.node
+ if (!defined(my.node))
+ abort "Missing context node for attribute '$(my.attribute)'."
+ endif
+ return defined(my.node.$(my.attribute)) &\
+ ((my.node.$(my.attribute) = "true") | (my.node.$(my.attribute) = "yes"))
+endfunction
+
+function global.merge_children_select(destination, source, name, identifier)
+ define my.destination = merge_children_select.destination
+ define my.source = merge_children_select.source
+ define my.name = merge_children_select.name
+ define my.identifier = merge_children_select.identifier
+
+ for my.source.$(my.name) as _child
+ if (count(my.destination->$(my.name), $(my.name).$(identifier) = _child.$(identifier)) = 0)
+ copy _child to my.destination
+ endif
+ endfor
+endfunction
+
+function global.canonicalize(result, host, canonical, name, identifier)
+ define my.result = canonicalize.result
+ define my.host = canonicalize.host
+ define my.canonical = canonicalize.canonical
+ define my.name = canonicalize.name
+ define my.identifier = canonicalize.identifier
+
+ for my.host.$(my.name) as _element
+ if (!defined(_element.$(my.identifier)))
+ copy _element to my.result
+ elsif (count(my.result.$(my.name), defined(this.$(my.identifier)) & (this.$(my.identifier) = _element.$(my.identifier)), this) = 0)
+ if (count(my.canonical.$(my.name), .$(my.identifier) = _element.$(my.identifier)) > 0)
+ copy my.canonical->$(my.name)(.$(my.identifier) = _element.$(my.identifier)) to my.result
+ else
+ copy _element to my.result
+ endif
+ endif
+ endfor
+endfunction
+
+function global.merge_components(dependencies, element)
+ define my.dependencies = merge_components.dependencies
+ define my.element = merge_components.element
+
+ if (count(my.dependencies.dependency, dependency.name = my.element.name) > 0)
+ define my.destination = my.dependencies->dependency(dependency.name = my.element.name)
+
+ merge_children_select(my.destination, my.element, "component", "name")
+ else
+ copy my.element to my.dependencies
+ endif
+endfunction
+
+function global.count_matches_name(container, childname, namevalue)
+ define my.container = count_matches_name.container
+ define my.child = count_matches_name.childname
+ define my.namevalue = count_matches_name.namevalue
+ define my.n = 0
+
+ for my.container.$(my.childname) as child
+ if (child.name = my.namevalue)
+ my.n = my.n + 1
+ endif
+ endfor
+ return my.n
+endfunction
+
+###############################################################################
+# Specific pattern xml functions
+###############################################################################
+function global.registry(registrar, query, name)
+ define my.registrar = registry.registrar
+ define my.query = registry.query
+ define my.name = registry.name
+
+ if !defined(my.query.name)
+ abort "Malformed query: $(my.query)"
+ endif
+
+ # using function to manually count as count function is returning
+ # child count of matching element
+ if !(count_matches_name(my.registrar, my.name, my.query.name) = 1)
+ abort "Registrar lacks single entry for '$(my.query.name)'."
+ endif
+
+ return my.registrar->$(my.name)($(my.name).name = my.query.name)
+endfunction
+
+### ASSUMES configuration root object in xml
+function global.package_name(query, host)
+ define my.query = package_name.query
+ define my.host = package_name.host
+ define my.registry = registry(my.host->registrar(id = "dependency"), my.query, "dependency")
+
+ if !defined(my.registry)
+ abort "Missing registry for '$(my.query)'."
+ endif
+
+ if !defined(my.registry->cmake) | !defined(my.registry->cmake.package)
+ abort "Missing registry details for '$(my.query)'."
+ endif
+
+ return my.registry->cmake.package
+endfunction
+
+function global.find_option_declaration(name, target, repository)
+ define my.name = find_option_declaration.name
+ define my.target = find_option_declaration.target
+ define my.repository = find_option_declaration.repository
+
+ if (count(my.target.option, .name = my.name) > 0)
+ define my.target_option = my.target->option(option.name = my.name)
+
+ if defined(my.target_option)
+ return my.target_option
+ endif
+ endif
+
+ for my.target.dependency as _depend
+ if (count(my.repository.library, library.name = _depend.name) > 0)
+ if defined(my.repository->library(library.name = _depend.name)->option(option.name = my.name))
+ return my.repository->library(name = _depend.name)->option(name = my.name)
+ endif
+ else
+ for configuration.repository as _repo
+ if (count(_repo.library, library.name = _depend.name) > 0)
+ if defined(_repo->library(name = _depend.name)->option(name = my.name))
+ return _repo->library(name = _depend.naem)->option(name = my.name)
+ endif
+ endif
+ endfor
+ endif
+ endfor
+
+ abort "Missing option matching name '$(my.name)'."
+endfunction
+
+function global.get_option(reference, target, repository)
+ define my.reference = get_option.reference
+ define my.target = get_option.target
+ define my.repository = get_option.repository
+ define my.result = ""
+
+ if (defined(my.reference.option))
+ define my.option = find_option_declaration(my.reference.option, my.target, my.repository)
+
+ if (!defined(my.option))
+ abort "Target '$(my.target.name)' missing option '$(my.reference.option)'."
+ endif
+
+ my.result = "$(my.option.type:lower)-$(my.option.name:lower)"
+ endif
+
+ return my.result
+endfunction
+
+function canonical_dependency_list(result, repository, configuration)
+ define my.result = canonical_dependency_list.result
+ define my.repository = canonical_dependency_list.repository
+ define my.configuration = canonical_dependency_list.configuration
+
+ for my.repository.library as _target
+ # for simplicity, assuming only libraries traversed recursively
+ for _target.dependency as _dep
+ if (count_matches_name(my.configuration, "repository", _dep.name) > 0)
+ define my.dep_rep = my.configuration->repository(name = _dep.name)
+ canonical_dependency_list(my.result, my.dep_rep, my.configuration)
+ endif
+ endfor
+
+ canonicalize(my.result, _target, my.configuration->registrar(id = "dependency"), "dependency", "name")
+ endfor
+ for my.repository.test as _target
+ canonicalize(my.result, _target, my.configuration->registrar(id = "dependency"), "dependency", "name")
+ endfor
+ for my.repository.binary as _target
+ canonicalize(my.result, _target, my.configuration->registrar(id = "dependency"), "dependency", "name")
+ endfor
+endfunction
+
+function calculate_presets(result, configuration, repository)
+ define my.result = calculate_presets.result
+ define my.configuration = calculate_presets.configuration
+ define my.repository = calculate_presets.repository
+
+ # targets
+ for my.repository.library as _library
+ new target as _target
+ _target.value = "$(_library.name)"
+ copy _target to my.result
+ endnew
+ endfor
+ for my.repository.test as _test
+ new target as _target
+ _target.value = "$(_test.name)"
+ copy _target to my.result
+ endnew
+ endfor
+ for my.repository.binary as _binary
+ new target as _target
+ _target.value = "$(_binary.name)"
+ copy _target to my.result
+ endnew
+ endfor
+
+ # configurations
+ define my.registrar = my.configuration->registrar(id = "presets")?
+
+ # shortcut - currently all presets are same, use registry
+ for my.registrar.configuration as _config
+ copy _config to my.result
+ endfor
+
+# if !defined(my.repository->presets)
+# return
+# endif
+#
+# for my.repository->presets.configuration as _config
+# define my.entry = registry(my.registrar, _config, "configuration")?
+#
+# if defined(my.entry)
+# copy my.entry to my.result
+# else
+# abort "Preset $(_config.name) absent from registry."
+# endif
+# endfor
+endfunction
+
+.endtemplate
+.template 1
+.
+.##############################################################################
+.# Macros
+.##############################################################################
+.
+.endtemplate
+
diff --git a/library/string.gsl b/library/string.gsl
index b2c38908..0c3ae992 100644
--- a/library/string.gsl
+++ b/library/string.gsl
@@ -24,6 +24,7 @@
# trim_left(text)
# trim_right(text)
# trim_both(text)
+# pad(text, length, symbol)
#------------------------------------------------------------------------------
# Return the remainder of the text after discarding the base_length.
@@ -114,5 +115,13 @@ function global.trim_both(text)
return trim_left(string.trim(my.text))
endfunction
+function global.pad(text, length, symbol)
+ define my.result = my.text
+ while string.length(my.result) < my.length
+ my.result = "$(my.result)$(my.symbol)"
+ endwhile
+ return my.result
+endfunction
+
###############################################################################
-.endtemplate
\ No newline at end of file
+.endtemplate
diff --git a/process/copy_projects.cmd.gsl b/process/copy_projects.cmd.gsl
index e11ca731..c6ac60cc 100644
--- a/process/copy_projects.cmd.gsl
+++ b/process/copy_projects.cmd.gsl
@@ -17,58 +17,60 @@
. output(out_file)
. initialize_echo_local()
. copyleft("libbitcoin-build")
-
. initialize_path()
:: Assign arguments
-set "source_dir=$(path(configuration->templates.resultpath))"
-set "dest_dir=..\\.."
+set "SOURCE_DIR=$(path(configuration->templates.resultpath))"
+set "DEST_DIR=..\\.."
:: Check if source directory exists
-if not exist "%source_dir%\" (
- echo Error: Source directory '%source_dir%' does not exist.
+if not exist "%SOURCE_DIR%\" (
+ call :msg_error "Error: Source directory '%SOURCE_DIR%' does not exist."
exit /b 1
)
:: Check if destination directory exists
-if not exist "%dest_dir%\" (
- echo Error: Destination directory '%dest_dir%' does not exist.
+if not exist "%DEST_DIR%\" (
+ call :msg_error "Error: Destination directory '%DEST_DIR%' does not exist."
exit /b 1
)
:: If no substring arguments are provided, copy all subdriectories
-set copied=0
+set COPIED=0
if "%~1"=="" (
- echo No substrings specified. Copying all 'libbitcoin' subdirectories from '%source_dir%' to '%dest_dir'...
+ call :msg_warn "No substrings specified. Copying all 'libbitcoin' subdirectories from '%SOURCE_DIR%' to '%DEST_DIR%'..."
- for /d %%i in ("%source_dir%\\libbitcoin*") do (
- echo Copying '%%~nxi' to '%dest_dir%'...
- xcopy "%%i" "%dest_dir%\\%%~nxi\\" /E /I /Y
- set /a copied+=1
+ for /d %%i in ("%SOURCE_DIR%\\libbitcoin*") do (
+ call :msg "Copying '%%~nxi' to '%DEST_DIR%'..."
+ xcopy "%%i" "%DEST_DIR%\\%%~nxi\\" /E /I /Y
+ set /a COPIED+=1
)
) else (
:: Copy subdirectories whose names contain any of the provided substrings
- for /d %%i in ("%source_dir%\\*") do (
+ for /d %%i in ("%SOURCE_DIR%\\*") do (
for %%j in (%*) do (
echo.%%~nxi | find /i "%%j" >nul
- if !errorlevel! equ 0 (
- echo Copying '%%~nxi' to '%dest_dir%'...
- xcopy "%%i" "%dest_dir%\\%%~nxi\" /E /I /Y
- set /a copied+=1
+ if %ERRORLEVEL% equ 0 (
+ call :msg "Copying '%%~nxi' to '%DEST_DIR%'..."
+ xcopy "%%i" "%DEST_DIR%\\%%~nxi\" /E /I /Y
+ set /a COPIED+=1
)
)
)
- if !copied! equ 0 (
- echo Warning: No subdriectories found in '%source_dir%' matching any provided substrings.
+ if !COPIED! equ 0 (
+ call :msg_warn "Warning: No subdriectories found in '%SOURCE_DIR%' matching any provided substrings."
) else (
- echo Copied !copied! repositories.
+ call :msg_success "Copied !copied! repositories."
)
)
popd
+call :msg_success "Copy operation completed successfully."
+exit /b 0
+
-echo Copy operation completed.
-endlocal
+. define_display_functions()
+.
.endmacro generate_copy_script
.endtemplate
.template 0
@@ -81,7 +83,7 @@ endlocal
# Note: expected context root libbitcoin-build directory
gsl from "lib/output.gsl"
-gsl from "lib/cmd.gsl"
+gsl from "lib/cmd-output.gsl"
gsl from "library/string.gsl"
generate_copy_script()
diff --git a/process/copy_projects.sh.gsl b/process/copy_projects.sh.gsl
index 5c9ba7e1..74b8d975 100644
--- a/process/copy_projects.sh.gsl
+++ b/process/copy_projects.sh.gsl
@@ -19,7 +19,8 @@
. copyleft("libbitcoin-build")
# Exit this script on the first build error.
-set -e
+set -euo pipefail
+trap 'echo "FATAL ERROR: Command failed at line $LINENO: $BASH_COMMAND" >&2' ERR
source_dir="$(configuration->templates.resultpath)"
dest_dir="../.."
@@ -77,7 +78,7 @@ echo "Copy operation completed."
# Note: expected context root libbitcoin-build directory
gsl from "lib/output.gsl"
-gsl from "lib/sh.gsl"
+gsl from "lib/sh-output.gsl"
gsl from "library/string.gsl"
generate_copy_script()
diff --git a/process/copy_statics.cmd.gsl b/process/copy_statics.cmd.gsl
index 9ade7659..8c2d6a87 100644
--- a/process/copy_statics.cmd.gsl
+++ b/process/copy_statics.cmd.gsl
@@ -17,13 +17,12 @@
. output(out_file)
. initialize_echo_local()
. copyleft("libbitcoin-build")
-
. initialize_path()
-set "result_dir=$(path(configuration->templates.resultpath))"
+set "RESULT_DIR=$(path(configuration->templates.resultpath))"
-if not exist "%result_dir%" (
- echo Error: result directory '%result_dir%' does not exist.
+if not exist "%RESULT_DIR%" (
+ call :msg_error "Error: result directory '%RESULT_DIR%' does not exist."
exit /b 1
)
@@ -33,52 +32,57 @@ if not exist "%result_dir%" (
. for configuration->templates.template as _template
. for _template.file as _file
. index = index + 1
-set "source[$(index)]=$(path_suffix)$(path(_file.source))"
-set "destination[$(index)]=%result_dir%\\$(_repository.name)\\$(path(_file.destination))"
+set "SOURCE[$(index)]=$(path_suffix)$(path(_file.SOURCE))"
+set "DESTINATION[$(index)]=%RESULT_DIR%\\$(_repository.name)\\$(path(_file.DESTINATION))"
. endfor
. endfor
. endfor
-set "length=$(index)"
+set "LENGTH=$(index)"
-for /L %%i in (1,1,%length%) do (
- if "!destination[%%i]!"=="" (
- echo Error: No destination directory specified.
+for /L %%i in (1,1,%LENGTH%) do (
+ if "!DESTINATION[%%i]!"=="" (
+ call :msg_error "Error: No DESTINATION directory specified."
exit /b 1
)
- if "!source[%%i]!"=="" (
- echo Error: No source specified.
+ if "!SOURCE[%%i]!"=="" (
+ call :msg_error "Error: No SOURCE specified."
exit /b 1
)
- :: Check if source exists
- if not exist !source[%%i]! (
- echo Error: Source file not found '"!source[%%i]!"'.
+ :: Check if SOURCE exists
+ if not exist !SOURCE[%%i]! (
+ call :msg_error "Error: SOURCE file not found '!SOURCE[%%i]!'."
exit /b 1
)
- :: Create destination if it does not exist
- if not exist "!destination[%%i]!" (
- echo Creating directory '!destination[%%i]!'.
- mkdir "!destination[%%i]!" 2>nul
- if errorlevel 1 (
- echo Error: Failed to create directory '!destination[%%i]!'.
+ :: Create DESTINATION if it does not exist
+ if not exist "!DESTINATION[%%i]!" (
+ call :msg "Creating directory '!DESTINATION[%%i]!'."
+ mkdir "!DESTINATION[%%i]!" 2>nul
+ if %ERRORLEVEL% neq 0 (
+ call :msg_error "Error: Failed to create directory '!DESTINATION[%%i]!'."
exit /b 1
)
)
:: Perform the copy
- echo Copying "!source[%%i]!" to "!destination[%%i]!"
- copy /Y "!source[%%i]!" "!destination[%%i]!" >nul
+ call :msg "Copying '!SOURCE[%%i]!' to '!DESTINATION[%%i]!'"
+ copy /Y "!SOURCE[%%i]!" "!DESTINATION[%%i]!" >nul
if errorlevel 1 (
- echo Error: copy of '!source[%%i]!' failed.
+ call :msg_error "Error: copy of '!SOURCE[%%i]!' failed."
exit /b 1
)
)
popd
+call :msg_success "Copy operation completed successfully."
+exit /b 0
+
+
.
+. define_display_functions()
.endmacro # generate_copy_script
.
.endtemplate
@@ -92,7 +96,7 @@ popd
# Note: expected context root libbitcoin-build directory
gsl from "lib/output.gsl"
-gsl from "lib/cmd.gsl"
+gsl from "lib/cmd-output.gsl"
gsl from "library/string.gsl"
generate_copy_script()
diff --git a/process/copy_statics.sh.gsl b/process/copy_statics.sh.gsl
index fd146419..8d476fe1 100644
--- a/process/copy_statics.sh.gsl
+++ b/process/copy_statics.sh.gsl
@@ -20,7 +20,8 @@
.
. define path_suffix = "../"
# Exit this script on the first build error.
-set -e
+set -euo pipefail
+trap 'echo "FATAL ERROR: Commnd failed at line $LINENO: $BASH_COMMAND" >&2' ERR
result_dir="$(configuration->templates.resultpath)"
@@ -58,7 +59,7 @@ cp $(path_suffix)$(_file.source) ${result_dir}/$(_repository.name)/$(_file.desti
# Note: expected context root libbitcoin-build directory
gsl from "lib/output.gsl"
-gsl from "lib/sh.gsl"
+gsl from "lib/sh-output.gsl"
gsl from "library/string.gsl"
generate_copy_script()
diff --git a/process/generate_artifacts.cmd.gsl b/process/generate_artifacts.cmd.gsl
index 1ef83b3b..08eda134 100644
--- a/process/generate_artifacts.cmd.gsl
+++ b/process/generate_artifacts.cmd.gsl
@@ -17,39 +17,45 @@
. output(out_file)
. initialize_echo_local()
. copyleft("libbitcoin-build")
-
. initialize_path()
+set "GSL_EXE=gsl -q"
+
:: Cleanup output directory
-set "output_path=$(path(configuration->templates.resultpath))"
-if exist "%output_path%" (
- rmdir /s /q "%output_path%"
- if %errorlevel% neq 0 (
- echo Failure to remove path '%output_path%'
- exit /b %errorlevel%
+set "OUTPUT_PATH=$(path(configuration->templates.resultpath))"
+if exist "%OUTPUT_PATH%" (
+ call :msg_warn "Removing output path '%OUTPUT_PATH%'."
+ rmdir /s /q "%OUTPUT_PATH%"
+ if %ERRORLEVEL% neq 0 (
+ call :msg_error "Failure to remove output path '%OUTPUT_PATH%'"
+ exit /b %ERRORLEVEL%
) else (
- echo Removed path '%output_path%'
+ call :msg_success "Removed path '%OUTPUT_PATH%'"
)
)
. define index = 0
. for configuration->templates.template as _template
. index = index + 1
-set "templates[$(index)]=..\\templates\\$(path(_template.path))\\$(_template.name)"
+set "TEMPLATES[$(index)]=..\\templates\\$(path(_template.path))\\$(_template.name)"
. endfor
-set "templates.length=$(count(configuration->templates.template))"
-set "configuration=..\\$(path(configuration->templates.source))"
+set "TEMPLATES.length=$(count(configuration->templates.template))"
+set "CONFIGURATION=..\\$(path(configuration->templates.source))"
-for /L %%i in (1,1,%templates.length%) do (
- echo gsl -q -script:"!templates[%%i]!" "%configuration%"
- gsl -q -script:"!templates[%%i]!" "%configuration%"
- if %errorlevel% neq 0 (
- echo Failure: "!templates[%%i]!" produced error.
- exit /b %errorlevel%
+for /L %%i in (1,1,%TEMPLATES.length%) do (
+ call :msg "!GSL_EXE! -script:'!TEMPLATES[%%i]!' '%CONFIGURATION%'"
+ !GSL_EXE! -script:"!TEMPLATES[%%i]!" "%CONFIGURATION%"
+ if %ERRORLEVEL% neq 0 (
+ call :msg_error "Failure: '!TEMPLATES[%%i]!' produced error."
+ exit /b %ERRORLEVEL%
)
)
+call :msg_success "Artifact generation completed successfully."
exit /b 0
+
+
+. define_display_functions()
.
.endmacro # generate_artifacts
.endtemplate
@@ -63,7 +69,7 @@ exit /b 0
# Note: expected context root libbitcoin-build directory
gsl from "lib/output.gsl"
-gsl from "lib/cmd.gsl"
+gsl from "lib/cmd-output.gsl"
gsl from "library/string.gsl"
generate_artifacts()
diff --git a/process/generate_artifacts.sh.gsl b/process/generate_artifacts.sh.gsl
index 31b2d39a..757b040d 100644
--- a/process/generate_artifacts.sh.gsl
+++ b/process/generate_artifacts.sh.gsl
@@ -19,11 +19,16 @@
. copyleft("libbitcoin-build")
# Exit this script on the first build error.
-set -e
+set -euo pipefail
+trap 'msg_error "FATAL ERROR: Command failed at line $LINENO: $BASH_COMMAND" >&2' ERR
+
+GSL="gsl -q"
# Do everything relative to this file location.
cd `dirname "$0"`
+. define_display_functions()
+
# Cleanup output directory
rm -rf "$(configuration->templates.resultpath)"
@@ -36,13 +41,31 @@ declare -a generator=( \\
# Generate build artifacts.
for generate in "\${generator[@]}"
do
- echo "gsl -q -script:\$generate ../$(configuration->templates.source)"
- gsl -q -script:\$generate ../$(configuration->templates.source)
+ msg_warn "${GSL} -script:\$generate ../$(configuration->templates.source)"
+ ${GSL} -script:\$generate ../$(configuration->templates.source)
done
.if (count(configuration->templates.template, ends_with(count.name, ".sh.gsl")) > 0)
# Make generated scripts executable.
-eval chmod -R +x "$(configuration->templates.resultpath)/*/*.sh"
+modcount=0
+failcount=0
+
+while IFS= read -r -d '' file; do
+ if chmod +x "${file}"; then
+ msg "${COLOR_GREEN}✓${COLOR_RESET} ${file}"
+ ((modcount += 1))
+ else
+ msg "${COLOR_RED}✗${COLOR_RESET} Failed: ${file}"
+ ((failcount += 1))
+ fi
+done < <(find ../output/version4 -name "*.sh" -type f -print0)
+
+if [[ ${failcount} -eq 0 ]]; then
+ msg_success "Made ${modcount} files executable."
+else
+ msg_error "Failed modifying ${failcount} files."
+ exit 1
+fi
.endif
.endmacro generate_artifacts
.endtemplate
@@ -56,7 +79,7 @@ eval chmod -R +x "$(configuration->templates.resultpath)/*/*.sh"
# Note: expected context root libbitcoin-build directory
gsl from "lib/output.gsl"
-gsl from "lib/sh.gsl"
+gsl from "lib/sh-output.gsl"
gsl from "library/string.gsl"
generate_artifacts()
diff --git a/templates/cmake/CMakeLists.txt.gsl b/templates/cmake/CMakeLists.txt.gsl
index 04178765..70e5d222 100644
--- a/templates/cmake/CMakeLists.txt.gsl
+++ b/templates/cmake/CMakeLists.txt.gsl
@@ -13,10 +13,11 @@
gsl from "../library/math.gsl"
gsl from "../library/string.gsl"
-gsl from "../lib/cmake.gsl"
+gsl from "../lib/cmake-output.gsl"
gsl from "../lib/debug.gsl"
gsl from "../lib/filesystem.gsl"
gsl from "../lib/output.gsl"
+gsl from "../lib/xml.gsl"
###############################################################################
# Generation
@@ -57,77 +58,13 @@ function generate_CMakeLists(configuration)
endfor _repository
endfunction
-###############################################################################
-# Library-able?
-###############################################################################
-function is_defined_value(node, attribute, value)
- define my.node = is_defined_value.node
- define my.value = is_defined_value.value
- if (!defined(my.node))
- abort "Missing context node for attribute '$(my.attribute)'."
- endif
- return defined(my.node.$(my.attribute)) &\
- (my.node.$(my.attribute) = my.value)
-endfunction
-
-function is_defined_negative(node, attribute)
- define my.node = is_defined_negative.node
- if (!defined(my.node))
- abort "Missing context node for attribute '$(my.attribute)'."
- endif
- return defined(my.node.$(my.attribute)) &\
- ((my.node.$(my.attribute) = "false") | (my.node.$(my.attribute) = "no"))
-endfunction
-
-function is_defined_positive(node, attribute)
- define my.node = is_defined_positive.node
- if (!defined(my.node))
- abort "Missing context node for attribute '$(my.attribute)'."
- endif
- return defined(my.node.$(my.attribute)) &\
- ((my.node.$(my.attribute) = "true") | (my.node.$(my.attribute) = "yes"))
-endfunction
-
-function merge_children_select(destination, source, name, identifier)
- define my.destination = merge_children_select.destination
- define my.source = merge_children_select.source
- define my.name = merge_children_select.name
- define my.identifier = merge_children_select.identifier
-
- for my.source.$(my.name) as _child
- if (count(my.destination->$(my.name), $(my.name).$(identifier) = _child.$(identifier)) = 0)
- copy _child to my.destination
- endif
- endfor
-endfunction
-
-function canonicalize(result, host, canonical, name, identifier)
- define my.result = canonicalize.result
- define my.host = canonicalize.host
- define my.canonical = canonicalize.canonical
- define my.name = canonicalize.name
- define my.identifier = canonicalize.identifier
-
- for my.host.$(my.name) as _element
- if (!defined(_element.$(my.identifier)))
- copy _element to my.result
- elsif (count(my.result.$(name), defined(.$(my.identifier)) & (.$(my.identifier) = _element.$(my.identifier))) = 0)
- if (count(my.canonical.$(my.name), .$(my.identifier) = _element.$(my.identifier)) > 0)
- copy my.canonical->$(my.name)(.$(my.identifier) = _element.$(my.identifier)) to my.result
- else
- copy _element to my.result
- endif
- endif
- endfor
-endfunction
-
###############################################################################
# Functions
###############################################################################
function qualified_component_name(dependency, component)
define my.dependency = qualified_component_name.dependency
define my.component = qualified_component_name.component
- define my.registry = registry(configuration->registrar(id = "dependency"), my.dependency)
+ define my.registry = registry(configuration->registrar(id = "dependency"), my.dependency, "dependency")
if !defined(my.registry)
abort("Missing registry for $(my.dependency)")
@@ -146,7 +83,7 @@ endfunction
function qualified_target_name(query)
define my.query = qualified_target_name.query
- define my.registry = registry(configuration->registrar(id = "dependency"), my.query)
+ define my.registry = registry(configuration->registrar(id = "dependency"), my.query, "dependency")
if !defined(my.registry)
abort("Missing registry for $(my.query)")
@@ -256,19 +193,6 @@ function target_installable(target)
return (name(my.target) = "library") | is_defined_positive(my.target, "install")
endfunction
-function merge_components(dependencies, element)
- define my.dependencies = merge_components.dependencies
- define my.element = merge_components.element
-
- if (count(my.dependencies.dependency, dependency.name = my.element.name) > 0)
- define my.destination = my.dependencies->dependency(dependency.name = my.element.name)
-
- merge_children_select(my.destination, my.element, "component", "name")
- else
- copy my.element to my.dependencies
- endif
-endfunction
-
function render_dependencies(repository)
define my.repository = render_dependencies.repository
@@ -300,19 +224,19 @@ function render_dependencies(repository)
define my.found = 0
for my.repository.library as _target where (my.found = 0)
if (count(_target.dependency, .name = _depend.name) > 0)
- emit_find_dependency(_depend, _target, my.repository, "find_package")
+ emit_find_dependency(_depend, _target, my.repository, configuration, "find_package")
my.found = 1
endif
endfor
for my.repository.test as _target where (my.found = 0)
if (count(_target.dependency, .name = _depend.name) > 0)
- emit_find_dependency(_depend, _target, my.repository, "find_package")
+ emit_find_dependency(_depend, _target, my.repository, configuration, "find_package")
my.found = 1
endif
endfor
for my.repository.binary as _target where (my.found = 0)
if (count(_target.dependency, .name = _depend.name) > 0)
- emit_find_dependency(_depend, _target, my.repository, "find_package")
+ emit_find_dependency(_depend, _target, my.repository, configuration, "find_package")
my.found = 1
endif
endfor
@@ -739,11 +663,11 @@ option( $(_option.type:lower)-$(_option.name:lower) "$(_option.comment)" $(optio
if ( BUILD_SHARED_LIBS )
. for my.dependencies.dependency as _depend
- set( $(package_name(_depend))_USE_STATIC_LIBS "OFF" )
+ set( $(package_name(_depend, configuration))_USE_STATIC_LIBS "OFF" )
. endfor
else()
. for my.dependencies.dependency as _depend
- set( $(package_name(_depend))_USE_STATIC_LIBS "ON" )
+ set( $(package_name(_depend, configuration))_USE_STATIC_LIBS "ON" )
. endfor
endif()
.endmacro # emit_shared_static_detection
@@ -943,6 +867,7 @@ $(my.indent))
.
. new compiler as _compiler
. canonicalize(_compiler, my.target->compiler, configuration->canonical->compiler, my.element, "id")
+.
. if (count(_compiler.$(my.element)) > 0)
$(my.indent)$(my.property)( $(my.target.name)
diff --git a/templates/cmake/CMakePresets.json.gsl b/templates/cmake/CMakePresets.json.gsl
new file mode 100644
index 00000000..211b249d
--- /dev/null
+++ b/templates/cmake/CMakePresets.json.gsl
@@ -0,0 +1,179 @@
+.template 0
+###############################################################################
+# Copyright (c) 2014-2025 libbitcoin developers (see COPYING).
+#
+# GSL generate libbitcoin CMakePresets.json.
+#
+# This is a code generator built using the iMatix GSL code generation
+# language. See https://github.com/imatix/gsl for details.
+###############################################################################
+
+# Note: expected context root libbitcoin-build/process directory
+[gsl].ignorecase = 0
+
+gsl from "../library/math.gsl"
+gsl from "../library/string.gsl"
+gsl from "../lib/xml.gsl"
+gsl from "../lib/debug.gsl"
+gsl from "../lib/filesystem.gsl"
+gsl from "../lib/output.gsl"
+
+###############################################################################
+# Generation
+###############################################################################
+function generate_CMakePresets(configuration)
+ define my.configuration = generate_CMakePresets.configuration
+ require(my.configuration->templates, "templates", "resultpath")
+
+ define my.template = my.configuration->templates->template(.name = "CMakePresets.json.gsl")
+
+ if (!defined(my.template))
+ abort "Generator configuration missing."
+ endif
+
+ if !(ends_with(my.template.name, ".gsl"))
+ abort "Provided template does not end with '.gsl'."
+ endif
+
+ define my.filename = left(my.template.name, string.length(my.template.name) - 4)
+
+ require(my.template, "template", "outpath")
+ define my.project_path_suffix = my.template.outpath
+
+ for my.configuration.repository by .name as _repository
+ require(_repository, "repository", "name")
+ define my.output_path = path_append(\
+ my.configuration->templates.resultpath, \
+ path_append(my.path_prefix, \
+ path_append(_repository.name, my.project_path_suffix)))
+
+ new presets as _presets
+ calculate_presets(_presets, my.configuration, _repository)
+
+ if ((count(_presets.configuration, !is_defined_positive(count, "hidden")) = 0) |\
+ (count(_presets.target) = 0))
+ next
+ endif
+
+ create_directory(my.output_path)
+ define my.out_file = path_append(my.output_path, my.filename)
+ notify(my.out_file)
+ output(my.out_file)
+ emit_CMakePresets(_presets)
+ endnew
+
+ close
+ endfor _repository
+endfunction
+
+###############################################################################
+# Library-able?
+###############################################################################
+
+###############################################################################
+# Functions
+###############################################################################
+
+###############################################################################
+# Macros
+###############################################################################
+.endtemplate
+.template 1
+.
+.macro emit_CMakePresets(presets)
+. define my.presets = emit_CMakePresets.presets
+.
+{
+ "version": 5,
+ "configurePresets": [
+. for my.presets.configuration as _config
+ {
+. emit_configuration_body(_config, " ")
+ }$(last() ?? "" ? ",")
+. endfor
+ ],
+ "buildPresets": [
+ {
+ "name": "nix-target-list",
+ "hidden": true,
+ "targets": [
+. for my.presets.target as _target
+ "$(_target.value)"$(last() ?? "" ? ",")
+. endfor
+ ]
+ },
+. for my.presets.configuration as _config where !is_defined_positive(_config, "hidden")
+ {
+ "name": "$(_config.name)",
+ "displayName": "$(_config.display)",
+ "inherits": [ "nix-target-list" ],
+ "configurePreset": "$(_config.name)"
+ }$(last() ?? "" ? ",")
+. endfor
+ ]
+}
+.
+.endmacro # emit_CMakePresets
+.
+.macro emit_configuration_body(config, indent)
+. define my.config = emit_configuration_body.config
+. define my.indent = emit_configuration_body.indent
+.
+$(my.indent)"name": "$(my.config.name)",
+. if defined(my.config.display)
+$(my.indent)"displayName": "$(my.config.display)",
+. endif
+. if defined(my.config.description)
+$(my.indent)"description": "$(my.config.description)",
+. endif
+. if defined(my.config.hidden)
+$(my.indent)"hidden": $(my.config.hidden),
+. endif
+. for my.config.property as _property
+. emit_property(_property, my.indent, !last() ?? "," ? " ", false)
+. endfor
+.endmacro # emit_configuration_body
+.
+.macro emit_property(property, indent, post, listMember)
+. define my.property = emit_property.property
+. define my.indent = emit_property.indent
+. define my.postfix = emit_property.post
+.
+. if (defined(my.property.type))
+. require(my.property, "property", "name")
+. my.isObject = (my.property.type = "object")
+. my.isList = (my.property.type = "list")
+. if (my.isObject | my.isList)
+$(my.indent)"$(my.property.name)": $(my.isObject ?? "{" ? "[")
+. for my.property.property as _property
+. emit_property(_property, " $(my.indent)", last() ?? "" ? ",", my.isList)
+. endfor
+$(my.indent)$(my.isObject ?? "}" ? "]")$(my.postfix)
+. else
+$(my.indent)"$(my.property.name)": {
+ $(my.indent)"type": "$(my.property.type)",
+ $(my.indent)"value": "$(my.property.value)"
+$(my.indent)}$(my.postfix)
+. endif
+. elsif (defined(my.property.value))
+. if (defined(my.property.name))
+$(my.indent)"$(my.property.name)": "$(my.property.value)"$(my.postfix)
+. elsif (emit_property.listMember)
+$(my.indent)"$(my.property.value)"$(my.postfix)
+. else
+. abort("Non-list-member property lacks name.")
+. endif
+. else
+. abort("Unrecognized type-less, value-less property.")
+. endif
+.endmacro #emit_property
+.
+.endtemplate
+.template 0
+###############################################################################
+# Execution
+###############################################################################
+
+generate_CMakePresets(configuration)
+
+.endtemplate
diff --git a/templates/cmake/config.cmake.in.gsl b/templates/cmake/config.cmake.in.gsl
index 94d0c0d4..b5d9d9b1 100644
--- a/templates/cmake/config.cmake.in.gsl
+++ b/templates/cmake/config.cmake.in.gsl
@@ -13,7 +13,8 @@
gsl from "../library/math.gsl"
gsl from "../library/string.gsl"
-gsl from "../lib/cmake.gsl"
+gsl from "../lib/xml.gsl"
+gsl from "../lib/cmake-output.gsl"
gsl from "../lib/debug.gsl"
gsl from "../lib/filesystem.gsl"
gsl from "../lib/output.gsl"
@@ -88,7 +89,7 @@ include( "${CMAKE_CURRENT_LIST_DIR}/$(my.target.name)-targets.cmake" )
set( $(get_option(_dependency, my.target, my.repository)) @$(get_option(_dependency, my.target, my.repository))@ )
. endif
.
-. emit_find_dependency(_dependency, my.target, my.repository, "find_dependency")
+. emit_find_dependency(_dependency, my.target, my.repository, configuration, "find_dependency")
. endfor
check_required_components(@PROJECT_NAME@)
diff --git a/templates/gsl.CMakeLists.txt b/templates/gsl.CMakeLists.txt
deleted file mode 100644
index 43aa28f8..00000000
--- a/templates/gsl.CMakeLists.txt
+++ /dev/null
@@ -1,1666 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate libbitcoin CMakeLists.txt.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Functions
-###############################################################################
-
-###
-### string generators
-###
-function project_relative_build_path()
- return "builds/cmake"
-endfunction
-
-function compiler_id(name)
- if (my.name = "clang")
- return "Clang"
- elsif (my.name = "gcc")
- return "GNU"
- else
- abort("Unsupported compiler: $(my.name)")
- endif
-endfunction
-
-function boost_component(name)
- if (starts_with(my.name, "boost_"))
- define length = (string.length(my.name) - 6)
- return right(my.name, length)
- endif
-endfunction
-
-function get_cmake_system_from_name(name, sentinel)
- define my.result = my.sentinel
-
- if (defined(my.name))
- if (my.name = "android")
- my.result = "ANDROID"
- elsif (my.name = "linux")
- my.result = "(${CMAKE_SYSTEM_NAME} MATCHES \"Linux\")"
- elsif (my.name = "osx")
- my.result = "(${CMAKE_SYSTEM_NAME} MATCHES \"Darwin\")"
- elsif (my.name = "windows")
- # NOTE: using compiler in place of system identifier
- my.result = "MSVC"
- endif
- endif
-
- return my.result
-endfunction
-
-function get_case_platform_include(dependency, sentinel)
- define my.dependency = get_case_platform_include.dependency
- define my.system_name = get_cmake_system_from_name(\
- my.dependency.system, "")
-
- return is_empty(my.system_name)\
- ?? my.sentinel ? "$(my.system_name)"
-endfunction
-
-function get_case_platform_exclude(dependency, sentinel)
- define my.dependency = get_case_platform_exclude.dependency
- define my.system_name = get_cmake_system_from_name(\
- my.dependency.system_exclude, "")
-
- return is_empty(my.system_name)\
- ?? my.sentinel ? "NOT $(my.system_name)"
-endfunction
-
-function get_case_platform(dependency, sentinel)
- define my.dependency = get_case_platform.dependency
- define my.system_include = get_case_platform_include(my.dependency, "")
- define my.system_exclude = get_case_platform_exclude(my.dependency, "")
- define my.case = my.sentinel
-
- if (is_empty(my.system_include) & is_empty(my.system_exclude))
- my.case = my.sentinel
- elsif (is_empty(my.system_exclude))
- my.case = my.system_include
- elsif (is_empty(my.system_include))
- my.case = my.system_exclude
- else
- my.case = "$(my.system_include) AND $(my.system_exclude)"
- endif
-
- return my.case
-endfunction
-
-function is_static_suffixed(library)
- define my.library = is_static_suffixed.library
-
- return !match_name(my.library, "dl") &\
- !match_name(my.library, "pthread") &\
- !match_name(my.library, "rt")
-endfunction
-
-function get_suffix_include_dirs(library, type)
- define my.library = get_suffix_include_dirs.library
- define my.type = get_suffix_include_dirs.type
- define my.result = "INCLUDE_DIR"
-
- if ((my.type = "static") & is_static_suffixed(my.library))
- my.result = "STATIC_$(my.result)"
- endif
-
- if ((my.type = "canonical") & is_static_suffixed(my.library))
- my.result = "FOR_BUILD_$(my.result)"
- endif
-
- if (!is_boost_dependency(my.library))
- my.result = "$(my.result)S"
- endif
-
- return my.result
-endfunction
-
-function get_suffix_library_dirs(library, type)
- define my.library = get_suffix_library_dirs.library
- define my.type = get_suffix_library_dirs.type
- define my.result = "LIBRARY_DIRS"
-
- if ((my.type = "static") & is_static_suffixed(my.library))
- my.result = "STATIC_$(my.result)"
- endif
-
- if ((my.type = "canonical") & is_static_suffixed(my.library))
- my.result = "FOR_BUILD_$(my.result)"
- endif
-
- return my.result
-endfunction
-
-function get_suffix_libraries(library, type)
- define my.library = get_suffix_libraries.library
- define my.type = get_suffix_libraries.type
- define my.result = ""
-
- if ((my.type = "static") & is_static_suffixed(my.library))
- my.result = "STATIC_$(my.result)"
- endif
-
- if ((my.type = "canonical") & is_static_suffixed(my.library))
- my.result = "FOR_BUILD_$(my.result)"
- endif
-
- if (is_boost_lib_dependency(my.library))
- my.result = "$(my.result)LIBRARY"
- else
- my.result = "$(my.result)LIBRARIES"
- endif
-
- return my.result
-endfunction
-
-###
-### utilities
-###
-function get_test_list(product)
- define my.product = get_test_list.product
- define my.tests = ""
- for my.product->runner.run as _run
- my.tests = join(my.tests, _run.test, ",")
- endfor
- return my.tests
-endfunction
-
-function get_cmake_variable_prefix(named_element)
- define my.named_element = get_cmake_variable_prefix.named_element
-
- if (is_boost_dependency(my.named_element))
- return "$(my.named_element.name:neat)"
- elsif (is_boost_lib_dependency(my.named_element))
- return "Boost_$(my.named_element.name:upper)"
- else
- return my.named_element.name
- endif
-endfunction
-
-function find_flag_name(configure, value)
- define my.configure = find_flag_name.configure
- define my.found = my.configure->flag(flag.name = my.value)?
- return defined(my.found)
-endfunction
-
-function get_option_type(option)
- define my.option = get_option_type.option
- require(my.option, "option", "type")
- if (my.option.type = "enable" | my.option.type = "with")
- return my.option.type
- endif
- abort "Invalid repository.option.type: $(my.option.type)."
-endfunction
-
-function is_option_boolean(option)
- define my.option = is_option_boolean.option
- return defined(my.option.data_type) & (my.option.data_type = "bool")
-endfunction
-
-function is_option_filepath(option)
- define my.option = is_option_filepath.option
- return defined(my.option.data_type) & (my.option.data_type = "filepath")
-endfunction
-
-function is_option_internal(option)
- define my.option = is_option_internal.option
- return defined(my.option.data_type) & (my.option.data_type = "internal")
-endfunction
-
-function is_option_path(option)
- define my.option = is_option_path.option
- return defined(my.option.data_type) & (my.option.data_type = "path")
-endfunction
-
-function is_option_string(option)
- define my.option = is_option_string.option
- return defined(my.option.data_type) & (my.option.data_type = "string")
-endfunction
-
-function get_option_data_type(option)
- define my.option = get_option_data_type.option
-
- if (!defined(my.option.data_type))
- return "BOOL"
- elsif (is_option_boolean(my.option))
- return "BOOL"
- elsif (is_option_filepath(my.option))
- return "FILEPATH"
- elsif (is_option_internal(my.option))
- return "INTERNAL"
- elsif (is_option_path(my.option))
- return "PATH"
- elsif (is_option_string(my.option))
- return "STRING"
- endif
-
- abort("Unrecognized data_type : $(my.option.data_type)")
-endfunction
-
-function get_option_default_boolean(option)
- define my.option = get_option_default_boolean.option
-
- if (defined(my.option.default))
- if (my.option.default = "yes")
- return "ON"
- elsif (my.option.default = "no")
- return "OFF"
- else
- abort("Invalid default for boolean option: $(my.option.default)")
- endif
- endif
-
- abort("No default for boolean option: $(my.option.name)")
-endfunction
-
-function get_option_default(option)
- define my.option = get_option_default.option
-
- if (is_option_boolean(my.option))
- return get_option_default_boolean(my.option)
- endif
-
- if (defined(my.option.default))
- return my.option.default
- endif
-
- abort("No default for option: $(my.option.name)")
-endfunction
-
-function get_option_define_clause(option, symbol)
- define my.option = get_option_define_clause.option
-
- if (!defined(my.option.inherited))
- return my.symbol
- endif
-
- if (my.option.name = "ndebug")
- return "NOT CMAKE_BUILD_TYPE MATCHES Debug"
- endif
-
- if (my.option.name = "shared")
- return "BUILD_SHARED_LIBS"
- endif
-
- abort "Unrecognized inherited option, cannot form clause: $(my.option.name)"
-endfunction
-
-function emit_options(repository)
- define my.repository = emit_options.repository
- for my.repository->configure.option as _option
- emit_option(_option)
- endfor
-endfunction
-
-function emit_compound_flags(repository)
- define my.repository = emit_compound_flags.repository
- for my.repository->configure.compound as _compound
- emit_compound_flag(_compound, my.repository)
- endfor
-endfunction
-
-function emit_defines(repository)
- define my.repository = emit_defines.repository
- new headers as _headers
- for my.repository->configure.define as _define\
- where !is_empty(_define.header)
-
- if (count(_headers.element, count.name = _define.header) = 0)
- new _headers.element as _element
- _element.name = _define.header
- endnew
- endif
- endfor
-
- for _headers.element as _element
- emit_header(_element)
- endfor
- endnew
-
- for my.repository->configure.define as _define \
- where is_empty(_define.header)
- emit_define_simple(_define)
- endfor
-endfunction
-
-function emit_dependencies(repository)
- define my.repository = emit_dependencies.repository
-
- for my.repository->configure.dependency as _dependency
- if (is_boost_dependency(_dependency))
- emit_boost_dependency(_dependency, my.repository->configure)
- elsif (is_boost_lib_dependency(_dependency))
- elsif (is_java_dependency(_dependency))
- emit_java_dependency_option(_dependency, my.repository->configure, "")
- elsif (is_python_dependency(_dependency))
- elsif (is_package_dependency(_dependency))
- emit_find_dependency_option(_dependency, my.repository->configure, "")
- elsif (is_pthread_dependency(_dependency))
- emit_pthread_dependency(_dependency, my.repository->configure)
- elsif (is_iconv_dependency(_dependency))
- else
- emit_find_dependency_option(_dependency, my.repository->configure, "")
- endif
- endfor
-endfunction
-
-function emit_boost_dependency(dependency, configure)
- define my.dependency = emit_boost_dependency.dependency
- define my.configure = emit_boost_dependency.configure
-
- new features as _features
- # locate boost components
- for my.configure.dependency as _dependency
- define my.component_name = boost_component(_dependency.name)?
- if (!is_empty(my.component_name))
- new _features.element as _element
- _element.name = my.component_name
- endnew
- endif
- endfor
-
- # emit
- emit_boost_use_static_libs()
- emit_find_package_dependency(my.dependency, _features)
- endnew
-
-endfunction
-
-function emit_products(repository, path_prefix)
- define my.repository = emit_products.repository
-
- # emit 'lib'
- for my.repository->make.product as _product
- if ((_product.prefix = "bin") | (_product.prefix = "lib"))
- emit_product_target(my.repository, _product, my.path_prefix)
- endif
- endfor
-
- # emit 'jar'
- define my.javaexec = my.repository->make->product(prefix = "javaexec")?
- define my.jarexec = my.repository->make->product(prefix = "jarexec")?
-
- if (defined(my.javaexec) & defined(my.jarexec))
- emit_jar_product(my.repository, my.javaexec, my.jarexec, my.path_prefix)
- endif
-endfunction
-
-function emit_product_target(repository, product, path_prefix)
- define my.repository = emit_product_target.repository
- define my.product = emit_product_target.product
- define my.repository_path = append_path(global.root, my.repository.name)
- define my.option = find_option_symbol_generic(my.product,\
- my.repository->configure, "-", "false")?
-
- define my.indent = defined(my.option) ?? " " ? ""
-
- define my.target_name = (my.product.prefix = "lib" & my.product.path = "src") ??\
- "\${CANONICAL_LIB_NAME}" ? target_name(my.product, my.repository)
-
- heading2("Define $(my.target_name) project.")
-
- if (defined(my.option))
- write_line("if ($(my.option))")
- endif
-
- new files as _files
- if (defined(my.product.path) & !is_empty(my.product.path))
- define my.product_path = append_path(my.repository_path,\
- my.product.path)
- define my.product_dir = open_directory(my.product_path)
- get_files(_files, my.product_dir, my.product.path, "", "true", \
- "true", "true")
- endif
-
- emit_source_project(my.repository, my.product, _files, my.path_prefix,\
- my.indent)
- endnew
-
- emit_project_properties(my.repository, my.product,\
- my.path_prefix, my.indent)
-
- if (defined(my.option))
- write_line("endif()")
- write_line("")
- endif
-endfunction
-
-function emit_jar_product(repository, javaexec, jarexec, path_prefix)
- define my.repository = emit_jar_product.repository
- define my.javaexec = emit_jar_product.javaexec
- define my.jarexec = emit_jar_product.jarexec
- define my.repository_path = append_path(global.root, my.repository.name)
- define my.option = find_option_symbol_generic(my.jarexec,\
- my.repository->configure, "-", "false")?
-
- define my.indent = defined(my.option) ?? " " ? ""
-
- define my.target_name = my.jarexec->file.path
- if (ends_with(my.target_name, ".jar"))
- my.target_name = left(my.target_name, string.length(my.target_name) - 4)
- endif
-
- heading2("Define $(my.target_name) jar project.")
-
- if (defined(my.option))
- write_line("if ($(my.option))")
- endif
-
- new files as _files
- if (defined(my.javaexec->files) & !is_empty(my.javaexec->files.path))
- define my.product_path = append_path(my.repository_path,\
- my.javaexec->files.path)
- define my.product_dir = open_directory(my.product_path)
- get_files(_files, my.product_dir, my.javaexec->files.path, "", \
- "true", "true", "true")
- endif
-
- emit_jar_project(my.repository, _files, my.target_name, my.path_prefix,\
- my.indent)
- endnew
-
- if (defined(my.option))
- write_line("endif()")
- write_line("")
- endif
-endfunction
-
-function emit_definitions(definitions)
- define my.definitions = emit_definitions.definitions
-
- emit_value_params("add_definitions", "", my.definitions, "")
- if (count(my.definitions.element) > 0)
- write_line("")
- endif
-endfunction
-
-function emit_target_definitions(target_name, definitions)
- define my.definitions = emit_target_definitions.definitions
-
- emit_value_params("target_compile_definitions", my.target_name,\
- my.definitions, "")
-
- if (count(my.definitions.element) > 0)
- write_line("")
- endif
-endfunction
-
-function emit_project_properties(repository, product, path_prefix, indent)
- define my.repository = emit_project_properties.repository
- define my.product = emit_project_properties.product
- define my.target_name = (my.product.prefix = "lib" & my.product.path = "src") ??\
- "\${CANONICAL_LIB_NAME}" ? target_name(my.product, my.repository)
-
- emit_private_target_include_directories(my.repository, my.product,\
- my.target_name, my.path_prefix, my.indent)
-
- if ((my.product.prefix = "lib" & my.product.path = "src"))
- emit_public_target_include_directories(my.repository, my.product,\
- my.target_name, my.path_prefix, my.indent)
- endif
-
- emit_target_link_libraries(my.repository, my.product, my.target_name,\
- my.indent)
-endfunction
-
-function emit_flags(repository)
- define my.repository = emit_flags.repository
- define my.std_prefix = "std=c++"
-
- if (count(my.repository->configure.flag,\
- starts_with(count.name, my.std_prefix) > 0))
- define my.std_flag = my.repository->configure->flag(\
- starts_with(_flag.name, my.std_prefix), _flag)
-
- define my.standard = right(my.std_flag.name,\
- string.length(my.std_flag.name) - string.length(my.std_prefix))
- emit_cxx_standard(my.standard)
- endif
-
- new compile_options as _options
- # add_compile_options
- for my.repository->configure.flag as _flag
- if (starts_with(_flag.name, my.std_prefix))
- next
- endif
-
- if (((_flag.context = "c") | (_flag.context = "c++")) &\
- (count(_options.flag, (count.name = _flag.name)) = 0))
-
- copy _flag to _options
- endif
- endfor
-
- emit_add_compile_options(_options)
- endnew
-endfunction
-
-function include_dir_variable_prefix(library)
- define my.library = include_dir_variable_prefix.library
- define my.value = "$(get_cmake_variable_prefix(_library))"
-
- if (is_boost_dependency(my.library) | is_boost_lib_dependency(my.library))
- my.value = "Boost"
- endif
-
- return my.value
-endfunction
-
-function library_variable_prefix(library)
- define my.library = library_variable_prefix.library
- return "$(get_cmake_variable_prefix(_library))"
-endfunction
-
-function extract_include_directories(params, repository, libraries,\
- project_include_path)
-
- define my.params = extract_include_directories.params
- define my.repository = extract_include_directories.repository
- define my.libraries = extract_include_directories.libraries
-
- for my.libraries.library as _library
- define my.suffix_shared = get_suffix_include_dirs(_library, "shared")
- define my.suffix_static = get_suffix_include_dirs(_library, "static")
- define my.suffix_canonical = get_suffix_include_dirs(_library, "canonical")
-
- if (is_boost_dependency(_library))
- new my.params.element as _element
- _element.universal = "Boost_$(my.suffix_shared)"
- _element.variable = "true"
- endnew
- elsif (is_boost_lib_dependency(_library))
- elsif (_library.name = my.repository->package.library)
-# new my.params.element as _element
-# _element.universal = "\"$(my.project_include_path)\""
-# endnew
- elsif (my.suffix_shared = my.suffix_static)
- new my.params.element as _element
- _element.universal = "$(_library.name:c)_$(my.suffix_shared)"
- _element.variable = "true"
- endnew
- else
- new my.params.element as _element
- _element.shared = "$(_library.name:c)_$(my.suffix_shared)"
- _element.static = "$(_library.name:c)_$(my.suffix_static)"
- _element.universal = "$(_library.name:c)_$(my.suffix_canonical)"
- _element.variable = "true"
- endnew
- endif
- endfor
-endfunction
-
-function extract_link_directories(params, repository, libraries)
- define my.params = extract_link_directories.params
- define my.repository = extract_link_directories.repository
- define my.libraries = extract_link_directories.libraries
-
- for my.libraries.library as _library
- define my.suffix_shared = get_suffix_library_dirs(_library, "shared")
- define my.suffix_static = get_suffix_library_dirs(_library, "static")
- define my.suffix_canonical = get_suffix_library_dirs(_library, "canonical")
-
- if (is_boost_dependency(_library))
- new my.params.element as _element
- _element.universal = "Boost_$(my.suffix_shared)"
- _element.variable = "true"
- endnew
- elsif (is_boost_lib_dependency(_library))
- elsif (_library.name = my.repository->package.library)
- elsif (my.suffix_shared = my.suffix_static)
- new my.params.element as _element
- _element.universal = "$(_library.name:c)_$(my.suffix_shared)"
- _element.variable = "true"
- endnew
- else
- new my.params.element as _element
- _element.shared = "$(_library.name:c)_$(my.suffix_shared)"
- _element.static = "$(_library.name:c)_$(my.suffix_static)"
- _element.universal = "$(_library.name:c)_$(my.suffix_canonical)"
- _element.variable = "true"
- endnew
- endif
- endfor
-endfunction
-
-function extract_link_libraries(params, repository, libraries)
- define my.params = extract_link_libraries.params
- define my.repository = extract_link_libraries.repository
- define my.libraries = extract_link_libraries.libraries
-
- for my.libraries.library as _library
- define my.suffix_shared = get_suffix_libraries(_library, "shared")
- define my.suffix_static = get_suffix_libraries(_library, "static")
- define my.suffix_canonical = get_suffix_libraries(_library, "canonical")
-
- if (is_boost_dependency(_library))
- elsif (is_boost_lib_dependency(_library))
- define my.name = "Boost_$(boost_component(_library.name):upper)"
-
- new my.params.element as _element
- _element.universal = "$(my.name)_$(my.suffix_shared)"
- _element.variable = "true"
- endnew
- elsif (_library.name = my.repository->package.library)
- new my.params.element as _element
- _element.universal = "CANONICAL_LIB_NAME"
- _element.variable = "true"
- endnew
- elsif (my.suffix_shared = my.suffix_static)
- new my.params.element as _element
- _element.universal = "$(_library.name:c)_$(my.suffix_shared)"
- _element.variable = "true"
- endnew
- else
- new my.params.element as _element
- _element.shared = "$(_library.name:c)_$(my.suffix_shared)"
- _element.static = "$(_library.name:c)_$(my.suffix_static)"
- _element.universal = "$(_library.name:c)_$(my.suffix_canonical)"
- _element.variable = "true"
- endnew
- endif
- endfor
-endfunction
-
-function emit_library_params(repository, libraries)
- define my.repository = emit_library_params.repository
- define my.libraries = emit_library_params.libraries
-
- new link_library_param_flags as _params
- for my.repository->configure.flag as _flag where _flag.context = "link"
- if (defined(_flag.compiler))
- abort("Not currently supporting compiler limited flags $(_flag.name).")
- endif
-
- new _params.element as _element
- _element.linker = "true"
- _element.universal = "\"-$(_flag.name)\""
- _element.canonical = "$(_flag.name)"
- endnew
- endfor
-
- if (count(_params.element) > 0)
- heading2("Define project common linker flags.")
- emit_check_linker_flags(_params, "")
- endif
- endnew
-
- new link_library_params as _params
- extract_link_libraries(_params, my.repository, my.libraries)
-
- if (count(_params.element, defined(element.shared)) > 0)
- heading2("Define common library usage for build.")
- emit_shared_static_normalization(_params, "")
- write_line("")
- endif
-
- if (count(_params.element) > 0)
- heading2("Define project common libraries.")
- emit_params("link_libraries", "", _params, "")
- write_line("")
- endif
- endnew
-endfunction
-
-function emit_include_directories(repository, libraries, project_include_path)
- define my.repository = emit_include_directories.repository
- define my.libraries = emit_include_directories.libraries
-
- new include_dirs_params as _params
- extract_include_directories(_params, my.repository, my.libraries,\
- my.project_include_path)
-
- if (count(_params.element, defined(element.shared)) > 0)
- heading2("Define project common includes for build.")
- emit_shared_static_normalization(_params, "")
- write_line("")
- endif
-
- # NOTE: SYSTEM target suppresses warnings from included files.
- if (count(_params.element) > 0)
- heading2("Define project common includes directories")
- emit_params("include_directories", "SYSTEM", _params, "")
- write_line("")
- endif
- endnew
-endfunction
-
-function emit_link_directories(repository, libraries)
- define my.repository = emit_link_directories.repository
- define my.libraries = emit_link_directories.libraries
-
- new library_dirs_params as _params
- extract_link_directories(_params, my.repository, my.libraries)
-
- if (count(_params.element, defined(element.shared)) > 0)
- heading2("Define project common library directories for build.")
- emit_shared_static_normalization(_params, "")
- write_line("")
- endif
-
- if (count(_params.element) > 0)
- heading2("Define project common library directories")
- emit_params("link_directories", "", _params, "")
- write_line("")
- endif
- endnew
-endfunction
-
-function emit_private_target_include_directories(repository, product,\
- target_name, path_prefix, indent)
-
- define my.repository = emit_private_target_include_directories.repository
- define my.product = emit_private_target_include_directories.product
-
- new include_dirs_params as _params
- if (defined(my.product->headers))
- for my.product.headers as _headers where !is_empty(_headers.path)
- new _params.element as _element
- _element.universal = "\"$(append_path(my.path_prefix,\
- _headers.path))\""
- endnew
- endfor
- endif
-
- extract_include_directories(_params, my.repository, my.product, "")
-
- if (count(_params.element, defined(element.shared)) > 0)
- heading2("$(my.indent)$(my.target_name) project specific include directory normalization for build.")
- emit_shared_static_normalization(_params, my.indent)
- write_line("")
- endif
-
-
- if (count(_params.element) > 0)
- heading2("$(my.indent)$(my.target_name) project specific include directories.")
- emit_params(\
- "target_include_directories", "$(my.target_name) PRIVATE",\
- _params, my.indent)
-
- write_line("")
- endif
- endnew
-endfunction
-
-.
-function emit_public_target_include_directories(repository, product,\
- target_name, path_prefix, indent)
-
- define my.repository = emit_public_target_include_directories.repository
- define my.product = emit_public_target_include_directories.product
-
- if (defined(my.product->headers) & !is_empty(my.product->headers.path))
- write_line("$(my.indent)target_include_directories( $(my.target_name) PUBLIC")
- write_line("$(my.indent)\"$(append_path(my.path_prefix, my.product->headers.path))\" )")
- write_line("")
- endif
-endfunction
-
-function emit_target_link_libraries(repository, product, target_name, indent)
- define my.repository = emit_target_link_libraries.repository
- define my.product = emit_target_link_libraries.product
-
- new link_libraries as _params
- extract_link_libraries(_params, my.repository, my.product)
-
- if (count(_params.element, defined(element.shared)) > 0)
- heading2("$(my.indent)$(my.target_name) project specific libraries noramalization for build.")
- emit_shared_static_normalization(_params, my.indent)
- write_line("")
- endif
-
- if (count(_params.element) > 0)
- heading2("$(my.indent)$(my.target_name) project specific libraries/linker flags.")
- emit_params("target_link_libraries", my.target_name,\
- _params, my.indent)
-
- write_line("")
- endif
- endnew
-endfunction
-
-function get_flag(flag)
- define my.flag = get_flag.flag
- if (defined(my.flag.value))
- return "-$(my.flag.value)"
- elsif (defined(my.flag.define))
- return "-D$(my.flag.define:upper)=\\\"${$(my.flag.define)}\\\""
- elsif (defined(my.flag.substitute))
- return "${$(my.flag.substitute)}"
- endif
- abort "Required attribute missing: flag.value|define|substitute"
-endfunction
-
-function emit_flags_params(repository, library)
- define my.repository = emit_flags_params.repository
- define my.library = emit_flags_params.library
-
- new flag_params as _params
- for my.library.flag as _flag
- new _params.element as _element
- _element.value = get_flag(_flag)
- endnew
- endfor
-
- emit_definitions(_params)
- endnew
-endfunction
-
-function emit_target_property_initialization(repository, path_prefix)
- define my.repository = emit_target_property_initialization.repository
- define my.library = my.repository->make->product(prefix = "lib" & path = "src")
-
- # NOTE: this is an assumption that all projects generated include a library
- # which is linked by all included projects. Generalization requires
- # chasing dependencies.
- emit_include_directories(my.repository, my.library, my.path_prefix)
- emit_link_directories(my.repository, my.library)
- emit_library_params(my.repository, my.library)
- emit_flags_params(my.repository, my.library)
-endfunction
-
-function emit_install(repository, path_prefix)
- define my.repository = emit_install.repository
-
- for my.repository->make.product as _product where !is_check(_product) \
- & !is_no_install(_product)
-
- if (match_prefix(_product, "bin") | match_prefix(_product, "lib"))
- emit_product_install(my.repository, _product, my.path_prefix)
- elsif (match_prefix(_product, "doc"))
- emit_doc_install(my.repository, _product, my.path_prefix)
- elsif (match_prefix(_product, "include"))
- emit_include_install(my.repository, _product, my.path_prefix)
- elsif (match_prefix(_product, "pkgconfig"))
- emit_pkgconfig_install(my.repository, _product, my.path_prefix)
- elsif (match_prefix(_product, "jarexec"))
- emit_jarexec_install(my.repository, _product, my.path_prefix)
- else
- # explicitly distribute, unhandled prefix
- emit_data_install(my.repository, _product, my.path_prefix)
- endif
- endfor
-endfunction
-
-function emit_cmakelists(repository)
- define my.repository = emit_cmakelists.repository
-
- copyleft(my.repository.name)
-
- emit_project_initialization(my.repository)
-
- emit_canonical_library_name(my.repository)
-
- emit_flags(my.repository)
-
- emit_options(my.repository)
-
- emit_compound_flags(my.repository)
-
- emit_defines(my.repository)
-
- emit_dependencies(my.repository)
-
- emit_target_property_initialization(my.repository, "../../")
-
- emit_products(my.repository, "../../")
-
- emit_install(my.repository, "../../")
-endfunction
-
-###############################################################################
-# Macros
-###############################################################################
-.endtemplate
-.template 1
-.
-.macro emit_project_initialization(repository)
-. define my.repository = emit_project_initialization.repository
-. require(my.repository, "repository", "name")
-
-. heading2("$(my.repository.name) project configuration.")
-cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
-
-project($(my.repository.name) LANGUAGES C CXX)
-
-enable_testing()
-
-list( APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules" )
-include(CheckIncludeFiles)
-include(CheckSymbolExists)
-include(CheckCXXCompilerFlag)
-include(CheckCXXSourceCompiles)
-include(CheckLinkerFlag)
-
-set_property(GLOBAL PROPERTY USE_FOLDERS ON)
-
-.endmacro # emit_project_initialization
-.
-.macro emit_canonical_library_name(repository)
-. define my.repository = emit_canonical_library_name.repository
-. define my.package = my.repository->package
-. require(my.repository, "repository", "name")
-. require(my.package, "package", "library")
-.
-if (MSVC)
- set( CANONICAL_LIB_NAME $(my.repository.name) )
-else ()
- set( CANONICAL_LIB_NAME $(my.package.library) )
- find_package( PkgConfig REQUIRED )
-
- set( prefix "${CMAKE_PREFIX_PATH}" )
- set( exec_prefix "\\\${prefix}" )
- set( libdir "\\\${exec_prefix}/lib" )
- set( includedir "\\\${exec_prefix}/include" )
-
- set( CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" )
-
- set( PACKAGE_VERSION "$(my.repository.version)" )
- set( VERSION "${PACKAGE_VERSION}" )
-endif ()
-
-.
-.endmacro # emit_canonical_library_name
-.
-.macro emit_cxx_standard(value)
-set( CMAKE_CXX_STANDARD $(my.value) )
-set( CMAKE_CXX_STANDARD_REQUIRED ON )
-
-.endmacro # emit_cxx_standard
-.
-.macro emit_add_compile_options(options)
-. define my.options = emit_add_compile_options.options
-.
-. heading2("Add compiler options")
-. for my.options.flag as _flag by defined(_flag.compiler) ?? _flag.compiler ? ""
-. define my.indent = defined(_flag.compiler) ?? " " ? ""
-# $(_flag.comment)
-. if (defined(_flag.compiler))
-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "$(compiler_id(_flag.compiler))")
-. endif
-$(my.indent)check_cxx_compiler_flag( "-$(_flag.name)" HAS_FLAG_$(_flag.name:upper) )
-$(my.indent)if ( HAS_FLAG_$(_flag.name:upper) )
- $(my.indent)add_compile_options( $<$:-$(_flag.name)> )
-$(my.indent)else()
- $(my.indent)message( FATAL_ERROR "Compiler does not support -$(_flag.name)" )
-$(my.indent)endif()
-. if defined(_flag.compiler)
-endif()
-. endif
-
-. endfor
-.endmacro # emit_add_compile_options
-.
-.macro emit_shared_static_params_specific(name, target_name, params, type,\
- indent)
-.
-. define my.params = emit_shared_static_params_specific.params
-.
-$(my.indent)$(my.name)( $(my.target_name)
-. for my.params.element as _element where !is_empty(_element.universal)\
- | (my.type = "shared" & !is_empty(_element.shared))\
- | (my.type = "static" & !is_empty(_element.static))
-.
-. if (!is_empty(_element.universal))
- $(my.indent)$(_element.universal)$(last() ?? " )" ? "")
-. elsif (my.type = "shared" & !is_empty(_element.shared))
- $(my.indent)$(_element.shared)$(last() ?? " )" ? "")
-. elsif (my.type = "static" & !is_empty(_element.static))
- $(my.indent)$(_element.static)$(last() ?? " )" ? "")
-. endif
-. endfor
-.
-.endmacro # emit_shared_static_params_specific
-.
-.macro emit_check_linker_flags(params, indent)
-. define my.params = emit_check_linker_flags.params
-.
-. for my.params.element as _element
-$(my.indent)check_linker_flag(CXX $(_element.universal) "$(_element.canonical:c)_FOUND")
-
-$(my.indent)if ($(_element.canonical:c)_FOUND)
- $(my.indent)add_link_options($(_element.universal))
-endif()
-
-. endfor
-
-.endmacro # emit_check_linker_flags
-.
-.macro emit_shared_static_normalization(params, indent)
-. define my.params = emit_shared_static_normalization.params
-.
-$(my.indent)if (BUILD_SHARED_LIBS)
-. for my.params.element as _element where defined(_element.shared)
- $(my.indent)set( $(_element.universal) \$\{$(_element.shared)\} CACHE STRING "Placeholder" )
-. endfor
-$(my.indent)else()
-. for my.params.element as _element where defined(_element.static)
- $(my.indent)set( $(_element.universal) \$\{$(_element.static)\} CACHE STRING "Placeholder" )
-. endfor
-$(my.indent)endif()
-.endmacro # emit_shared_static_normalization
-.
-.macro emit_params(name, target_name, params, indent)
-. define my.params = emit_params.params
-.
-$(my.indent)$(my.name)( $(my.target_name)
-. for my.params.element as _element
-. if (!is_empty(_element.universal))
- $(my.indent)$(defined(_element.variable) ?? "\${" ? "")$(_element.universal)$(defined(_element.variable) ?? "}" ? "")$(last() ?? " )" ? "")
-. endif
-. endfor
-.endmacro # emit_params
-.
-.macro emit_shared_static_params(name, target_name, params, indent)
-. define my.params = emit_shared_static_params.params
-.
-. if (count(my.params.element) > 0)
-. if (count(my.params.element,\
- defined(count.shared) | defined(count.static)) > 0)
-$(my.indent)if (BUILD_SHARED_LIBS)
-. emit_shared_static_params_specific(my.name, my.target_name,\
- my.params, "shared", " $(my.indent)")
-$(my.indent)else()
-. emit_shared_static_params_specific(my.name, my.target_name,\
- my.params, "static", " $(my.indent)")
-$(my.indent)endif()
-. else
-. emit_shared_static_params_specific(my.name, my.target_name,\
- my.params, "", my.indent)
-. endif
-. endif
-.
-.endmacro # emit_shared_static_params
-.
-.macro emit_value_params(name, target_name, params, indent)
-. define my.params = emit_value_params.params
-.
-. if (count(my.params.element) > 0)
-$(my.indent)$(my.name)( $(my.target_name)
-. for my.params.element as _element where !is_empty(_element.value)
- $(my.indent)$(_element.value)$(last() ?? " )" ? "")
-. endfor
-. endif
-.
-.endmacro # emit_value_params
-.
-.macro emit_compound_flag(compound, repository)
-. define my.compound = emit_compound_flag.compound
-. define my.repository = emit_compound_flag.repository
-. define my.define_prefix = "$(my.compound.type:upper)_"
-.
-. if defined(my.compound.option)
-. define my.option = my.repository->configure->option(name = my.compound.name)
-. if !defined(my.option)
-. abort("Matching option '$(my.compound.option)' not found for '$(my.compound.name)'.")
-. endif
-. endif
-.
-. define my.indent = defined(my.option) ?? " " ? ""
-. define my.flags = join_flags_name(my.compound)
-. define my.symbol_prefix = defined(my.option) ?? "HAS_FLAGS_" ? my.define_prefix
-.
-. if defined(my.option)
-if ($(get_option_symbol_generic(my.option, "-", "false")))
-. endif
-$(my.indent)check_cxx_compiler_flag("$(my.flags)" $(my.symbol_prefix)$(my.compound.name:upper))
-
-$(my.indent)if ($(my.symbol_prefix)$(my.compound.name:upper))
-. for my.compound.flag as _flag where defined(_flag.name) & !is_empty(_flag.name)
- $(my.indent)add_compile_options( $<$:-$(_flag.name)> )
-. endfor
-. if defined(my.compound->program)
- $(my.indent)set( CMAKE_REQUIRED_FLAGS_PREV "${CMAKE_REQUIRED_FLAGS}" )
- $(my.indent)set( CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} $(my.flags)" )
-. endif
-$(my.indent)endif()
-
-. if defined(my.compound->program)
-$(my.indent)check_cxx_source_compiles("
-. for my.compound->program.include as _include
- $(my.indent)#include <$(_include.header)>
-. endfor
- $(my.indent)int main() {
-. for my.compound->program.loc as _loc
- $(my.indent)$(_loc)
-. endfor
- $(my.indent)}" $(my.define_prefix)$(my.compound.name:upper))
-
-$(my.indent)if ($(my.symbol_prefix)$(my.compound.name:upper))
- $(my.indent)set( CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS_PREV}" )
-$(my.indent)endif()
-
-. endif
-.
-$(my.indent)if ( $(my.define_prefix)$(my.compound.name:upper) )
- $(my.indent)add_compile_definitions( $(my.define_prefix)$(my.compound.name:upper) )
- $(my.indent)set( $(my.compound.name:lower) "$(my.flags)" )
-$(my.indent)else()
- $(my.indent)message( FATAL_ERROR "Failed to enable $(my.define_prefix)$(my.compound.name:upper)" )
-$(my.indent)endif()
-. if defined(my.option)
-endif()
-. endif
-
-.endmacro # emit_compound_flag
-.
-.macro emit_option(option)
-. define my.option = emit_option.option
-. require(my.option, "option", "description")
-. require(my.option, "option", "name")
-. require(my.option, "option", "type")
-.
-. define my.type = get_option_type(my.option)
-. define my.symbol = get_option_symbol_generic(my.option, "-", "false")
-. define my.data_type = get_option_data_type(my.option)
-.
-. define my.implement = is_true(inherited) ?? "Inherit" ? "Implement"
-. define my.output = is_true(my.option.substitute) ?? " and output ${$(my.option.name)}" ? ""
-. define my.defines = defined(my.option.define) ?? " and define $(my.option.define:upper,c)" ? ""
-. define my.conditional = is_true(my.option.conditional) ?? " and declare $(my.symbol)" ? ""
-. heading2("$(my.implement) -D$(my.symbol)$(my.defines)$(my.output)$(my.conditional).")
-.
-. if (!is_true(my.option.inherited))
-set( $(my.symbol) "$(get_option_default(my.option))" CACHE $(my.data_type:upper) "$(my.option.description)" )
-
-. endif
-.
-. if (!is_empty(my.option.define))
-. define my.define_clause = get_option_define_clause(my.option, my.symbol)
-.
-if ($(my.define_clause))
- add_definitions( -D$(my.option.define) )
-endif()
-
-. endif
-.
-. if (is_true(my.option.substitute) & defined(my.option.value))
-if ($(my.symbol))
- set( $(my.option.name:c) "$(my.option.value)" )
-endif()
-
-. endif
-.
-.endmacro # emit_option
-.
-.macro emit_header(header)
-. define my.header = emit_header.header
-. define my.uname = "$(my.header.name:upper,c)"
-.
-. heading2("Initialize HAVE_$(my.uname) variable checking for $(my.header.name)")
-check_include_files( "$(my.header.name)" HAVE_$(my.uname) )
-if (HAVE_$(my.uname))
- add_definitions( -DHAVE_$(my.uname) )
-endif()
-
-.endmacro # emit_header
-.
-.macro emit_define_simple(define)
-. define my.define = emit_define_simple.define
-. require(my.define, "define", "name")
-. define my.uname = "$(my.define.name:upper,c)"
-.
-. if (defined(my.define.value))
-add_definitions( -D$(my.uname)=$my.define.value )
-. else
-add_definitions( -D$(my.uname) )
-. endif
-.
-.endmacro # emit_define_simple
-.
-.macro emit_define(define)
-. define my.define = emit_define.define
-. require(my.define, "define", "header")
-. require(my.define, "define", "export")
-.
-. define my.header_uname = "$(my.define.header:upper,c)"
-. define my.export = "$(my.define.export)"
-. define my.export_uname = "$(my.define.export:upper,c)"
-.
-. heading2("On HAVE_$(my.header_uname), test for $(my.export)")
-.
-if (HAVE_$(my.header_uname))
- check_symbol_exists( "$(my.export)" "$(my.define.header)" HAVE_DECL_$(my.export_uname) )
- if (HAVE_DECL_$(my.export_uname))
- add_definitions( -DHAVE_DECL_$(my.export_uname)=1 )
- else()
- add_definitions( -DHAVE_DECL_$(my.export_uname)=0 )
- endif()
-endif()
-
-.endmacro # emit_define
-.
-.macro emit_find_package_dependency(dependency, features)
-. define my.dependency = emit_find_package_dependency.dependency
-. define my.features = emit_find_package_dependency.features
-. require(my.dependency, "dependency", "name")
-.
-. heading2("Find $(my.dependency.name)")
-. if (count(my.features.element) > 0)
-find_package( $(my.dependency.name:neat) $(my.dependency.version) REQUIRED COMPONENTS
-. for my.features.element as _element
- $(_element.name)$(last() ?? " )" ? "")
-. endfor
-
-. for my.features.element as _element
-set( $(my.dependency.name)_$(_element.name)_LIBS "-l$(my.dependency.name)_$(_element.name)" )
-. endfor
-. else
-find_package( $(my.dependency.name) $(my.dependency.version) )
-. endif
-
-.# NOTE: enable-ndebug hardcoded match to configuration option
-set( $(my.dependency.name:neat)_LIBRARY_DIR $,"\${$(my.dependency.name:neat)_LIBRARY_DIR_RELEASE}","\${$(my.dependency.name:neat)_LIBRARY_DIR_DEBUG}">)
-
-set( $(my.dependency.name)_CPPFLAGS "-I\${$(my.dependency.name:neat)_INCLUDE_DIR}" )
-set( $(my.dependency.name)_LDFLAGS "-L\${$(my.dependency.name:neat)_LIBRARY_DIR}" )
-
-.endmacro # emit_find_package_dependency
-.
-.macro emit_boost_use_static_libs()
-.
-if (BUILD_SHARED_LIBS)
- set( Boost_USE_STATIC_LIBS "off" )
-else()
- set( Boost_USE_STATIC_LIBS "on" )
-endif()
-
-.endmacro # emit_boost_use_static_libs
-.
-.macro emit_pthread_dependency(dependency, configure)
-. define my.dependency = emit_pthread_dependency.dependency
-. define my.configure = emit_pthread_dependency.configure
-.
-. define my.case = get_case_platform(my.dependency, "")
-set( CMAKE_THREAD_PREFER_PTHREAD ON )
-set( THREADS_PREFER_PTHREAD_FLAG ON )
-
-.
-. new configure as _dependencies
-. copy my.dependency to _dependencies as dependency
-. _dependencies->dependency.name = "threads"
-. emit_find_dependency_option(_dependencies->dependency, my.configure, "")
-. endnew
-.
-if ( Threads_FOUND $(is_empty(my.case) ?? "" ? "AND $(my.case) "))
- # TODO: find proper detection - documentation on FindThreads appears incorrect.
- set( pthread_CPPFLAGS "" )
- set( pthread_LIBRARIES "-lpthread" )
- set( pthread_LIBS "-lpthread" )
-endif()
-
-.endmacro # emit_pthread_dependency
-.
-.macro emit_find_dependency(dependency, configure, indent)
-. define my.dependency = emit_find_dependency.dependency
-. define my.configure = emit_find_dependency.configure
-. define my.version = ""
-.
-. if (defined(my.dependency.version) & !is_empty(my.dependency.version))
-. my.version = " $(my.dependency.version)"
-. endif
-.
-$(my.indent)find_package( $(my.dependency.name:neat)$(my.version) REQUIRED )
-. if (is_empty(my.indent))
-
-. endif
-.endmacro # emit_find_dependency
-.
-.macro emit_find_dependency_platform(dependency, configure, indent)
-. define my.dependency = emit_find_dependency_platform.dependency
-. define my.configure = emit_find_dependency_platform.configure
-.
-. define my.case = get_case_platform(my.dependency, "")
-.
-. if (is_empty(my.case))
-. emit_find_dependency(my.dependency, my.configure, my.indent)
-. else
-$(my.indent)if ($(my.case))
-. emit_find_dependency(my.dependency, my.configure, " $(my.indent)")
-$(my.indent)endif()
-. if (is_empty(my.indent))
-
-. endif
-. endif
-.endmacro # emit_find_dependency_platform
-.
-.macro emit_find_dependency_option(dependency, configure, indent)
-. define my.dependency = emit_find_dependency_option.dependency
-. define my.configure = emit_find_dependency_option.configure
-.
-. define my.symbol = find_option_symbol_generic(my.dependency,\
- my.configure, "-", "false")?
-.
-. heading2("Find $(my.dependency.name)")
-. if (is_empty(my.symbol))
-. emit_find_dependency_platform(my.dependency, my.configure, my.indent)
-. else
-$(my.indent)if ($(my.symbol))
-. emit_find_dependency_platform(my.dependency, my.configure,\
- " $(my.indent)")
-$(my.indent)endif()
-. if (is_empty(my.indent))
-
-. endif
-. endif
-.endmacro # emit_find_dependency_option
-.
-.macro emit_java_dependency(dependency, configure, indent)
-. define my.dependency = emit_java_dependency.dependency
-. define my.configure = emit_java_dependency.configure
-. define my.version = defined(my.dependency.version) ?? my.dependency.version ? ""
-.
-$(my.indent)find_package( Java REQUIRED )
-$(my.indent)find_package( JNI $(my.version) REQUIRED )
-$(my.indent)set( java_INCLUDE_DIRS "${JNI_INCLUDE_DIRS}" )
-$(my.indent)set( java_STATIC_INCLUDE_DIRS "${JNI_INCLUDE_DIRS}" )
-$(my.indent)include( UseJava )
-.#$(my.indent)message( "Java_FOUND : ${Java_FOUND}" )
-.#$(my.indent)message( "Java_INCLUDE_DIRS : ${Java_INCLUDE_DIRS}" )
-.#$(my.indent)message( "Java_LIBRARIES : ${Java_LIBRARIES}" )
-.#$(my.indent)message( "JNI_INCLUDE_DIRS : ${JNI_INCLUDE_DIRS}" )
-.#$(my.indent)message( "JNI_LIBRARIES : ${JNI_LIBRARIES}" )
-.#$(my.indent)message( "JNI_FOUND : ${JNI_FOUND}" )
-.#$(my.indent)message( "JAVA_AWT_LIBRARY : ${JAVA_AWT_LIBRARY}" )
-.#$(my.indent)message( "JAVA_JVM_LIBRARY : ${JAVA_JVM_LIBRARY}" )
-.#$(my.indent)message( "JAVA_INCLUDE_PATH : ${JAVA_INCLUDE_PATH}" )
-.#$(my.indent)message( "JAVA_INCLUDE_PATH2 : ${JAVA_INCLUDE_PATH2}" )
-.#$(my.indent)message( "JAVA_AWT_INCLUDE_PATH : ${JAVA_AWT_INCLUDE_PATH}" )
-. if (is_empty(my.indent))
-
-. endif
-.endmacro # emit_java_dependency
-.
-.macro emit_java_dependency_platform(dependency, configure, indent)
-. define my.dependency = emit_java_dependency_platform.dependency
-. define my.configure = emit_java_dependency_platform.configure
-.
-. define my.case = get_case_platform(my.dependency, "")
-.
-. if (is_empty(my.case))
-. emit_java_dependency(my.dependency, my.configure, my.indent)
-. else
-$(my.indent)if ($(my.case))
-. emit_java_dependency(my.dependency, my.configure, " $(my.indent)")
-$(my.indent)endif()
-. if (is_empty(my.indent))
-
-. endif
-. endif
-.endmacro # emit_java_dependency_platform
-.
-.macro emit_java_dependency_option(dependency, configure, indent)
-. define my.dependency = emit_java_dependency_option.dependency
-. define my.configure = emit_java_dependency_option.configure
-.
-. define my.symbol = find_option_symbol_generic(my.dependency,\
- my.configure, "-", "false")?
-.
-. heading2("Find $(my.dependency.name)")
-. if (is_empty(my.symbol))
-. emit_java_dependency_platform(my.dependency, my.configure, my.indent)
-. else
-$(my.indent)if ($(my.symbol))
-. emit_java_dependency_platform(my.dependency, my.configure,\
- " $(my.indent)")
-$(my.indent)endif()
-. if (is_empty(my.indent))
-
-. endif
-. endif
-.
-.endmacro # emit_java_dependency_option
-.
-.macro emit_source_project(repository, product, files, path_prefix, indent)
-. define my.repository = emit_source_project.repository
-. define my.product = emit_source_project.product
-. define my.files = emit_source_project.files
-.
-. if (my.product.prefix = "lib" & my.product.path = "src")
-$(my.indent)add_library( \${CANONICAL_LIB_NAME}
-. elsif (my.product.prefix = "lib")
-$(my.indent)add_library( $(target_name(my.product, my.repository))
-. elsif (my.product.prefix = "bin")
-$(my.indent)add_executable( $(target_name(my.product, my.repository))
-. else
-. abort("Unexpected product.prefix : $(my.product.prefix)")
-. endif
-.
-. for my.files.file as _file
- $(my.indent)"$(append_path(append_path(my.path_prefix, _file.relative_path), _file.name))"$(last() ?? " )" ? "")
-. endfor
-
-. if (is_true(my.product.test))
-. define my.tests = get_test_list(_product)
-. define my.run = is_empty(my.tests) ?? "*" ? "$(my.tests)"
-$(my.indent)add_test( NAME $(target_name(my.product, my.repository)) COMMAND $(target_name(my.product, my.repository))
- $(my.indent)--run_test=$(my.run)
- $(my.indent)--log_level=warning
- $(my.indent)--show_progress=no
- $(my.indent)--detect_memory_leak=0
- $(my.indent)--report_level=no
- $(my.indent)--build_info=yes )
-
-. endif
-.endmacro # emit_source_project
-.
-.macro emit_jar_project(repository, files, target_name, path_prefix, indent)
-. define my.repository = emit_jar_project.repository
-. define my.files = emit_jar_project.files
-.
-$(my.indent)add_jar( $(my.target_name)-jar SOURCES
-. for my.files.file as _file
- $(my.indent)"$(append_path(append_path(my.path_prefix, _file.relative_path), _file.name))"
-. endfor
- OUTPUT_NAME $(my.target_name) )
-.
-.endmacro # emit_jar_project
-.
-.macro emit_product_install(repository, product, path_prefix)
-. define my.repository = emit_product_install.repository
-. define my.product = emit_product_install.product
-. define my.option = find_option_symbol_generic(my.product,\
- my.repository->configure, "-", "false")?
-.
-. define my.target = target_name(my.product, my.repository)
-. if (my.target = my.repository.name)
-. my.target = "\${CANONICAL_LIB_NAME}"
-. endif
-.
-. define my.indent = defined(my.option) ?? " " ? ""
-.
-. heading2("Manage $(my.target) installation.")
-. if (defined(my.option))
-if ($(my.option))
-. endif
-$(my.indent)install( TARGETS $(my.target)
- $(my.indent)RUNTIME DESTINATION bin
- $(my.indent)LIBRARY DESTINATION lib
- $(my.indent)ARCHIVE DESTINATION lib
- $(my.indent)PUBLIC_HEADER DESTINATION include )
-. if (defined(my.option))
-endif()
-. endif
-
-.endmacro # emit_product_install
-.
-.macro emit_doc_install(repository, product, path_prefix)
-. define my.repository = emit_doc_install.repository
-. define my.product = emit_doc_install.product
-. define my.option = find_option_symbol_generic(my.product,\
- my.repository->configure, "-", "false")?
-.
-. if (count(my.product.file, defined(count.path)) > 0)
-. define my.destination = "share/doc/$(my.repository.name)"
-. define my.indent = defined(my.option) ?? " " ? ""
-.
-. heading2("Manage installation of docs.")
-. if (defined(my.option))
-if ($(my.option))
-. endif
-$(my.indent)install( FILES
-. for my.product.file as _file where defined(_file.path)
- $(my.indent)"$(append_path(my.path_prefix, _file.path))"
-. endfor
- $(my.indent)DESTINATION $(my.destination) )
-. if (defined(my.option))
-endif()
-. endif
-
-. endif
-.endmacro # emit_doc_install
-.
-.macro emit_pkgconfig_install(repository, product, path_prefix)
-. define my.repository = emit_pkgconfig_install.repository
-. define my.product = emit_pkgconfig_install.product
-. define my.option = find_option_symbol_generic(my.product,\
- my.repository->configure, "-", "false")?
-.
-. if (count(my.product.file, defined(count.path)) > 0)
-. define my.destination = "${pkgconfigdir}"
-. define my.indent = defined(my.option) ?? " " ? ""
-.
-. heading2("Manage pkgconfig installation.")
-. if (defined(my.option))
-if ($(my.option))
-. endif
-. for my.product.file as _file where defined(_file.path)
-$(my.indent)configure_file(
- $(my.indent)"$(append_path(my.path_prefix, _file.path)).in"
- $(my.indent)"$(_file.path)" @ONLY )
-
-. endfor
-.
-$(my.indent)install( FILES
-. for my.product.file as _file where defined(_file.path)
- $(my.indent)"\${CMAKE_CURRENT_BINARY_DIR}/$(_file.path)"
-. endfor
- $(my.indent)DESTINATION \"$(my.destination)\" )
-. if (defined(my.option))
-endif()
-. endif
-
-. endif
-.endmacro # emit_pkgconfig_install
-.
-.macro emit_jarexec_install(repository, product, path_prefix)
-. define my.repository = emit_jarexec_install.repository
-. define my.product = emit_jarexec_install.product
-. define my.option = find_option_symbol_generic(my.product,\
- my.repository->configure, "-", "false")?
-.
-. if (count(my.product.file, defined(count.path)) > 0)
-. define my.destination = "share/java"
-. define my.indent = defined(my.option) ?? " " ? ""
-.
-. heading2("Manage jar installation.")
-. if (defined(my.option))
-if ($(my.option))
-. endif
-.
-$(my.indent)install( FILES
-. for my.product.file as _file where defined(_file.path)
- $(my.indent)"${CMAKE_CURRENT_BINARY_DIR}/$(_file.path)"
-. endfor
- $(my.indent)DESTINATION $(my.destination) )
-. if (defined(my.option))
-endif()
-. endif
-
-. endif
-.endmacro # emit_jarexec_install
-.
-.macro emit_include_install(repository, product, path_prefix)
-. define my.repository = emit_include_install.repository
-. define my.product = emit_include_install.product
-. define my.option = find_option_symbol_generic(my.product,\
- my.repository->configure, "-", "false")?
-.
-. if (count(my.product.files, !is_empty(count.path)) > 0)
-. define my.indent = defined(my.option) ?? " " ? ""
-.
-. heading2("Manage include installation.")
-. for my.product.files as _files where !is_empty(_files.path)
-. define my.destination = "include"
-.
-. if (defined(my.option))
-if ($(my.option))
-. endif
-$(my.indent)install( DIRECTORY "$(append_path(my.path_prefix, _files.path))"
- $(my.indent)DESTINATION $(my.destination) )
-. if (defined(my.option))
-endif()
-. endif
-
-. endfor
-. endif
-.endmacro # emit_include_install
-.
-.macro emit_data_install(repository, product, path_prefix)
-. define my.repository = emit_data_install.repository
-. define my.product = emit_data_install.product
-. define my.option = find_option_symbol_generic(my.product,\
- my.repository->configure, "-", "false")?
-.
-. if (count(my.product.file, !is_empty(count.path)) > 0)
-. define my.destination = "etc/libbitcoin"
-. define my.indent = defined(my.option) ?? " " ? ""
-.
-. heading2("Manage data installation for $(my.product.prefix) prefixed product.")
-. if (defined(my.option))
-if ($(my.option))
-. endif
-$(my.indent)install( FILES
-. for my.product.file as _file where !is_empty(_file.path)
- $(my.indent)"$(append_path(my.path_prefix, _file.path))"
-. endfor
- $(my.indent)DESTINATION $(my.destination) )
-. if (defined(my.option))
-endif()
-. endif
-
-. endif
-.endmacro # emit_data_install
-.
-.endtemplate
-.template 0
-###############################################################################
-# Generation
-###############################################################################
-.endtemplate
-.template 0
-function generate_cmakelists(path_prefix, repositories)
- define my.repositories = generate_cmakelists.repositories
- define my.project_path_suffix = project_relative_build_path()
-
- for my.repositories.repository by name as _repository
- require(_repository, "repository", "name")
- define my.output_path = append_path(append_path(my.path_prefix,\
- _repository.name), project_relative_build_path())
- create_directory(my.output_path)
- define my.out_file = append_path(my.output_path, "CMakeLists.txt")
- notify(my.out_file)
- output(my.out_file)
- emit_cmakelists(_repository)
- close
- endfor _repository
-endfunction # generate_cmakelists
-
-###############################################################################
-# Execution
-###############################################################################
-[global].root = ".."
-[global].trace = 0
-[gsl].ignorecase = 0
-
-# Note: expected context root libbitcoin-build directory
-gsl from "library/math.gsl"
-gsl from "library/string.gsl"
-gsl from "library/collections.gsl"
-gsl from "utilities.gsl"
-
-generate_cmakelists("output", generate)
-
-.endtemplate
diff --git a/templates/gsl.CMakePresets.json b/templates/gsl.CMakePresets.json
deleted file mode 100644
index 571d76b9..00000000
--- a/templates/gsl.CMakePresets.json
+++ /dev/null
@@ -1,147 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate libbitcoin .vscode/settings.json.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Functions
-###############################################################################
-
-function workflow_relative_path(repository, path_prefix)
- define my.repository = workflow_relative_path.repository
- require(my.repository, "repository", "name")
- define my.subpath = "builds/cmake"
- return append_path(append_path(my.path_prefix,\
- canonical_path_name(my.repository)), my.subpath)
-endfunction
-
-# Generation
-###############################################################################
-.endtemplate
-.template 1
-.macro emit_property(property, pre, post, listMember)
-. my.property = emit_property.property
-. my.prefix = emit_property.pre
-. my.postfix = emit_property.post
-.
-. if (defined(my.property.type))
-. require(my.property, "property", "name")
-. my.isObject = (my.property.type = "object")
-. my.isList = (my.property.type = "list")
-. if (my.isObject | my.isList)
-$(my.prefix)"$(my.property.name)": $(my.isObject ?? "{" ? "[")
-. for my.property.property as _property
-. emit_property(_property, "$(my.prefix) ", last() ?? "" ? ",", my.isList)
-. endfor
-$(my.prefix)$(my.isObject ?? "}" ? "]")$(my.postfix)
-. else
-$(my.prefix)"$(my.property.name)": {
-$(my.prefix) "type": "$(my.property.type)",
-$(my.prefix) "value": "$(my.property.value)"
-$(my.prefix)}$(my.postfix)
-. endif
-. elsif (defined(my.property.value))
-. if (defined(my.property.name))
-$(my.prefix)"$(my.property.name)": "$(my.property.value)"$(my.postfix)
-. elsif (emit_property.listMember)
-$(my.prefix)"$(my.property.value)"$(my.postfix)
-. else
-. abort("Non-list-member property lacks name.")
-. endif
-. else
-. abort("Unrecognized type-less, value-less property.")
-. endif
-.endmacro #emit_property
-.
-.macro emit_configuration_body(config)
-. my.config = emit_configuration_body.config
-.
- "name": "$(my.config.name)",
-. if defined(my.config.display)
- "displayName": "$(my.config.display)",
-. endif
-. if defined(my.config.description)
- "description": "$(my.config.description)",
-. endif
-. if defined(my.config.hidden)
- "hidden": $(my.config.hidden),
-. endif
-. for my.config.property as _property
-. my.prefix = " "
-. my.postfix = last() ?? "" ? ","
-. emit_property(_property, my.prefix, my.postfix, false)
-. endfor
-.endmacro #emit_configuration_body
-.
-.macro generate_cmake_presets_json(path_prefix)
-.for generate.repository by name as _repository
-. require(_repository, "repository", "name")
-. my.absolute_path = join(join(global.root, my.path_prefix), _repository.name)
-. my.output_path = workflow_relative_path(_repository, my.path_prefix)
-. create_directory(my.output_path)
-. define my.out_file = "$(my.output_path)/CMakePresets.json"
-. notify(my.out_file)
-. output(my.out_file)
-.
-. new presets as _presets
-. calculate_presets(_presets, _repository, generate->presets)
-.
-{
- "version": 5,
- "configurePresets": [
-. for _presets.configuration as _configuration
- {
-. emit_configuration_body(_configuration)
- }$(last() ?? "" ? ",")
-. endfor
- ],
- "buildPresets": [
- {
- "name": "nix-target-list",
- "hidden": true,
- "targets": [
-. for _repository->make.product as _product where ((_product.prefix = "bin") | (_product.prefix = "lib"))
-. if (_product.path = "src")
- "$(_repository->package.library)"$(last() ?? "" ? ",")
-. else
- "$(target_name(_product, _repository))"$(last() ?? "" ? ",")
-. endif
-. endfor
- ]
- },
-. for _presets.configuration as _configuration where !defined(_configuration.hidden) | (_configuration.hidden = "false")
- {
- "name": "$(_configuration.name)",
- "displayName": "$(_configuration.display)",
- "inherits": [ "nix-target-list" ],
- "configurePreset": "$(_configuration.name)"
- }$(last() ?? "" ? ",")
-. endfor
- ]
-}
-. endnew
-.
-. close
-.endfor _repository
-.endmacro # generate_cmake_presets_json
-.endtemplate
-.template 0
-###############################################################################
-# Execution
-###############################################################################
-[global].root = ".."
-[global].trace = 0
-[gsl].ignorecase = 0
-
-# Note: expected context root libbitcoin-build directory
-gsl from "library/math.gsl"
-gsl from "library/string.gsl"
-gsl from "library/collections.gsl"
-gsl from "utilities.gsl"
-
-generate_cmake_presets_json("output")
-
-.endtemplate
diff --git a/templates/gsl.Find.cmake b/templates/gsl.Find.cmake
deleted file mode 100644
index 51703f75..00000000
--- a/templates/gsl.Find.cmake
+++ /dev/null
@@ -1,147 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate Find.cmake.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Functions
-###############################################################################
-
-###
-### string generators
-###
-function project_relative_build_path()
- return "builds/cmake/modules"
-endfunction
-
-function emit_repository_find_cmake_files(repository, configure, output_path)
- define my.repository = emit_repository_find_cmake_files.repository
- define my.configure = emit_repository_find_cmake_files.configure
-
- for my.configure.dependency as _dependency \
- where is_package_dependency(_dependency)
-
- define my.out_file = "$(my.output_path)/Find$(_dependency.name:neat).cmake"
- notify(my.out_file)
- output(my.out_file)
- copyleft(_repository.name)
- emit_documentation(_repository, _dependency)
- emit_find_logic(_repository, _dependency)
- close
- endfor _dependency
-
-endfunction
-
-###############################################################################
-# Macros
-###############################################################################
-.endtemplate
-.template 1
-.
-.macro emit_documentation(repository, dependency)
-. define my.repository = emit_documentation.repository
-. define my.dependency = emit_documentation.dependency
-.
-# Find$(my.dependency.name:neat)
-#
-# Use this module by invoking find_package with the form::
-#
-# find_package( $(my.dependency.name:neat)
-# [version] # Minimum version
-# [REQUIRED] # Fail with error if $(my.dependency.name) is not found
-# )
-#
-# Defines the following for use:
-#
-# $(my.dependency.name:c)_FOUND - true if headers and requested libraries were found
-# $(my.dependency.name:c)_INCLUDE_DIRS - include directories for $(my.dependency.name) libraries
-# $(my.dependency.name:c)_LIBRARY_DIRS - link directories for $(my.dependency.name) libraries
-# $(my.dependency.name:c)_LIBRARIES - $(my.dependency.name) libraries to be linked
-# $(my.dependency.name:c)_PKG - $(my.dependency.name) pkg-config package specification.
-#
-
-.endmacro # emit_documentation
-.
-.macro emit_find_logic(repository, dependency)
-. define my.repository = emit_find_logic.repository
-. define my.dependency = emit_find_logic.dependency
-. define my.prefix = is_true(my.dependency.unprefixed) ?? "" ? "lib"
-.
-if (MSVC)
- if ( $(my.dependency.name:neat)_FIND_REQUIRED )
- set( _$(my.dependency.name:c)_MSG_STATUS "SEND_ERROR" )
- else ()
- set( _$(my.dependency.name:c)_MSG_STATUS "STATUS" )
- endif()
-
- set( $(my.dependency.name:c)_FOUND false )
- message( ${_$(my.dependency.name:c)_MSG_STATUS} "MSVC environment detection for '$(my.dependency.name)' not currently supported." )
-else ()
- # required
- if ( $(my.dependency.name:neat)_FIND_REQUIRED )
- set( _$(my.dependency.name:c)_REQUIRED "REQUIRED" )
- endif()
-
- # quiet
- if ( $(my.dependency.name:neat)_FIND_QUIETLY )
- set( _$(my.dependency.name:c)_QUIET "QUIET" )
- endif()
-
- # modulespec
- if ( $(my.dependency.name:neat)_FIND_VERSION_COUNT EQUAL 0 )
- set( _$(my.dependency.name:c)_MODULE_SPEC "$(my.prefix)$(my.dependency.name)" )
- else ()
- if ( $(my.dependency.name:neat)_FIND_VERSION_EXACT )
- set( _$(my.dependency.name:c)_MODULE_SPEC_OP "=" )
- else ()
- set( _$(my.dependency.name:c)_MODULE_SPEC_OP ">=" )
- endif()
-
- set( _$(my.dependency.name:c)_MODULE_SPEC "$(my.prefix)$(my.dependency.name) ${_$(my.dependency.name:c)_MODULE_SPEC_OP} ${$(my.dependency.name:neat)_FIND_VERSION}" )
- endif()
-
- pkg_check_modules( $(my.dependency.name:c) ${_$(my.dependency.name:c)_REQUIRED} ${_$(my.dependency.name:c)_QUIET} "${_$(my.dependency.name:c)_MODULE_SPEC}" )
- set( $(my.dependency.name:c)_PKG "${_$(my.dependency.name:c)_MODULE_SPEC}" )
-endif()
-.endmacro # emit_find_logic
-.
-.endtemplate
-.template 0
-###############################################################################
-# Generation
-###############################################################################
-function generate_find_cmake(path_prefix, repository_fan_out)
-for generate.repository by name as _repository
- require(_repository, "repository", "name")
- define my.output_path = !is_true(my.repository_fan_out) ??\
- my.path_prefix ?\
- append_path(append_path(my.path_prefix, _repository.name),\
- project_relative_build_path())
-
- create_directory(my.output_path)
- emit_repository_find_cmake_files(_repository, _repository->configure,\
- my.output_path)
-
-endfor _repository
-endfunction # generate_installer
-.endtemplate
-.template 0
-###############################################################################
-# Execution
-###############################################################################
-[global].root = ".."
-[global].trace = 0
-[gsl].ignorecase = 0
-
-# Note: expected context root libbitcoin-build directory
-gsl from "library/math.gsl"
-gsl from "library/string.gsl"
-gsl from "library/collections.gsl"
-gsl from "utilities.gsl"
-
-generate_find_cmake("cmake", "false")
-
-.endtemplate
diff --git a/templates/gsl.appveyor.yml b/templates/gsl.appveyor.yml
deleted file mode 100644
index 0bd0516a..00000000
--- a/templates/gsl.appveyor.yml
+++ /dev/null
@@ -1,224 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate libbitcoin appveyor.yml.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Functions
-###############################################################################
-function is_job_debug(job)
- define my.job = is_job_debug.job
- define my.symbol = "--disable-ndebug"
- return (count(my.job.option, (count.value = my.symbol)) > 0)
-endfunction
-
-function sanitized_link(job)
- define my.job = sanitized_link.job
- require(my.job, "job", "link")
- define my.static = "static"
- define my.sanitized_static = "Static"
-
- if (my.job.link = my.static)
- return my.sanitized_static
- endif
-
- abort("Unrecognized link option: $(my.job.link)")
-endfunction
-
-function sanitized_debug(job)
- define my.job = sanitized_debug.job
- define my.debug = "Debug"
- define my.release = "Release"
-
- if (is_job_debug(my.job))
- return my.debug
- endif
-
- return my.release
-endfunction
-
-function get_test_list(product)
- define my.product = get_test_list.product
- define my.tests = ""
- for my.product->runner.run as _run
- my.tests = join(my.tests, _run.test, ",")
- endfor
- return my.tests
-endfunction
-
-function emit_unit_test_options(repository)
- define my.repository = emit_unit_test_options.repository
- for my.repository->make.product as _product where (defined(_product->runner))
- define my.tests = get_test_list(_product)
- define my.run = is_empty(my.tests) ?? "*" ? "$(my.tests)"
- write_line(" BOOST_UNIT_TEST_OPTIONS: \"--run_test=$(my.run) --show_progress=no --detect_memory_leak=0 --report_level=no --build_info=yes\"")
- endfor
-endfunction
-
-function is_system_windows(job)
- define my.job = is_system_windows.job
- return defined(my.job) & my.job.system = "windows"
-endfunction
-
-function is_platform_x64(job)
- define my.job = is_platform_x64.job
- return defined(my.job) & my.job.compiler = "x64"
-endfunction
-
-function is_platform_Win32(job)
- define my.job = is_platform_Win32.job
- return defined(my.job) & my.job.compiler = "Win32"
-endfunction
-
-###############################################################################
-# Macros
-###############################################################################
-.endtemplate
-.template 1
-.
-.macro emit_ctp_installation()
- - ps: >-
- $BASE_KEY = "HKLM:SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
- $WOW_KEY = "HKLM:SOFTWARE\\wow6432node\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
- $CTP_URL = "https://download.microsoft.com/download/3/C/2/3C271B79-6354-4B66-9014-C6CEBC14C5C4/vc_CompilerCTP.Nov2013.exe";
- $CTP_FILENAME = "vc_CompilerCTP.Nov2013.exe";
- $INSTALL_LOG_PATH = "c:\\users\\appveyor\\install-log.txt";
- function GetUninstallString($product_name) {
- $x64_items = @(Get-ChildItem $BASE_KEY);
- ($x64_items + @(Get-ChildItem $WOW_KEY) `
- | ForEach-Object { Get-ItemProperty Microsoft.PowerShell.Core\\Registry::$_ } `
- | Where-Object { $_.DisplayName -and $_.DisplayName.Contains($product_name) } `
- | Select UninstallString).UninstallString
- }
- Write-Host "Uninstalling Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.21005..." -ForegroundColor Yellow;
- "\$(GetUninstallString "Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.21005") /quiet" | out-file "$env:TEMP\\uninstall.cmd" -Encoding ASCII;
- & $env:temp\\uninstall.cmd;
- Write-Host "Uninstalling Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.30501..." -ForegroundColor Yellow;
- "\$(GetUninstallString "Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.30501") /quiet" | out-file "$env:TEMP\\uninstall.cmd" -Encoding ASCII;
- & $env:temp\\uninstall.cmd;
- Write-Host "Uninstalling Microsoft Visual C++ 2013 Redistributable (x86) - 12.0.30501..." -Foreground Yellow;
- "\$(GetUninstallString "Microsoft Visual C++ 2013 Redistributable (x86) - 12.0.30501") /quiet" | out-file "$env:TEMP\\uninstall.cmd" -Encoding ASCII;
- & $env:temp\\uninstall.cmd;
- Write-Host "Downloading Visual C++ Compiler November 2013 CTP..." -ForegroundColor Yellow;
- $CTP_INSTALLER_PATH = "\$($env:TEMP)\\$CTP_FILENAME";
- (New-Object Net.WebClient).DownloadFile($CTP_URL, $CTP_INSTALLER_PATH);
- Write-Host "Installing CTP Compiler..." -ForegroundColor Yellow;
- cmd /c start /wait $CTP_INSTALLER_PATH /install /quiet /norestart /log $INSTALL_LOG_PATH;
- Write-Host "CTP Compiler Installation Complete." -ForegroundColor Green;
-.endmacro # emit_ctp_installation
-.
-.macro emit_test_execution(name)
- - ps: >-
- Write-Host "Locating test executables..." -ForegroundColor Yellow;
- $BC_TEST_EXES = @(Get-ChildItem -Path "$env:APPVEYOR_BUILD_FOLDER\\bin" -recurse | Where-Object { $_.Name -eq "$(my.name)-test.exe" });
- If ($BC_TEST_EXES.Count -ne 1) {
- Write-Host "Failure, invalid count of test executables." -ForegroundColor Red;
- exit 1;
- }
- Write-Host "Found single test executable: " $BC_TEST_EXES.FullName -ForegroundColor Green;
- $BC_TEST_SINGLETON = $BC_TEST_EXES.FullName;
- Write-Host "Executing $BC_TEST_SINGLETON $env:BOOST_UNIT_TEST_OPTIONS" -ForegroundColor Yellow;
- try {
- Invoke-Expression "$BC_TEST_SINGLETON $env:BOOST_UNIT_TEST_OPTIONS"
- }
- catch {
- $ERR = $_;
- Write-Host "Test execution failure: " $ERR -ForegroundColor Red;
- exit $ERR;
- }
- Write-Host "Test execution complete." -ForegroundColor Green;
-.endmacro # emit_test_execution
-.
-.macro emit_job(job, repository)
-. define my.job = emit_job.job
-. define my.repository = emit_job.repository
- - configuration: $(sanitized_link(my.job))$(sanitized_debug(my.job))
- platform: $(my.job.compiler)
-. emit_unit_test_options(my.repository)
-.endmacro # emit_job
-.
-.macro emit_matrix(matrix, repository)
-. define my.matrix = emit_matrix.matrix
-. define my.repository = emit_matrix.repository
-. for my.matrix.job as _job\
- by "$(_job.compiler)-$(_job.link)-$(sanitized_debug(_job))"\
- where is_system_windows(_job) & is_platform_x64(_job)
-.
-. emit_job(_job, my.repository)
-. endfor _job
-. for my.matrix.job by "$(compiler)-$(link)" as _job where\
- is_system_windows(_job) & is_platform_Win32(_job)
-.
-. emit_job(_job, my.repository)
-. endfor _job
-.endmacro # emit_matrix
-.
-.endtemplate
-.template 0
-###############################################################################
-# Generation
-###############################################################################
-.endtemplate
-.template 1
-.macro generate_appveyor_yml(path_prefix)
-.for generate.repository by name as _repository
-. require(_repository, "repository", "name")
-. my.output_path = join(my.path_prefix, canonical_path_name(_repository))
-. create_directory(my.output_path)
-. define my.out_file = "$(my.output_path)/.appveyor.yml"
-. notify(my.out_file)
-. output(my.out_file)
-. copyleft(_repository.name)
-. define my.matrix = _repository->matrix
-version: $(_repository.version).{build}-{branch}
-
-image: Visual Studio 2013
-
-clone_folder: c:\\git\\$(_repository.name)
-skip_tags: true
-
-environment:
- matrix:
-. emit_matrix(my.matrix, _repository)
-
-matrix:
- fast_finish: true
-
-init:
- - git config --global core.autocrlf true
-
-before_build:
-. emit_ctp_installation()
-
-build_script:
- - c:\\git\\$(_repository.name)\\build.cmd c:\\git %PLATFORM% %CONFIGURATION% vs2013
-.# - powershell c:\\git\\$(_repository.name)\\build.ps1 -PATH c:\\git -PLATFORM %PLATFORM% -CONFIGURATION %CONFIGURATION%
- - cd /d %APPVEYOR_BUILD_FOLDER%
-
-test_script:
-. emit_test_execution(_repository.name)
-.
-. close
-.endfor _repository
-.endmacro # generate_appveyor_yml
-.endtemplate
-.template 0
-###############################################################################
-# Execution
-###############################################################################
-[global].root = ".."
-[global].trace = 0
-[gsl].ignorecase = 0
-
-# Note: expected context root libbitcoin-build directory
-gsl from "library/math.gsl"
-gsl from "library/string.gsl"
-gsl from "library/collections.gsl"
-gsl from "utilities.gsl"
-
-generate_appveyor_yml("output")
-
-.endtemplate
diff --git a/templates/gsl.bindings.bat b/templates/gsl.bindings.bat
deleted file mode 100644
index feb5f5c1..00000000
--- a/templates/gsl.bindings.bat
+++ /dev/null
@@ -1,82 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate bindings.sh.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Macros
-###############################################################################
-.endtemplate
-.template 1
-.
-.macro bindings_content_bat(interface)
-REM Script to build language bindings for $(my.interface) c++ public interfaces.
-REM This script requires SWIG - "Simplified Wrapper and Interface Generator".
-REM SWIG is a simple tool available for most platforms at http://www.swig.org
-REM Add the path to swig.exe to the path of this process or your global path.
-
-echo Generating $(my.interface) bindings...
-
-REM Do everything relative to this file location.
-cd %~dp0
-
-REM Clean and make required directories.
-rmdir /s /q "bindings\\java\\wrap" 2>NUL
-rmdir /s /q "bindings\\java\\proxy\\org\\libbitcoin\\$(my.interface)" 2>NUL
-rmdir /s /q "bindings\\python\\wrap" 2>NUL
-rmdir /s /q "bindings\\python\\proxy" 2>NUL
-
-mkdir "bindings\\java\\wrap"
-mkdir "bindings\\java\\proxy\\org\\libbitcoin\\$(my.interface)"
-mkdir "bindings\\python\\wrap"
-mkdir "bindings\\python\\proxy"
-
-REM Generate bindings.
-swig -c++ -java -outdir "bindings\\java\\proxy\\org\\libbitcoin\\$(my.interface)" -o "bindings\\java\\wrap\\$(my.interface).cpp" "bindings\\$(my.interface).swg"
-swig -c++ -python -outdir "bindings\\python\\proxy" -o "bindings\\python\\wrap\\$(my.interface).cpp" "bindings\\$(my.interface).swg"
-.
-.endmacro # bindings_content_bat
-.
-.endtemplate
-.template 0
-###############################################################################
-# Generation
-###############################################################################
-function generate_bindings_bat(path_prefix)
-for generate.repository by name as _repository
- require(_repository, "repository", "name")
- my.output_path = join(my.path_prefix, _repository.name)
- create_directory(my.output_path)
- define my.out_file = "$(my.output_path)/bindings.bat"
- notify(my.out_file)
- output(my.out_file)
-
- batch_no_echo()
- bat_copyleft(_repository.name)
- define my.interface = bitcoin_to_include(_repository.name)
- bindings_content_bat(my.interface)
-
- close
-endfor _repository
-endfunction # generate_bindings_bat
-.endtemplate
-.template 0
-###############################################################################
-# Execution
-###############################################################################
-[global].root = ".."
-[global].trace = 0
-[gsl].ignorecase = 0
-
-# Note: expected context root libbitcoin-build directory
-gsl from "library/math.gsl"
-gsl from "library/string.gsl"
-gsl from "library/collections.gsl"
-gsl from "utilities.gsl"
-
-generate_bindings_bat("output")
-
-.endtemplate
diff --git a/templates/gsl.bindings.sh b/templates/gsl.bindings.sh
deleted file mode 100644
index 57d5cd5c..00000000
--- a/templates/gsl.bindings.sh
+++ /dev/null
@@ -1,85 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate bindings.sh.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Macros
-###############################################################################
-.endtemplate
-.template 1
-.
-.macro bindings_content_sh(interface)
-# Script to build language bindings for $(my.interface) c++ public interfaces.
-# This script requires SWIG - "Simplified Wrapper and Interface Generator".
-# SWIG is a simple tool available for most platforms at http://www.swig.org
-# Add the path to swig.exe to the path of this process or your global path.
-
-# Exit this script on the first error.
-set -e
-
-echo Generating $(my.interface) bindings...
-
-# Do everything relative to this file location.
-cd `dirname "$0"`
-
-# Clean and make required directories.
-rm -rf "bindings/java/wrap"
-rm -rf "bindings/java/proxy/org/libbitcoin/$(my.interface)"
-rm -rf "bindings/python/wrap"
-rm -rf "bindings/python/proxy"
-
-mkdir -p "bindings/java/wrap"
-mkdir -p "bindings/java/proxy/org/libbitcoin/$(my.interface)"
-mkdir -p "bindings/python/wrap"
-mkdir -p "bindings/python/proxy"
-
-# Generate bindings.
-swig -c++ -java -outdir "bindings/java/proxy/org/libbitcoin/$(my.interface)" -o "bindings/java/wrap/$(my.interface).cpp" "bindings/$(my.interface).swg"
-swig -c++ -python -outdir "bindings/python/proxy" -o "bindings/python/wrap/$(my.interface).cpp" "bindings/$(my.interface).swg"
-.
-.endmacro # bindings_content_sh
-.
-.endtemplate
-.template 0
-###############################################################################
-# Generation
-###############################################################################
-function generate_bindings_sh(path_prefix)
-for generate.repository by name as _repository
- require(_repository, "repository", "name")
- my.output_path = join(path_prefix, _repository.name)
- create_directory(my.output_path)
- define my.out_file = "$(my.output_path)/bindings.sh"
- notify(my.out_file)
- output(my.out_file)
-
- shebang("sh")
- copyleft(_repository.name)
- define my.interface = bitcoin_to_include(_repository.name)
- bindings_content_sh(my.interface)
-
- close
-endfor _repository
-endfunction # generate_bindings_sh
-.endtemplate
-.template 0
-###############################################################################
-# Execution
-###############################################################################
-[global].root = ".."
-[global].trace = 0
-[gsl].ignorecase = 0
-
-# Note: expected context root libbitcoin-build directory
-gsl from "library/math.gsl"
-gsl from "library/string.gsl"
-gsl from "library/collections.gsl"
-gsl from "utilities.gsl"
-
-generate_bindings_sh("output")
-
-.endtemplate
diff --git a/templates/gsl.build.cmd b/templates/gsl.build.cmd
deleted file mode 100644
index fe420f9d..00000000
--- a/templates/gsl.build.cmd
+++ /dev/null
@@ -1,215 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate libbitcoin build.cmd.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Functions
-###############################################################################
-function is_matching_repository_name(repository, build)
- define my.repository = is_matching_repository_name.repository
- define my.build = is_matching_repository_name.build
- return defined(my.repository.name) & defined(my.build.repository) & \
- (my.repository.name = my.build.repository)
-endfunction
-
-function is_github_dependency(build)
- define my.build = is_github_dependency.build
- return defined(my.build.github)
-endfunction
-
-function is_nugetable(build)
- define my.build = is_nugetable.build
- return defined(my.build.nuget) & (my.build.nuget = "true")
-endfunction
-
-function is_build_dependency(repository, build)
- define my.repository = is_build_dependency.repository
- define my.build = is_build_dependency.build
- return !is_matching_repository_name(my.repository, my.build) & \
- is_github_dependency(my.build) & !is_nugetable(my.build)
-endfunction
-
-###############################################################################
-# Macros
-###############################################################################
-.endtemplate
-.template 1
-.
-.macro emit_error_handler(message)
-. define my.message = emit_error_handler.message
-IF %ERRORLEVEL% NEQ 0 (
- call :failure "$(my.message)"
- exit /b 1
-)
-.endmacro # emit_error_handler
-.
-.macro emit_error_handler_indent(message)
-. define my.message = emit_error_handler_indent.message
- IF %ERRORLEVEL% NEQ 0 (
- call :failure "$(my.message)"
- exit /b 1
- )
-.endmacro # emit_error_handler_indent
-.
-.macro emit_instructions(repositories, repository)
-. define my.repositories = emit_instructions.repositories
-. define my.repository = emit_instructions.repository
-call :pending "Build initialized..."
-IF NOT EXIST "%nuget_pkg_path%" (
- call mkdir "%nuget_pkg_path%"
-. emit_error_handler_indent("mkdir %nuget_pkg_path% failed.")
-)
-
-. new install as _cumulative
-. cumulative_install(_cumulative, my.repositories, my.repository)
-. for _cumulative.build as _build where is_build_dependency(my.repository, _build)
-.#call :$(_build.repository)
-.# emit_error_handler("Build failed.")
-call :init $(_build.github) $(_build.repository) $(_build.branch)
-. emit_error_handler("Initializing repository $(_build.github) $(_build.repository) $(_build.branch) failed.")
-. endfor
-. endnew
-.
-call :bld_repo $(my.repository.name)
-. emit_error_handler("Building $(my.repository.name) failed.")
-
-call :success "Build complete."
-exit /b 0
-.endmacro # emit_instructions
-.
-.macro emit_lib_init_repository()
-:init
-call :pending "Initializing repository %~1/%~2/%~3..."
-IF NOT EXIST "%path_base%\\%~2" (
- call git clone -q --branch=%~3 https://github.com/%~1/%~2 "%path_base%\\%~2"
-. emit_error_handler_indent("git clone %~1/%~2 failed.")
-) ELSE (
- call :success "%path_base%\\%~2 exists, assuming valid clone."
-)
-
-call :bld_proj %~2
-. emit_error_handler("Building project %~2 failed.")
-call :success "Initialization of %~1/%~2/%~3 complete."
-exit /b 0
-.endmacro # emit_lib_init_repository
-.
-.macro emit_lib_build_repository()
-:bld_repo
-call :pending "Building respository %~1..."
-call :depends "%~1"
-. emit_error_handler("Initializing dependencies %~1 failed.")
-call cd /d "%path_base%\\%~1\\builds\\msvc\\%proj_version%"
-call "%msbuild_exe%" %msbuild_args% %~1.sln /p:PreBuildEventUseInBuild=false /p:PostBuildEventUseInBuild=false
-. emit_error_handler("%msbuild_exe% %msbuild_args% %~1.sln failed.")
-call :success "Building repository %~1 execution complete."
-call cd /d "%path_base%"
-exit /b 0
-.endmacro # emit_lib_build_repository
-.
-.macro emit_lib_build_repository_project()
-:bld_proj
-call :pending "Building respository project %~1..."
-call :depends %~1
-. emit_error_handler("Initializing dependencies %~1 failed.")
-call cd /d "%path_base%\\%~1\\builds\\msvc\\%proj_version%"
-call "%msbuild_exe%" %msbuild_args% /target:%~1:Rebuild %~1.sln /p:PreBuildEventUseInBuild=false /p:PostBuildEventUseInBuild=false
-. emit_error_handler("%msbuild_exe% %msbuild_args% /target:%~1:Rebuild %~1.sln")
-call :success "Building repository project %~1 execution complete."
-call cd /d "%path_base%"
-exit /b 0
-.endmacro # emit_lib_build_repository_project
-.
-.macro emit_lib_init_dependencies()
-:depends
-call :pending "nuget restoring dependencies for %~1..."
-call nuget restore "%path_base%\\%~1\\builds\\msvc\\%proj_version%\\%~1.sln" -OutputDirectory "%nuget_pkg_path%"
-. emit_error_handler("nuget restore failed.")
-call :success "nuget restoration for %~1 complete."
-exit /b 0
-.endmacro # emit_lib_init_dependencies
-.
-.macro emit_lib_colorized_echos()
-:pending
-echo [93m%~1[0m
-exit /b 0
-
-:success
-echo [92m%~1[0m
-exit /b 0
-
-:failure
-echo [91m%~1[0m
-exit /b 0
-.endmacro # emit_lib_colorized_echos
-.
-.macro initialize_batch_script
-@echo off
-SETLOCAL ENABLEEXTENSIONS
-SET "parent=%~dp0"
-SET "relative_path_base=%~1"
-call cd /d "%relative_path_base%"
-SET "path_base=%cd%"
-SET "nuget_pkg_path=%path_base%\\.nuget\\packages"
-SET "msbuild_args=/verbosity:minimal /p:Platform=%~2 /p:Configuration=%~3 /p:PreferredToolArchitecture=%~4"
-SET "proj_version=%~5"
-SET "msbuild_exe=msbuild"
-IF EXIST "%~6" SET "msbuild_exe=%~6"
-.endmacro #initialize_batch_script
-.
-.endtemplate
-.template 0
-###############################################################################
-# Generation
-###############################################################################
-.endtemplate
-.template 1
-.macro generate_build_cmd(path_prefix)
-.for generate.repository by name as _repository
-. require(_repository, "repository", "name")
-. my.output_path = join(my.path_prefix, canonical_path_name(_repository))
-. create_directory(my.output_path)
-. define my.out_file = "$(my.output_path)/build.cmd"
-. notify(my.out_file)
-. output(my.out_file)
-. bat_copyleft(_repository.name)
-. initialize_batch_script()
-
-. emit_instructions(generate, _repository)
-
-
-
-. emit_lib_init_repository()
-
-. emit_lib_build_repository()
-
-. emit_lib_build_repository_project()
-
-. emit_lib_init_dependencies()
-
-. emit_lib_colorized_echos()
-.
-. close
-.endfor _repository
-.endmacro # generate_build_cmd
-.endtemplate
-.template 0
-###############################################################################
-# Execution
-###############################################################################
-[global].root = ".."
-[global].trace = 0
-[gsl].ignorecase = 0
-
-# Note: expected context root libbitcoin-build directory
-gsl from "library/math.gsl"
-gsl from "library/string.gsl"
-gsl from "library/collections.gsl"
-gsl from "utilities.gsl"
-
-generate_build_cmd("output")
-
-.endtemplate
diff --git a/templates/gsl.ci.yml b/templates/gsl.ci.yml
deleted file mode 100644
index 04aa1d3a..00000000
--- a/templates/gsl.ci.yml
+++ /dev/null
@@ -1,1087 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate libbitcoin ci.yml.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Functions
-###############################################################################
-
-function workflow_relative_path(repository, path_prefix)
- define my.repository = workflow_relative_path.repository
- require(my.repository, "repository", "name")
- define my.subpath = ".github/workflows"
- return append_path(append_path(my.path_prefix,\
- canonical_path_name(my.repository)), my.subpath)
-endfunction
-
-function sort_compiler(job)
- define my.job = sort_compiler.job
- return (defined(my.job) & defined(my.job.compiler)) ?? my.job.compiler ? \
- "default"
-endfunction
-
-function is_system_windows(job)
- define my.job = is_system_windows.job
- return defined(my.job) & my.job.system = "windows"
-endfunction
-
-function is_job_config(configuration, job)
- define my.config = is_job_config.configuration
- define my.job = is_job_config.job
- return defined(my.job.build) \
- & (!defined(my.config.job_require) | defined(my.job.$(my.config.job_require))) \
- & (((my.job.build = "all") & (defined(my.config.accept_all))) \
- | (my.job.build = my.config.job))
-endfunction
-
-function is_build_autotools(item)
- define my.item = is_build_autotools.item
- return defined(my.item.build) & \
- ((my.item.build = "auto") | (my.item.build = "all"))
-endfunction
-
-function is_build_cmake(item)
- define my.item = is_build_cmake.item
- return defined(my.item.build) & \
- ((my.item.build = "cmake") | (my.item.build = "all"))
-endfunction
-
-function is_build_preset(item)
- define my.item = is_build_preset.item
- return defined(my.item.build) & \
- ((my.item.build = "preset") | (my.item.build = "all")) & defined(my.item.preset)
-endfunction
-
-function has_jobs_autotools(ci)
- define my.ci = has_jobs_autotools.ci
- return (count(my.ci.job, is_build_autotools(count)) > 0)
-endfunction
-
-function has_jobs_cmake(ci)
- define my.ci = has_jobs_cmake.ci
- return (count(my.ci.job, is_build_cmake(job)) > 0)
-endfunction
-
-function has_jobs_presets(ci)
- define my.ci = has_jobs_presets.ci
- return (count(my.ci.job, is_build_preset(job)) > 0)
-endfunction
-
-function has_jobs_msbuild(ci)
- define my.ci = has_jobs_msbuild.ci
- return (count(my.ci.job, (count.system = "windows")) > 0)
-endfunction
-
-function get_job_os(job)
- define my.job = get_job_os.job
- define my.os = ""
-
- if (is_empty(my.job.system))
- abort "get_job_os failed due to missing job.system value."
- elsif (defined(my.job.image))
- my.os = my.job.image
- elsif (my.job.system = "linux")
- my.os = "ubuntu-latest"
- elsif (my.job.system = "osx")
- my.os = "macos-latest"
- elsif (my.job.system = "windows")
- my.os = "windows-latest"
- else
- abort "get_job_os failed due to unsupported job.system value '$(my.job.system)'."
- endif
-
- return my.os
-endfunction # get_job_os
-
-function get_job_preset(job)
- define my.job = get_job_preset.job
- require(my.job, "job", "preset")
- return my.job.preset
-endfunction # get_job_preset
-
-function get_job_options(job, config)
- define my.job = get_job_options.job
- define my.config = get_job_options.config
-
- define my.toolset = ""
- if (defined(my.job.build))
- if (my.job.build = 'all')
- my.toolset = my.config.job
- elsif ((my.job.build = 'autotools') | (my.job.build = 'cmake') | (my.job.build = 'preset'))
- my.toolset = my.job.build
- else
- abort("get_job_options: unsupported job build value '$(my.job.build)'.")
- endif
- endif
-
- if (my.toolset = 'preset')
- my.toolset = 'cmake'
- endif
-
- define my.result = ""
- for my.job.option as _option where (defined(_option.$(my.toolset)))
- my.result = join(my.result, _option.$(my.toolset), " ")
- endfor
-
- return my.result
-endfunction # get_job_options
-
-function get_job_packager(job)
- define my.job = get_job_packager.job
- define my.packager = ""
-
- if (my.job.system = "linux")
- my.packager = "apt"
- elsif (my.job.system = "osx")
- my.packager = "brew"
- else
- abort "get_job_packager failed due to unsupported job.system value '$(my.job.system)'."
- endif
-
- return my.packager
-endfunction # get_job_packager
-
-function sanitized_link(job)
- define my.job = sanitized_link.job
- require(my.job, "job", "link")
- define my.result = ""
-
- if (my.job.link = "dynamic")
- my.result = "Dynamic"
- elsif (my.job.link = "static")
- my.result = "Static"
- else
- abort "sanitized_link failed due to unsupported job.link value '$(my.job.link)'."
- endif
-
- return my.result
-endfunction
-
-function sanitized_assert(job)
- define my.job = sanitized_assert.job
- require(my.job, "job", "assert")
- define my.result = ""
-
- if (my.job.assert = "debug")
- my.result = "Debug"
- elsif (my.job.assert = "ndebug")
- my.result = "Release"
- else
- abort "sanitized_assert failed due to unsupported job.assert value '$(my.job.assert)'."
- endif
-
- return my.result
-endfunction
-
-function get_job_windows_configuration(job)
- define my.job = get_job_windows_configuration.job
- return "$(sanitized_link(my.job))$(sanitized_assert(my.job))"
-endfunction # get_job_windows_configuration
-
-function get_job_windows_platform(job)
- define my.job = get_job_windows_platform.job
- require(my.job, "job", "compiler")
- return my.job.compiler
-endfunction # get_job_windows_platform
-
-function has_axis_value(job, name, value)
- define my.job = has_axis_value.job
- define my.name = has_axis_value.name
- define my.value = has_axis_value.value
-
- return (count(my.job.axis, (count.name = my.name)) = 1) &\
- defined(my.job->axis(axis.name = my.name).value) &\
- (my.job->axis(axis.name = my.name).value = my.value)
-endfunction # has_axis_value
-
-function get_job_packages(integration, repository, job)
- define my.integration = get_job_packages.integration
- define my.repository = get_job_packages.repository
- define my.job = get_job_packages.job
- define my.packages = ""
- define my.spacer = ""
-
- for my.repository->ci.axis as _axis
- if (!has_axis_value(my.job, _axis.name, "build"))
- if (count(my.integration.dependency, (count.name = _axis.name) &\
- (count.os = my.job.system) & defined(count.package)) = 1)
- my.pname = my.integration->dependency((name = _axis.name) &\
- (os = my.job.system)).package
- my.packages = "$(my.packages)$(my.spacer)$(my.pname)"
- my.spacer = " "
- endif
- endif
- endfor
-
- if (defined(my.job.coverage) & !(my.job.coverage = "false"))
- my.packages = "$(my.packages)$(my.spacer)lcov"
- my.spacer = " "
- endif
-
- return "$(my.packages)"
-endfunction # get_job_packages
-
-function get_job_compiler(job)
- define my.job = get_job_compiler.job
- define my.compiler = ""
-
- if (my.job.system = "osx")
- my.compiler = "clang"
-
- if (!is_empty(my.job.compiler))
- abort "Continuious Integration 'osx' job has extraneous 'compiler' property."
- endif
- elsif (my.job.system = "linux")
- if (is_empty(my.job.compiler))
- abort "get_job_compiler failed due to missing job.compiler value."
- elsif ((my.job.compiler = "gcc") | (my.job.compiler = "clang"))
- my.compiler = "$(my.job.compiler)"
- else
- abort "get_job_compiler failed due to unsupported job.compiler value $(my.job.compiler)."
- endif
- else
- abort "get_job_compiler unrecognized system value $(my.job.system)"
- endif
-
- return "$(my.compiler)"
-endfunction # get_job_compiler
-
-function get_job_optimization(job)
- define my.job = get_job_optimization.job
- define my.value = ""
-
- if (!defined(my.job.optimization))
- abort "get_job_optimization failed due to undefined 'optimization' property."
- endif
-
- if (!(my.job.optimization = "debug") & !(my.job.optimization = "size"))
- abort "get_job_optimization value '$(my.job.optimization)' unrecognized."
- endif
-
- return my.job.optimization
-endfunction # get_job_optimization
-
-function get_job_compiler_package(job)
- define my.job = get_job_compiler_package.job
- define my.version = ""
-
- if (!is_empty(my.job.version))
- my.version = "-$(my.job.version)"
- endif
-
- return "$(get_job_compiler(my.job))$(my.version)"
-endfunction # get_job_compiler_package
-
-function get_job_assert(job)
- define my.job = get_job_assert.job
-
- if (defined(my.job.assert) &\
- (!(my.job.assert = "debug") & !(my.job.assert = "ndebug")))
- abort "Expected job.assert defined as either 'debug' or 'ndebug'."
- endif
-
- return my.job.assert ? "ndebug"
-endfunction # get_job_assert
-
-function get_job_cc(job)
- define my.job = get_job_cc.job
- define my.version = ""
- define my.compiler = get_job_compiler(my.job)
-
- if (!is_empty(my.job.version))
- my.version = "-$(my.job.version)"
- endif
-
- if !(my.compiler = "gcc") & !(my.compiler = "clang")
- abort "get_job_cc failed due to unsupported compiler value."
- endif
-
- return "$(my.compiler)$(my.version)"
-endfunction # get_job_cc
-
-function get_job_cxx(job)
- define my.job = get_job_cxx.job
- define my.version = ""
- define my.compiler = ""
- define my.specified_compiler = get_job_compiler(my.job)
-
- if (!is_empty(my.job.version))
- my.version = "-$(my.job.version)"
- endif
-
- if (my.specified_compiler = "gcc")
- my.compiler = "g++"
- elsif (my.specified_compiler = "clang")
- my.compiler = "clang++"
- else
- abort "get_job_cxx failed due to unsupported compiler value."
- endif
-
- return "$(my.compiler)$(my.version)"
-endfunction # get_job_cxx
-
-function get_job_link(job)
- define my.job = get_job_link.job
- define my.option = ""
-
- if (is_empty(my.job.link))
- abort "get_job_link failed due to missing job.link value."
- elsif (!(my.job.link = "dynamic") & !(my.job.link = "static"))
- abort "get_job_link failed due to unsupported job.link value."
- endif
-
- return my.job.link
-endfunction # get_job_link
-
-function get_job_cflags(integration, repository, job)
- define my.integration = get_job_cflags.integration
- define my.repository = get_job_cflags.repository
- define my.job = get_job_cflags.job
- define my.flags = ""
-
- if (is_empty(my.job.optimization))
- abort "get_job_cflags expects job.optimization, no value provided."
- elsif (my.job.optimization = "size")
- my.flags = "-Os"
- elsif (my.job.optimization = "debug")
- my.flags = "-Og"
- else
- abort "get_job_cflags unsupported job.optimization value '$(my.job.optimization)."
- endif
-
- if (defined(my.job.cflags))
- my.flags = "$(my.flags) $(my.job.cflags)"
- endif
-
- if (!is_empty(my.job.coverage) & (my.job.coverage = "true"))
- my.flags = "$(my.flags) -g --coverage"
- endif
-
- if ((my.job.system = "osx") & (my.job.link = "static"))
- my.flags = "$(my.flags) -fvisibility=hidden"
- endif
-
- my.flags = "$(my.flags) -fPIE"
-
- for my.repository->ci.axis as _axis
- if (!has_axis_value(my.job, _axis.name, "build"))
- if (count(my.integration.dependency, ((count.name = _axis.name) & (count.os = my.job.system))) = 1)
- define my.dependency = my.integration->dependency(\
- (name = _axis.name) & (os = my.job.system))
-
- if (defined(my.dependency.path))
- my.flags = "$(my.flags) -I$(my.dependency.path)/include"
- endif
- endif
- endif
- endfor
-
- return "$(my.flags)"
-endfunction # get_job_cflags
-
-function get_job_axis_value(configuration, integration, decl, job, axis)
- define my.config = get_job_axis_value.configuration
- define my.integration = get_job_axis_value.integration
- define my.decl = get_job_axis_value.decl
- define my.job = get_job_axis_value.job
- define my.axis = get_job_axis_value.axis
- define my.value = ""
-
- define my.axis_with = "--with-$(my.axis.name)"
- define my.axis_without = "--without-$(my.axis.name)"
-
- if (defined(my.config.cmake) & !defined(my.decl.recognized))
- my.axis_with = "-Dwith-$(my.axis.name)=yes"
- my.axis_without = "-Dwith-$(my.axis.name)=no"
- endif
-
- if (!defined(my.axis.value))
- echo "caller: get_job_axis_value"
- my.value = get_job_axis_default(my.configuration, my.integration, my.decl, my.job)
- elsif (my.axis.value = "build")
- if (!defined(my.decl.build) | !(my.decl.build = "true"))
- abort "Disallowed value 'build' provided for axis '$(my.axis.name)'."
- endif
-
- if (defined(my.decl.buildwith) & (my.decl.buildwith = "true") &\
- defined(my.decl.with) & (my.decl.with = "true"))
- my.value = "--build-$(my.axis.name) $(my.axis_with)"
- else
- my.value = "--build-$(my.axis.name)"
- endif
- elsif (my.axis.value = "with")
- if (!defined(my.decl.with) | !(my.decl.with = "true"))
- abort "Disallowed value 'with' provided for axis '$(my.axis.name)'."
- endif
-
- my.value = "$(my.axis_with)"
- elsif (my.axis.value = "without")
- if (!defined(my.decl.without) | !(my.decl.without = "true"))
- abort "Disallowed value 'without' provided for axis '$(my.axis.name)'."
- endif
-
- my.value = "$(my.axis_without)"
- elsif (defined(my.decl.valued) & (my.decl.valued = "true"))
- if (defined(my.axis.value))
- my.value = "$(my.axis.value)"
- endif
- else
- abort "Unrecognized value '$(my.axis.value)' provided for axis '$(my.axis.name)'."
- endif
-
- return my.value
-endfunction # get_job_axis_value
-
-function get_job_axis_default(configuration, integration, decl, job)
- define my.config = get_job_axis_default.configuration
- define my.integration = get_job_axis_default.integration
- define my.decl = get_job_axis_default.decl
- define my.job = get_job_axis_default.job
- define my.result = ""
-
- if (count(my.integration.dependency, (count.name = my.decl.name) &\
- (count.os = my.job.system)) = 1)
- define my.dependency = my.integration->dependency((name = my.decl.name) & (os = my.job.system))
-
- if ((count(my.dependency.toolset, (count.name = "auto")) = 1))
- my.result = my.dependency->toolset(name = "auto").axis
- endif
-
- if ((count(my.dependency.toolset, (count.name = "cmake")) = 1) & defined(my.config.cmake))
- my.result = my.dependency->toolset(name = "cmake").axis
- endif
- endif
-
- return my.result
-endfunction # get_job_axis_default
-
-function get_job_shell_axis_value(configuration, integration, job, decl)
- define my.config = get_job_shell_axis_value.configuration
- define my.integration = get_job_shell_axis_value.integration
- define my.job = get_job_shell_axis_value.job
- define my.decl = get_job_shell_axis_value.decl
- define my.value = ""
-
- define my.declared = (count(my.job.axis, (count.name = my.decl.name)) = 1)
- define my.pathed = (count(my.integration.dependency, (count.name = my.decl.name) &\
- (count.os = my.job.system) & defined(count.path)) = 1)
-
- if (my.declared)
- my.value = get_job_axis_value(my.config, my.integration, my.decl, my.job,\
- my.job->axis(name = my.decl.name))
- else
- my.value = get_job_axis_default(my.config, my.integration, my.decl, my.job)
- endif
-
- return my.value
-endfunction # get_job_shell_axis_value
-
-function get_job_coverage(job)
- define my.job = get_job_coverage.job
- define my.coverage = "nocov"
-
- if (defined(my.job.coverage) & !is_empty(my.job.coverage) &\
- (my.job.coverage = "true"))
- my.coverage = "cov"
- endif
-
- return my.coverage
-endfunction # get_job_coverage
-
-function get_job_cpuflag_detection(job)
- define my.job = get_job_cpuflag_detection.job
- define my.value = "ignore"
-
- if (defined(my.job.detectcpuflags) & !is_empty(my.job.detectcpuflags) &\
- (my.job.detectcpuflags = "true"))
- my.value = "detect"
- endif
-
- return my.value
-endfunction # get_job_cpuflag_detection
-
-function get_coverage_exclusions(ci)
- define my.ci = get_coverage_exclusions.ci
-
- # Exclude all system directories.
- define my.excludes = quote("/usr/*")
-
- # Exclude prefix directory (fixed in github actions ci)
- my.excludes += " $(quote("${{ env.LIBBITCOIN_SRC_PATH }}prefix/*"))"
-
- # Exclude build directory (fixed in github actions ci)
- # my.excludes += " $(quote("${{ github.workspace }}/build/*"))"
-
- # Exclude examples directory
- my.excludes += " $(quote("${{ github.workspace }}/examples/*"))"
-
- # Exclude test directory
- my.excludes += " $(quote("${{ github.workspace }}/test/*"))"
-
- # Exclude explicitly specified workspace relative paths
- if (defined(my.ci->coverage) & \
- (count(my.ci->coverage.exclude, !is_empty(count.path)) > 0))
- for my.ci->coverage.exclude as _exclude
- my.excludes += " $(quote("${{ github.workspace }}/" + _exclude.path))"
- endfor _exclude
- endif
-
- return my.excludes
-endfunction # get_coverage_exclusions
-
-function get_product_tests(product)
- define my.product = get_product_tests.product
- define my.tests = ""
-
- if defined(my.product)
- if defined(my.product->runner)
- for my.product->runner.run as _run
- my.tests = join(my.tests, _run.test, ",")
- endfor
- endif
- endif
-
- return my.tests
-endfunction
-
-function get_sln_tests(repository)
- define my.repository = get_sln_tests.repository
-
- define my.product = my.repository->make->product(\
- defined(_product->runner), _product)?
-
- define my.tests = get_product_tests(my.product)
-
- return is_empty(my.tests) ?? "*" ? "$(my.tests)"
-endfunction # get_sln_tests
-
-###############################################################################
-# Macros
-###############################################################################
-.endtemplate
-.template 1
-.
-.macro initialize_matrix_shell_entry(configuration, integration, repository, ci, job)
-. define my.config = initialize_matrix_shell_entry.configuration
-. define my.integration = initialize_matrix_shell_entry.integration
-. define my.repository = initialize_matrix_shell_entry.repository
-. define my.ci = initialize_matrix_shell_entry.ci
-. define my.job = initialize_matrix_shell_entry.job
-.
-. if is_job_config(my.config, my.job)
- - os: $(get_job_os(my.job))
-. if (defined(my.config.use_preset))
- preset: "$(get_job_preset(my.job))"
-. endif
- cxx: "$(get_job_cxx(my.job))"
- link: "$(get_job_link(my.job))"
- optimization: "$(get_job_optimization(my.job))"
- assert: "$(get_job_assert(my.job))"
- coverage: "$(get_job_coverage(my.job))"
- detectcpuflags: "$(get_job_cpuflag_detection(my.job))"
-. for my.ci.axis by "$(name)" as _axis where !defined(_axis.silent)
- $(_axis.name): "$( get_job_shell_axis_value(my.config, my.integration, my.job, _axis))"
-. endfor
- cc: "$(get_job_cc(my.job))"
- flags: "$(get_job_cflags(my.integration, my.repository, my.job))"
- options: "$(get_job_options(my.job, my.config))"
- packager: "$(get_job_packager(my.job))"
- packages: "$(get_job_packages(my.integration, my.repository, my.job))"
-
-. endif
-.endmacro # initialize_matrix_shell_entry
-.
-.macro initialize_matrix_shell(configuration, integration, repository, ci)
-. define my.config = initialize_matrix_shell.configuration
-. define my.integration = initialize_matrix_shell.integration
-. define my.repository = initialize_matrix_shell.repository
-. define my.ci = initialize_matrix_shell.ci
-.
- matrix:
- include:
-.
-. for my.ci.job by "$(system)-$(sort_compiler(_job))-$(link)" as _job where is_job_config(_config, _job)
-. initialize_matrix_shell_entry(my.config, my.integration, my.repository, my.ci, _job)
-. endfor _job
-.endmacro # initialize_matrix_shell
-.
-.macro initialize_matrix_msbuild_entry(repository, ci, job)
-. define my.repository = initialize_matrix_msbuild_entry.repository
-. define my.ci = initialize_matrix_msbuild_entry.ci
-. define my.job = initialize_matrix_msbuild_entry.job
-.
- - os: $(get_job_os(my.job))
- configuration: "$(get_job_windows_configuration(my.job))"
- platform: "$(get_job_windows_platform(my.job))"
- version: "vs2022"
- tests: "$(get_sln_tests(my.repository))"
-
-.endmacro # initialize_matrix_msbuild_entry
-.
-.macro initialize_matrix_msbuild(repository, ci)
-. define my.repository = initialize_matrix_msbuild.repository
-. define my.ci = initialize_matrix_msbuild.ci
-.
- matrix:
- include:
-.
-. for my.ci.job by "$(system)-$(compiler)-$(link)" as _job where is_system_windows(_job)
-. initialize_matrix_msbuild_entry(my.repository, my.ci, _job)
-. endfor _job
-.
-.endmacro #initialize_matrix_msbuild
-.
-.macro emit_step_prepare_toolchain(configuration)
-. define my.config = emit_step_prepare_toolchain.configuration
-.
- - name: Prepare toolchain [generic]
- run: |
- git config --global init.defaultBranch master
-
- - name: Prepare toolchain [apt]
- if: ${{ matrix.packager == 'apt' }}
- run: |
- sudo apt-get update
- sudo apt-get install git build-essential autoconf automake libtool pkg-config ${{ matrix.packages }}
-
- - name: Prepare toolchain [brew]
- if: ${{ matrix.packager == 'brew' }}
- run: |
- brew install autoconf automake libtool ${{ matrix.packages }}
- if [[ -n "${{ matrix.llvm }}" ]]; then
- echo "PATH=/opt/homebrew/opt/${{ matrix.llvm }}/bin:$PATH" >> $GITHUB_ENV
- fi
-.
-.endmacro # emit_step_prepare_toolchain
-.
-.macro emit_step_cpuflag_determination(configuration, repository)
-. define my.config = emit_step_cpuflag_determination.configuration
-. define my.repository = emit_step_cpuflag_determination.repository
-.
-. define my.sse41 = defined(my.config.cmake) ?? "-Denable-sse41=on" ? "--enable-sse41"
-. define my.avx2 = defined(my.config.cmake) ?? "-Denable-avx2=on" ? "--enable-avx2"
-. define my.avx512 = defined(my.config.cmake) ?? "-Denable-avx512=on" ? "--enable-avx512"
-. define my.shani = defined(my.config.cmake) ?? "-Denable-shani=on" ? "--enable-shani"
-.
- - name: Determine CPU flags
- shell: bash
- run: |
- if [[ -n \$(cat /proc/cpuinfo | grep flags | grep " sse4_1 ") ]]; then
- echo "CPU_SUPPORT_SSE41=$(my.sse41)" >> $GITHUB_ENV
- fi
-
- if [[ -n \$(cat /proc/cpuinfo | grep flags | grep " avx " | grep " avx2 ") ]]; then
- echo "CPU_SUPPORT_AVX2=$(my.avx2)" >> $GITHUB_ENV
- fi
-
- if [[ -n \$(cat /proc/cpuinfo | grep flags | grep " avx512bw ") ]]; then
- echo "CPU_SUPPORT_AVX512=$(my.avx512)" >> $GITHUB_ENV
- fi
-
- if [[ -n \$(cat /proc/cpuinfo | grep flags | grep " sha_ni ") ]]; then
- echo "CPU_SUPPORT_SHANI=$(my.shani)" >> $GITHUB_ENV
- fi
-
- if [[ ${{ matrix.detectcpuflags }} == 'detect' ]]; then
- echo "CPU_SUPPORTED_FLAGS='$CPU_SUPPORT_SSE41 $CPU_SUPPORT_AVX2 $CPU_SUPPORT_AVX512 $CPU_SUPPORT_SHANI'" >> $GITHUB_ENV
- fi
-.endmacro # emit_step_cpuflag_determination
-.
-.macro emit_step_display_environment(configuration, repository)
-. define my.config = emit_step_display_environment.configuration
-. define my.repository = emit_step_display_environment.repository
-.
- - name: Display Compiler details
- shell: bash
- run: |
- ${CC} -v
- ${CXX} -v
-
- - name: Display CPU details
- if: ${{ (runner.os == 'Linux') }}
- shell: bash
- run: |
- lscpu
-.endmacro # emit_step_display_environment
-.
-.macro emit_step_parameter_denormalization(configuration, repository)
-. define my.config = emit_step_parameter_denormalization.configuration
-. define my.repository = emit_step_parameter_denormalization.repository
-.
- - name: Denormalize parameterization
- shell: bash
- run: |
- WORKSPACE_SUBPATH="${GITHUB_WORKSPACE%$(my.repository.name)}"
- echo "LIBBITCOIN_SRC_PATH=${WORKSPACE_SUBPATH}" >> $GITHUB_ENV
-. # cmake library path
-. if defined(my.config.cmake)
- if [[ ${{ matrix.packager }} == 'brew' ]]; then
- echo "CMAKE_LIBRARY_PATH=/usr/local/lib" >> $GITHUB_ENV
- fi
-. endif
-. # assert (ndebug)
- if [[ ${{ matrix.assert }} == 'ndebug' ]]; then
- echo "ASSERT_NDEBUG=--enable-ndebug" >> $GITHUB_ENV
- else
- echo "ASSERT_NDEBUG=--disable-ndebug" >> $GITHUB_ENV
- fi
-. # link
- if [[ ${{ matrix.link }} == 'dynamic' ]]; then
- echo "LINKAGE=--disable-static" >> $GITHUB_ENV
- else
- echo "LINKAGE=--disable-shared" >> $GITHUB_ENV
- fi
-.# # compiler flags
-.# if [[ ${{ matrix.optimization }} == 'debug' ]]; then
-.# echo "CFLAGS='${{ env.CFLAGS }} -Og'" >> $GITHUB_ENV
-.# echo "CXXFLAGS='${{ env.CXXFLAGS }} -Og'" >> $GITHUB_ENV
-.# else if [[ ${{ matrix.optimization }} == 'size' ]]; then
-.# echo "CFLAGS='${{ env.CFLAGS }} -Os'" >> $GITHUB_ENV
-.# echo "CXXFLAGS='${{ env.CXXFLAGS }} -Os'" >> $GITHUB_ENV
-.# fi
-.# if [[ ${{ matrix.coverage }} == 'true' ]]; then
-.# echo "CFLAGS='${{ env.CFLAGS }} -g --coverage" >> $GITHUB_ENV
-.# echo "CXXFLAGS='${{ env.CXXFLAGS }} -g --coverage" >> $GITHUB_ENV
-.# fi
-. # linker flags
- if [[ ${{ matrix.link }} == 'dynamic' ]]; then
-. if (defined(my.config.use_preset))
- echo "LDFLAGS=-Wl,-rpath,${WORKSPACE_SUBPATH}prefix/${{ matrix.preset }}/lib" >> $GITHUB_ENV
-. else
- echo "LDFLAGS=-Wl,-rpath,${WORKSPACE_SUBPATH}prefix/lib" >> $GITHUB_ENV
-. endif
- fi
-.
-.endmacro # emit_step_parameter_denormalization
-.
-.macro emit_step_execute_shell(configuration, ci)
-. define my.config = emit_step_execute_shell.configuration
-. define my.ci = emit_step_execute_shell.ci
-. define my.suffix = defined(my.config.suffix) ?? "-$(my.config.suffix).sh" ? ".sh"
- - name: Execute install$(my.suffix)
- run: >
-. if (defined(my.ci.hackinclude))
-. define my.variable = defined(my.config.cmake) ?? "CXXFLAGS" ? "CPPFLAGS"
- CXXFLAGS="${CXXFLAGS} -I${{ env.LIBBITCOIN_SRC_PATH }}prefix/$(my.ci.hackinclude)" ./install$(my.suffix)
-. else
- ./install$(my.suffix)
-. endif
- --build-dir=${{ env.LIBBITCOIN_SRC_PATH }} ${{ matrix.options }}
-. if (defined(my.config.use_preset))
- --prefix=${{ env.LIBBITCOIN_SRC_PATH }}prefix/${{ matrix.preset }}
- --preset=${{ matrix.preset }}
-. else
- --prefix=${{ env.LIBBITCOIN_SRC_PATH }}prefix
-. endif
- ${{ env.LINKAGE }}
- ${{ env.ASSERT_NDEBUG }}
- ${{ env.CPU_SUPPORTED_FLAGS }}
-. for my.ci.axis as _axis where (defined(_axis.param) & (_axis.param = "true"))
- ${{ matrix.$(_axis.name) }}
-. endfor
-.endmacro # emit_step_execute_shell
-.
-.macro emit_step_calculate_coverage(configuration, ci)
-. define my.config = emit_step_calculate_coverage.configuration
-. define my.ci = emit_step_calculate_coverage.ci
-. define my.exclusions = get_coverage_exclusions(my.ci)
-.
- - name: Coveralls Calculation
- if: ${{ matrix.coverage == 'cov' }}
- run: |
- lcov --ignore-errors version,gcov,mismatch,mismatch --directory . --capture --output-file coverage.info
- lcov --ignore-errors unused --remove coverage.info $(my.exclusions) --output-file coverage.info
- lcov --list coverage.info
-
- - name: Coveralls.io Upload
- if: ${{ matrix.coverage == 'cov' }}
- uses: coverallsapp/github-action@v2.3.0
- with:
- format: lcov
- files: "./coverage.info"
- github-token: ${{ secrets.github_token }}
-.
-.endmacro # emit_step_calculate_coverage
-.
-.macro emit_step_failure_output(configuration)
-. define my.config = emit_step_failure_output.configuration
-.
- - name: Failure display available binaries
- if: ${{ failure() }}
- run: |
- ls -la /usr/bin
-
- - name: Failure display selected compiler version
- if: ${{ failure() }}
- run: |
- ${CC} -v
- ${CXX} -v
-
- - name: Failure display default compiler version
- if: ${{ failure() }}
- run: |
- clang -v
- gcc -v
-
- - name: Failure display env
- if: ${{ failure() }}
- run: |
- env
-
- - name: Failure list libdir
- if: ${{ failure() }}
- run: |
- ls -la ${{ env.LIBBITCOIN_SRC_PATH }}prefix/lib
-
- - name: Failure display boost bootstrap.log [--build-boost]
- if: ${{ failure() && (matrix.boost == '--build-boost') }}
- run: |
- cat ${{ github.workspace }}/build/build-*/bootstrap.log
-
-
- - name: Failure display otool output
- if: ${{ failure() && startsWith(matrix.os, 'macos') }}
- run: |
- otool -L ${{ github.workspace }}/test/.libs/$(_repository.name)-test
-
- - name: Failure display DYLD_PRINT_LIBRARIES
- if: ${{ failure() && startsWith(matrix.os, 'macos') }}
- run: |
- DYLD_PRINT_LIBRARIES=1 ${{ github.workspace }}/test/.libs/$(_repository.name)-test
-
- - name: Failure display pkgconfig
- if: ${{ failure() }}
- run: |
- ls ${{ env.LIBBITCOIN_SRC_PATH }}prefix/lib/pkgconfig/
- cat ${{ env.LIBBITCOIN_SRC_PATH }}prefix/lib/pkgconfig/*.pc
-.
-. if (defined(my.config.cmake))
-
- - name: Failure display cmake specific libraries
- if: ${{ failure() }}
- run: |
- ls ${{ env.LIBBITCOIN_SRC_PATH }}prefix/lib/cmake
-
- - name: Failure display cmake LastTest.log
- if: ${{ failure() }}
- run: |
- cat ${{ github.workspace }}/Testing/Temporary/LastTest.log
-. endif
-.
-.endmacro # emit_step_failure_output
-.
-.macro emit_job_shell(configuration, integration, repository, ci)
-. define my.config = emit_job_shell.configuration
-. define my.integration = emit_job_shell.integration
-. define my.repository = emit_job_shell.repository
-. define my.ci = emit_job_shell.ci
-.
- $(my.config.job):
-
- strategy:
- fail-fast: false
-
-. initialize_matrix_shell(my.config, my.integration, my.repository, my.ci)
-
- runs-on: ${{ matrix.os }}
-
- env:
- CC: '${{ matrix.cc }}'
- CXX: '${{ matrix.cxx }}'
- CFLAGS: '${{ matrix.flags }}'
- CXXFLAGS: '${{ matrix.flags }}'
- CI_REPOSITORY: '${{ github.repository }}'
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v6
-
-. emit_step_prepare_toolchain(my.config)
-
-. emit_step_cpuflag_determination(my.config, my.repository)
-
-. emit_step_parameter_denormalization(my.config, my.repository)
-
-. emit_step_display_environment(my.config, my.repository)
-
-. emit_step_execute_shell(_config, my.ci)
-
-. emit_step_calculate_coverage(_config, my.ci)
-
-. emit_step_failure_output(_config)
-.
-.endmacro # emit_job_shell
-.
-.macro emit_job_msbuild(repository, ci)
-. define my.repository = emit_job_msbuild.repository
-. define my.ci = emit_job_msbuild.ci
-.
- msbuild:
- strategy:
- fail-fast: false
-
-. initialize_matrix_msbuild(my.repository, my.ci)
-.
- runs-on: ${{ matrix.os }}
-
- steps:
- - name: Add msbuild to PATH
- uses: microsoft/setup-msbuild@v3
- with:
- msbuild-architecture: x64
-
- - name: Checkout repository
- uses: actions/checkout@v6
-
- - name: Initialize SDK
- shell: powershell
- run: |
- try {
- Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?LinkId=323507" -OutFile "sdksetup.exe"
-
- $FeatureList = "OptionId.WindowsDesktopSoftwareDevelopmentKit OptionId.NetFxSoftwareDevelopmentKit"
- $Args = "/q /norestart /features $FeatureList"
- $setup = Start-Process -PassThru -FilePath "sdksetup.exe" -ArgumentList $Args
-
- $setup.WaitForExit()
- if ($setup.ExitCode -ne 0) {
- Write-Host "Test execution failure: " $setup.ExitCode -ForegroundColor Red;
- exit $setup.ExitCode;
- }
- }
- catch {
- $ERR = $_;
- Write-Host "Initialization failure: " $ERR -ForegroundColor Red;
- exit $ERR;
- }
-
- - name: Execute build
- run: .\\build.cmd .. ${{ matrix.platform }} ${{ matrix.configuration }} x64 ${{ matrix.version }}
-
- - name: Execute tests
- shell: powershell
- run: |
- Write-Host "Locating test executables..." -ForegroundColor Yellow;
- $BC_TEST_EXES = @(Get-ChildItem -Path "$env:${{ github.workspace }}\\bin" -recurse | Where-Object { $_.Name -eq "$(my.repository.name)-test.exe" });
- If ($BC_TEST_EXES.Count -ne 1) {
- Write-Host "Failure, invalid count of test executables." -ForegroundColor Red;
- exit 1;
- }
- Write-Host "Found single test executable: " $BC_TEST_EXES.FullName -ForegroundColor Green;
- $BC_TEST_SINGLETON = $BC_TEST_EXES.FullName;
- Write-Host "Executing $BC_TEST_SINGLETON $env:BOOST_UNIT_TEST_OPTIONS" -ForegroundColor Yellow;
- try {
- Invoke-Expression "$BC_TEST_SINGLETON --log_level=warning --run_test=${{ matrix.tests }} $env:BOOST_UNIT_TEST_OPTIONS"
- }
- catch {
- $ERR = $_;
- Write-Host "Test execution failure: " $ERR -ForegroundColor Red;
- exit $ERR;
- }
- Write-Host "Test execution complete." -ForegroundColor Green;
-.endmacro # emit_job_msbuild
-.
-.endtemplate
-.template 0
-###############################################################################
-# Generation
-###############################################################################
-.endtemplate
-.template 1
-.macro generate_ci_yml(path_prefix)
-.define my.integration = generate->integration
-.if (!defined(my.integration))
-. abort "FATAL no integration."
-.endif
-.for generate.repository by name as _repository
-. require(_repository, "repository", "name")
-. if (defined(_repository->ci))
-. my.absolute_path = join(join(global.root, my.path_prefix), _repository.name)
-. my.output_path = workflow_relative_path(_repository, my.path_prefix)
-. create_directory(my.output_path)
-. define my.out_file = "$(my.output_path)/ci.yml"
-. notify(my.out_file)
-. output(my.out_file)
-. copyleft(_repository.name)
-
-name: Continuous Integration Build
-
-on: [ pull_request, push, workflow_dispatch ]
-
-jobs:
-. if (has_jobs_autotools(_repository->ci))
-. new configuration as _config
-. _config.job = "autotools"
-. _config.accept_all = "true"
-. _config.auto = "true"
-. emit_job_shell(_config, my.integration, _repository, _repository->ci)
-. endnew _config
-. endif
-.
-. if (has_jobs_autotools(_repository->ci) & has_jobs_cmake(_repository->ci))
-. write_line("")
-. endif
-.
-. if (has_jobs_cmake(_repository->ci))
-. new configuration as _config
-. _config.job = "cmake"
-. _config.accept_all = "true"
-. _config.cmake = "true"
-. _config.suffix = "cmake"
-. emit_job_shell(_config, my.integration, _repository, _repository->ci)
-. endnew _config
-. endif
-.
-. if ((has_jobs_autotools(_repository->ci) | \
- has_jobs_cmake(_repository->ci)) & has_jobs_presets(_repository->ci))
-. write_line("")
-. endif
-.
-. if (has_jobs_presets(_repository->ci))
-. new configuration as _config
-. _config.job = "preset"
-. _config.accept_all = "true"
-. _config.job_require = "preset"
-. _config.cmake = "true"
-. _config.use_preset = "true"
-. _config.suffix = "cmakepresets"
-. emit_job_shell(_config, my.integration, _repository, _repository->ci)
-. endnew _config
-. endif
-.
-. if ((has_jobs_autotools(_repository->ci) | \
- has_jobs_cmake(_repository->ci) | \
- has_jobs_presets(_repository->ci)) & has_jobs_msbuild(_repository->ci))
-. write_line("")
-. endif
-.
-. if (has_jobs_msbuild(_repository->ci))
-. emit_job_msbuild(_repository, _repository->ci)
-. endif
-.
-. close
-. endif
-.endfor _repository
-.endmacro # generate_ci_yml
-.endtemplate
-.template 0
-###############################################################################
-# Execution
-###############################################################################
-[global].root = ".."
-[global].trace = 0
-[gsl].ignorecase = 0
-
-# Note: expected context root libbitcoin-build directory
-gsl from "library/math.gsl"
-gsl from "library/string.gsl"
-gsl from "library/collections.gsl"
-gsl from "utilities.gsl"
-
-generate_ci_yml("output")
-
-.endtemplate
diff --git a/templates/gsl.install-cmake.sh b/templates/gsl.install-cmake.sh
deleted file mode 100644
index c5591dd0..00000000
--- a/templates/gsl.install-cmake.sh
+++ /dev/null
@@ -1,539 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate install-cmake.sh.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Functions
-###############################################################################
-
-function test_perform_sync()
- return "true"
-endfunction
-
-function test_perform_configure()
- return "true"
-endfunction
-
-function test_perform_build()
- return "true"
-endfunction
-
-function test_produce_dependencies()
- return "true"
-endfunction
-
-function test_produce_libbitcoin()
- return "true"
-endfunction
-
-function test_produce_project()
- return "true"
-endfunction
-
-###############################################################################
-# Macros
-###############################################################################
-.endtemplate
-.template 1
-.
-.macro custom_help(repository, install, script_name)
- display_message " --build-dir= Location of downloaded and intermediate files."
-.endmacro # custom_help
-.
-.macro custom_documentation(repository, install)
-# --build-dir= Location of downloaded and intermediate files.
-.endmacro # custom_documentation
-.
-.macro custom_configuration(repository, install)
- display_message "BUILD_SRC_DIR : $BUILD_SRC_DIR"
- display_message "CUMULATIVE_FILTERED_ARGS : $CUMULATIVE_FILTERED_ARGS"
- display_message "CUMULATIVE_FILTERED_ARGS_CMAKE : $CUMULATIVE_FILTERED_ARGS_CMAKE"
-.endmacro # custom_configuration
-.
-.macro custom_script_options()
- # Unique script options.
- (--build-dir=*) BUILD_SRC_DIR="${OPTION#*=}";;
-
- # Handle ndebug declarations due to disabled argument passthrough
- (--enable-ndebug) ENABLE_NDEBUG="yes";;
- (--disable-ndebug) DISABLE_NDEBUG="yes";;
-
-.endmacro # custom_script_options
-.
-.macro define_build_variables_custom(repository)
-. define my.repo = define_build_variables_custom.repository
-. heading2("The default build directory.")
-BUILD_SRC_DIR="build-$(my.repo.name)"
-
-PRESUMED_CI_PROJECT_PATH=\$(pwd)
-
-.endmacro # define_build_variables_custom
-.
-.macro define_handle_custom_options(install)
-. define my.install = define_handle_custom_options.install
-handle_custom_options()
-{
- CUMULATIVE_FILTERED_ARGS=""
- CUMULATIVE_FILTERED_ARGS_CMAKE=""
-
- if [[ $ENABLE_NDEBUG && $DISABLE_NDEBUG ]]; then
- display_error "--enable-ndebug and --disable-ndebug are mutually exclusive options."
- display_error ""
- exit 1
- elif [[ $DISABLE_NDEBUG ]]; then
- CUMULATIVE_FILTERED_ARGS="--disable-ndebug"
- CUMULATIVE_FILTERED_ARGS_CMAKE="-DCMAKE_BUILD_TYPE=Debug"
- else
- CUMULATIVE_FILTERED_ARGS="--enable-ndebug"
- CUMULATIVE_FILTERED_ARGS_CMAKE="-DCMAKE_BUILD_TYPE=Release"
- fi
-
- # Process link declaration
- if [[ $DISABLE_SHARED ]]; then
- CUMULATIVE_FILTERED_ARGS+=" --enable-static --disable-shared"
- CUMULATIVE_FILTERED_ARGS_CMAKE+=" -DBUILD_SHARED_LIBS=FALSE"
- elif [[ $DISABLE_STATIC ]]; then
- CUMULATIVE_FILTERED_ARGS+=" --disable-static --enable-shared"
- CUMULATIVE_FILTERED_ARGS_CMAKE+=" -DBUILD_SHARED_LIBS=TRUE"
- fi
-
- # Process prefix
- if [[ ($PREFIX) ]]; then
- CUMULATIVE_FILTERED_ARGS+=" --prefix=\"${PREFIX}\""
- CUMULATIVE_FILTERED_ARGS_CMAKE+=" -DCMAKE_PREFIX_PATH=\"${PREFIX}\" -DCMAKE_INSTALL_PREFIX=\"${PREFIX}\""
-
- if [ -z $CMAKE_INCLUDE_PATH ]; then
- export CMAKE_INCLUDE_PATH="${PREFIX}/include"
- else
- export CMAKE_INCLUDE_PATH="${PREFIX}/include:${CMAKE_INCLUDE_PATH}"
- fi
-
- if [ -z $CMAKE_LIBRARY_PATH ]; then
- export CMAKE_LIBRARY_PATH="${PREFIX}/lib"
- else
- export CMAKE_LIBRARY_PATH="${PREFIX}/lib:${CMAKE_LIBRARY_PATH}"
- fi
- fi
-.
-. if (have_build(my.install, "bitcoin-consensus"))
-
- # Process Consensus
- if [[ $WITH_BITCOIN_CONSENSUS = "yes" ]]; then
- CUMULATIVE_FILTERED_ARGS+=" --with-consensus"
- CUMULATIVE_FILTERED_ARGS_CMAKE+=" -Dwith-consensus=yes"
- else
- CUMULATIVE_FILTERED_ARGS+=" --without-consensus"
- CUMULATIVE_FILTERED_ARGS_CMAKE+=" -Dwith-consensus=no"
- fi
-. endif
-. if (have_build(my.install, "icu"))
-
- # Process ICU
- if [[ $WITH_ICU ]]; then
- CUMULATIVE_FILTERED_ARGS+=" --with-icu"
- CUMULATIVE_FILTERED_ARGS_CMAKE+=" -Dwith-icu=yes"
- fi
-. endif
-.
-}
-
-.endmacro # define_handle_custom_options()
-.
-.macro define_remove_install_options()
-remove_install_options()
-{
- # Purge installer handled options other than --build-.
- CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--with-*/}")
- CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--without-*/}")
- CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--enable-*/}")
- CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--disable-*/}")
- CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--prefix=*/}")
- CONFIGURE_OPTIONS=("${CONFIGURE_OPTIONS[@]/--verbose=*/}")
-}
-
-.endmacro # define_remove_install_options()
-.
-.macro define_configure_options()
-configure_options()
-{
- display_message "configure options:"
- for OPTION in "$@"; do
- if [[ $OPTION ]]; then
- display_message "$OPTION"
- fi
- done
-
- ./configure "$@"
-}
-
-.endmacro # define_configure_options
-.
-.macro define_make_project_directory()
-# make_project_directory project_name jobs [configure_options]
-make_project_directory()
-{
- local PROJ_NAME=$1
- local JOBS=$2
- local TEST=$3
- shift 3
-
- push_directory "$PROJ_NAME"
- local PROJ_CONFIG_DIR
- PROJ_CONFIG_DIR=\$(pwd)
-
- ./autogen.sh
-
- configure_options "$@"
- make_jobs "$JOBS"
-
- if [[ $TEST == true ]]; then
- make_tests "$JOBS"
- fi
-
- make install
- configure_links
- pop_directory
-}
-
-.endmacro # define_make_project_directory
-.
-.macro define_cmake_analogous_functions()
-cmake_tests()
-{
- local JOBS=$1
-
- disable_exit_on_error
-
- # Build and run unit tests relative to the primary directory.
- # VERBOSE=1 ensures test runner output sent to console (gcc).
- make -j"$JOBS" test "VERBOSE=1"
- local RESULT=$?
-
- # Test runners emit to the test.log file.
- if [[ -e "test.log" ]]; then
- cat "test.log"
- fi
-
- if [[ $RESULT -ne 0 ]]; then
- exit $RESULT
- fi
-
- enable_exit_on_error
-}
-
-cmake_project_directory()
-{
- local PROJ_NAME=$1
- local CMAKE_PATH=$2
- local JOBS=$3
- local TEST=$4
- shift 4
-
- push_directory "$PROJ_NAME"
- local PROJ_CONFIG_DIR
- PROJ_CONFIG_DIR=\$(pwd)
-
- create_directory "build-cmake"
- push_directory "build-cmake"
-
- VERBOSITY=""
- if [[ $DISPLAY_VERBOSE ]]; then
- VERBOSITY="-DCMAKE_VERBOSE_MAKEFILE=ON"
- fi
-
- cmake ${VERBOSITY} -LA $@ "../${CMAKE_PATH}"
-
- make_jobs "$JOBS"
-
- if [[ $TEST == true ]]; then
- cmake_tests "$JOBS"
- fi
-
- make install
- configure_links
- pop_directory # build-cmake
- pop_directory # PROJ_NAME
-}
-
-build_from_github_cmake()
-{
- local REPO=$1
- local CMAKE_PATH=$2
- local JOBS=$3
- local TEST=$4
- local BUILD=$5
- local OPTIONS=$6
- shift 6
-
- if [[ ! ($BUILD) || ($BUILD == "no") ]]; then
- return
- fi
-
- # Join generated and command line options.
- local CONFIGURATION=("${OPTIONS[@]}" "$@")
-
- display_heading_message "Preparing to build $REPO"
-
- # Build the local repository clone.
- cmake_project_directory "$REPO" "$CMAKE_PATH" "$JOBS" "$TEST" "${CONFIGURATION[@]}"
-}
-
-.endmacro # define_cmake_analogous_functions
-.
-.macro define_make_jobs()
-# make_jobs jobs [make_options]
-make_jobs()
-{
- local JOBS=$1
- shift 1
-
- VERBOSITY=""
- if [[ $DISPLAY_VERBOSE ]]; then
- VERBOSITY="VERBOSE=1"
- fi
-
- SEQUENTIAL=1
- # Avoid setting -j1 (causes problems on single threaded systems [TRAVIS]).
- if [[ $JOBS -gt $SEQUENTIAL ]]; then
- make -j"$JOBS" "$@" $VERBOSITY
- else
- make "$@" $VERBOSITY
- fi
-}
-
-.endmacro # define_make_jobs
-.
-.macro define_utility_functions()
-. define_configure_links()
-. define_configure_options("true")
-. define_create_directory("true")
-. define_display_functions()
-. define_initialize_git()
-. define_make_project_directory()
-. define_make_jobs()
-. define_make_tests("false")
-. define_push_pop_directory()
-. define_enable_exit_on_error()
-. define_disable_exit_on_error()
-.endmacro # define_utility_functions
-.
-.macro define_build_functions(install)
-. define my.install = define_build_functions.install
-. define_tarball_functions("false", "true")
-. define_github_functions()
-. define_cmake_analogous_functions()
-. if (count(my.install.build, count.name = "boost") > 0)
-. define my.build = my.install->build(name = "boost")
-. define_boost_build_functions(my.build)
-. endif
-.endmacro # define_build_functions
-.
-.macro build_boost()
- unpack_from_tarball "$BOOST_ARCHIVE" "$BOOST_URL" bzip2 "$BUILD_BOOST"
- local SAVE_CPPFLAGS="$CPPFLAGS"
- export CPPFLAGS="$CPPFLAGS ${BOOST_FLAGS[@]}"
- build_from_tarball_boost "$BOOST_ARCHIVE" "$PARALLEL" "$BUILD_BOOST" "${BOOST_OPTIONS[@]}"
- export CPPFLAGS=$SAVE_CPPFLAGS
-.endmacro # build_boost
-.
-.macro build_github(build)
-. define my.build = build_github.build
-. define my.parallel = is_true(my.build.parallel) ?? "$PARALLEL" ? "$SEQUENTIAL"
-. define my.conditional = is_true(my.build.conditional) ?? "$$(get_build_conditional_variable(my.build))" ? "yes"
-. define my.flags = "${$(my.build.name:upper,c)_FLAGS[@]}"
-. define my.options = "${$(my.build.name:upper,c)_OPTIONS[@]}"
-. define my.branch = "${$(my.build.name:upper,c)_BRANCH}"
- create_from_github $(my.build.github) $(my.build.repository) $(my.branch) "$(my.conditional)"
- local SAVE_CPPFLAGS="$CPPFLAGS"
- export CPPFLAGS="$CPPFLAGS $(my.flags)"
-. if (is_buildable_cmake(my.build))
- build_from_github_cmake $(my.build.repository) "$(my.build.cmake)" "$(my.parallel)" false "$(my.conditional)" "$(my.options)" $CUMULATIVE_FILTERED_ARGS_CMAKE "$@"
-. else
- build_from_github $(my.build.repository) "$(my.parallel)" false "$(my.conditional)" "$(my.options)" $CUMULATIVE_FILTERED_ARGS
-. endif
- export CPPFLAGS=$SAVE_CPPFLAGS
-.endmacro # build_github
-.
-.macro build_github_cmake(build)
-. define my.build = build_github_cmake.build
-. define my.parallel = is_true(my.build.parallel) ?? "$PARALLEL" ? "$SEQUENTIAL"
-. define my.conditional = get_conditional_parameter(my.build)
-. define my.flags = "${$(my.build.name:upper,c)_FLAGS[@]}"
-. define my.options = "${$(my.build.name:upper,c)_OPTIONS[@]}"
-. define my.branch = "${$(my.build.name:upper,c)_BRANCH}"
- create_from_github $(my.build.github) $(my.build.repository) $(my.branch) "$(my.conditional)"
- local SAVE_CPPFLAGS="$CPPFLAGS"
- export CPPFLAGS="$CPPFLAGS $(my.flags)"
- build_from_github_cmake $(my.build.repository) "$(my.build.cmake)" "$(my.parallel)" false "$(my.conditional)" "$(my.options)" $CUMULATIVE_FILTERED_ARGS_CMAKE "$@"
- export CPPFLAGS=$SAVE_CPPFLAGS
-.endmacro # build_github_cmake
-.
-.macro build_ci(build)
-. define my.build = build_ci.build
-. define my.parallel = is_true(my.build.parallel) ?? "$PARALLEL" ? "$SEQUENTIAL"
-. define my.conditional = get_conditional_parameter(my.build)
-. define my.flags = "${$(my.build.name:upper,c)_FLAGS[@]}"
-. define my.options = "${$(my.build.name:upper,c)_OPTIONS[@]}"
-. define my.branch = "${$(my.build.name:upper,c)_BRANCH}"
-.
-. if !is_buildable_cmake(my.build)
-. abort "Expected cmake build step '$(my.build.name)'."
-. endif
- local SAVE_CPPFLAGS="$CPPFLAGS"
- export CPPFLAGS="$CPPFLAGS $(my.flags)"
- if [[ ! ($CI == true) ]]; then
- create_from_github $(my.build.github) $(my.build.repository) $(my.branch) "$(my.conditional)"
- build_from_github_cmake $(my.build.repository) "$(my.build.cmake)" "$(my.parallel)" true "$(my.conditional)" "$(my.options)" $CUMULATIVE_FILTERED_ARGS_CMAKE "$@"
- else
- push_directory "$PRESUMED_CI_PROJECT_PATH"
- push_directory ".."
- build_from_github_cmake $(my.build.repository) "$(my.build.cmake)" "$(my.parallel)" true "$(my.conditional)" "$(my.options)" $CUMULATIVE_FILTERED_ARGS_CMAKE "$@"
- pop_directory
- pop_directory
- fi
- export CPPFLAGS=$SAVE_CPPFLAGS
-.endmacro # build_ci
-.
-.macro define_build_all(install)
-. define my.install = define_build_all.install
-build_all()
-{
-. for my.install.build as _build
-. # Unique by build.name
-. if !defined(my.build_$(_build.name:c))
-. define my.build_$(_build.name:c) = 0
-.
-. if (is_boost_build(_build))
-. build_boost()
-. elsif (is_github_build(_build))
-. if (!last())
-. build_github(_build)
-. else
-. build_ci(_build)
-. endif
-. else
-. abort "Invalid build type: $(_build.name)."
-. endif
-.
-. endif
-. endfor _build
-}
-
-.endmacro # define_build_all
-.
-.macro define_invoke()
-display_configuration
-
-if [[ ! ($CI == true) ]]; then
- create_directory "$BUILD_SRC_DIR"
- push_directory "$BUILD_SRC_DIR"
-else
- push_directory "$BUILD_SRC_DIR"
-fi
-
-initialize_git
-time build_all "${CONFIGURE_OPTIONS[@]}"
-pop_directory
-.endmacro # define_invoke
-.
-.endtemplate
-.template 0
-###############################################################################
-# Generation
-###############################################################################
-function generate_installer_cmake(path_prefix)
- define my.integration = generate->integration
- for generate.repository by name as _repository
- require(_repository, "repository", "name")
- my.output_path = join(my.path_prefix, canonical_path_name(_repository))
- define my.out_file = "$(my.output_path)/install-cmake.sh"
- create_directory(my.output_path)
- notify(my.out_file)
- output(my.out_file)
-
- new configuration as _config
- new install as _install
- _config.cmake = "true"
- cumulative_install(_install, generate, _repository)
-
- shebang("bash")
-
- copyleft(_repository.name)
- documentation(_repository, _install)
-
- heading1("Define constants.")
- define_github_branches(_install)
- define_build_variables(_repository)
- define_boost(_install)
-
- heading1("Define utility functions.")
- define_utility_functions()
- define_help(_repository, _install, "install")
-
- heading1("Define environment initialization functions")
- define_parse_command_line_options(_repository, _install)
- define_handle_help_line_option()
- define_set_operating_system()
- define_parallelism()
- define_set_os_specific_compiler_settings(my.integration)
- define_link_to_standard_library()
- define_normalized_configure_options()
- define_handle_custom_options(_install)
- define_remove_build_options()
- define_remove_install_options()
- define_set_prefix()
- define_set_pkgconfigdir(_config)
- define_set_with_boost_prefix(_config)
- define_display_configuration(_repository, _install)
-
- heading1("Define build functions.")
- define_build_functions(_install)
-
- heading1("The master build function.")
- define_build_all(_install)
-
- heading1("Initialize the build environment.")
- define_initialization_calls()
- write_line("remove_install_options")
-
- heading1("Define build flags.")
- for _install.build as _build where count(_build.flag) > 0
- define_build_flags(_config, _build)
- endfor _build
-
- heading1("Define build options.")
- for _install.build as _build where count(_build.option) > 0
- define_build_options(_config, _build)
- endfor _build
-
- heading1("Build the primary library and all dependencies.")
- define_invoke()
-
- endnew _install
- endnew _config
- close
- endfor _repository
-endfunction # generate_installer_cmake
-.endtemplate
-.template 0
-###############################################################################
-# Execution
-###############################################################################
-[global].root = ".."
-[global].trace = 0
-[gsl].ignorecase = 0
-
-# Note: expected context root libbitcoin-build directory
-gsl from "library/math.gsl"
-gsl from "library/string.gsl"
-gsl from "library/collections.gsl"
-gsl from "utilities.gsl"
-gsl from "templates/shared/common_install_shell_artifacts.gsl"
-
-generate_installer_cmake("output")
-
-.endtemplate
diff --git a/templates/gsl.install-cmakepresets.sh b/templates/gsl.install-cmakepresets.sh
deleted file mode 100644
index 17eca1fa..00000000
--- a/templates/gsl.install-cmakepresets.sh
+++ /dev/null
@@ -1,653 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate install-cmakepresets.sh.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Functions
-###############################################################################
-
-function test_perform_sync()
- return "true"
-endfunction
-
-function test_perform_configure()
- return "true"
-endfunction
-
-function test_perform_build()
- return "true"
-endfunction
-
-function test_produce_dependencies()
- return "true"
-endfunction
-
-function test_produce_libbitcoin()
- return "true"
-endfunction
-
-function test_produce_project()
- return "true"
-endfunction
-
-###############################################################################
-# Macros
-###############################################################################
-.endtemplate
-.template 1
-.
-.macro define_custom_build_variables(repository)
-. define my.repository = define_custom_build_variables.repository
-.
-
-. heading2("Declare associative array for computed presets.")
-declare -A REPO_PRESET
-
-.endmacro # define_custom_build_variables
-.
-.macro custom_help(repository, install, script_name)
- display_message " --build-dir= Location of downloaded and intermediate files."
- display_message " --preset=