blockchain/.github/actions/cmake-build/action.yml
2025-08-30 17:46:00 +01:00

63 lines
No EOL
2.1 KiB
YAML

# .github/actions/cmake-build/action.yml
name: 'Build Project with CMake'
description: 'Builds the project using CMake with specified options.'
inputs:
chain-network:
description: 'The network type (e.g., mainnet, testnet).'
required: true
boost-root:
description: 'The root directory of the Boost installation.'
required: true
build-type:
description: 'The CMake build type (e.g., Release, Debug).'
required: false
default: 'Release'
jobs:
description: 'Number of parallel jobs for the build.'
required: false
default: '3'
target:
description: 'The specific CMake target(s) to build.'
required: false
default: ''
build-gui:
description: 'Set to true to enable building the GUI.'
required: false
static:
description: 'Build statically.'
required: false
generator:
description: 'The CMake generator to use.'
required: false
arch:
description: 'The target architecture.'
required: false
runs:
using: "composite"
steps:
- id: set_paths
shell: bash
run: echo "build_dir_name=$(echo ${{ inputs.build-type }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Build Project
uses: threeal/cmake-action@v2.1.0
env:
CCACHE_TEMPDIR: ${{ github.workspace }}/build/ccache
OPENSSL_ROOT_DIR: ${{ github.workspace }}/build/openssl
BOOST_ROOT: ${{ inputs.boost-root }}
with:
build-dir: build/${{ steps.set_paths.outputs.build_dir_name }}
generator: ${{ inputs.generator }}
build-args: |
--parallel ${{ inputs.jobs }}
--config ${{ inputs.build-type }}
${{ inputs.target && format('--target {0}', inputs.target) }}
options: |
${{ inputs.static && 'STATIC=ON' }}
${{ inputs.chain-network == 'testnet' && 'TESTNET=ON' }}
${{ inputs.arch && format('ARCH={0}', inputs.arch) }}
CMAKE_BUILD_TYPE=${{ inputs.build-type }}
${{ inputs.build-gui && 'BUILD_GUI=ON' }}
Boost_INCLUDE_DIR=${{ inputs.boost-root }}/include
Boost_LIBRARY_DIRS=${{ inputs.boost-root }}/lib