handle the default build dir to be relative to the source dir

This commit is contained in:
Alfi Maulana
2023-01-22 11:23:52 +07:00
parent 186353f77a
commit 584ef59aad
2 changed files with 15 additions and 10 deletions

View File

@@ -11,7 +11,6 @@ inputs:
build-dir:
description: Build directory of the CMake project
required: false
default: build
targets:
description: List of build targets
required: false
@@ -44,8 +43,14 @@ runs:
if [ -n '${{ inputs.source-dir }}' ]; then
SOURCE_DIR="${{ inputs.source-dir }}"
fi
ARGS="'$SOURCE_DIR' -B '${{ inputs.build-dir }}'"
BUILD_ARGS="--build '${{ inputs.build-dir }}'"
BUILD_DIR="build"
if [ -n '${{ inputs.build-dir }}' ]; then
BUILD_DIR="${{ inputs.build-dir }}"
elif [ -n "${{ inputs.source-dir }}" ]; then
BUILD_DIR="${{ inputs.source-dir }}/build"
fi
ARGS="'$SOURCE_DIR' -B '$BUILD_DIR'"
BUILD_ARGS="--build '$BUILD_DIR'"
if [ -n '${{ inputs.targets }}' ]; then
BUILD_ARGS="$BUILD_ARGS --target ${{ inputs.targets }}"
fi