mirror of
https://github.com/threeal/cmake-action.git
synced 2025-06-09 10:41:22 +00:00
Merge pull request #5 from threeal/add-build-dir-input
Add `build-dir` Input Option
This commit is contained in:
commit
9a981cb2b1
18
.github/workflows/test.yml
vendored
18
.github/workflows/test.yml
vendored
@ -31,3 +31,21 @@ jobs:
|
|||||||
|
|
||||||
- name: Run build result
|
- name: Run build result
|
||||||
run: ./build/hello_world
|
run: ./build/hello_world
|
||||||
|
|
||||||
|
use-action-with-specified-build-dir:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3.3.0
|
||||||
|
|
||||||
|
- name: Use this action with specified build directory
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
source-dir: test
|
||||||
|
build-dir: test/build
|
||||||
|
|
||||||
|
- name: Run build result
|
||||||
|
run: test/build/hello_world
|
||||||
|
|
||||||
|
- name: Check if default build directory is not exist
|
||||||
|
run: test ! -d build
|
||||||
|
10
action.yml
10
action.yml
@ -9,14 +9,20 @@ inputs:
|
|||||||
description: The source directory of CMake project
|
description: The source directory of CMake project
|
||||||
required: false
|
required: false
|
||||||
default: .
|
default: .
|
||||||
|
build-dir:
|
||||||
|
description: The build directory of CMake project
|
||||||
|
required: false
|
||||||
|
default: build
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- name: Process inputs
|
- name: Process inputs
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
CONFIGURE_ARGS="'${{ inputs.source-dir }}' -B build"
|
CONFIGURE_ARGS="'${{ inputs.source-dir }}' -B '${{ inputs.build-dir }}'"
|
||||||
|
BUILD_ARGS="--build '${{ inputs.build-dir }}'"
|
||||||
echo "CMAKE_CONFIGURE_ARGS=$CONFIGURE_ARGS" >> $GITHUB_ENV
|
echo "CMAKE_CONFIGURE_ARGS=$CONFIGURE_ARGS" >> $GITHUB_ENV
|
||||||
|
echo "CMAKE_BUILD_ARGS=$BUILD_ARGS" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -24,4 +30,4 @@ runs:
|
|||||||
|
|
||||||
- name: Build targets
|
- name: Build targets
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cmake --build build
|
run: cmake ${{ env.CMAKE_BUILD_ARGS }}
|
||||||
|
Loading…
Reference in New Issue
Block a user