mirror of
https://github.com/threeal/cmake-action.git
synced 2025-04-22 19:41:20 +00:00
58 lines
1.8 KiB
YAML
58 lines
1.8 KiB
YAML
name: CMake Action
|
|
description: Configure and build CMake project
|
|
author: Alfi Maulana
|
|
branding:
|
|
color: gray-dark
|
|
icon: terminal
|
|
inputs:
|
|
source-dir:
|
|
description: The source directory of CMake project
|
|
required: false
|
|
default: .
|
|
build-dir:
|
|
description: The build directory of CMake project
|
|
required: false
|
|
default: build
|
|
generator:
|
|
description: The build system generator of the CMake project
|
|
required: false
|
|
c-compiler:
|
|
description: The preferred executable for compiling C language files
|
|
required: false
|
|
cxx-compiler:
|
|
description: The preferred executable for compiling CXX language files
|
|
required: false
|
|
args:
|
|
description: Additional arguments passed during CMake configuration
|
|
required: false
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Process inputs
|
|
shell: bash
|
|
run: |
|
|
CONFIGURE_ARGS="${{ inputs.source-dir }} -B ${{ inputs.build-dir }}"
|
|
BUILD_ARGS="--build ${{ inputs.build-dir }}"
|
|
if [ -n '${{ inputs.generator }}' ]; then
|
|
CONFIGURE_ARGS="$CONFIGURE_ARGS -G ${{ inputs.generator }}"
|
|
fi
|
|
if [ -n '${{ inputs.c-compiler }}' ]; then
|
|
CONFIGURE_ARGS="$CONFIGURE_ARGS -D CMAKE_C_COMPILER=${{ inputs.c-compiler }}"
|
|
fi
|
|
if [ -n '${{ inputs.cxx-compiler }}' ]; then
|
|
CONFIGURE_ARGS="$CONFIGURE_ARGS -D CMAKE_CXX_COMPILER=${{ inputs.cxx-compiler }}"
|
|
fi
|
|
if [ -n '${{ inputs.args }}' ]; then
|
|
CONFIGURE_ARGS="$CONFIGURE_ARGS ${{ inputs.args }}"
|
|
fi
|
|
echo "CMAKE_CONFIGURE_ARGS=${CONFIGURE_ARGS//[$'\t\r\n']}" >> $GITHUB_ENV
|
|
echo "CMAKE_BUILD_ARGS=${BUILD_ARGS//[$'\t\r\n']}" >> $GITHUB_ENV
|
|
|
|
- name: Configure CMake
|
|
shell: bash
|
|
run: cmake ${{ env.CMAKE_CONFIGURE_ARGS }}
|
|
|
|
- name: Build targets
|
|
shell: bash
|
|
run: cmake ${{ env.CMAKE_BUILD_ARGS }}
|