mirror of
https://github.com/threeal/cmake-action.git
synced 2025-06-08 18:21:20 +00:00
feat: replace targets
input with the more general build-args
input
This commit is contained in:
parent
3430da8dad
commit
f1910e1a56
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@ -56,11 +56,11 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
source-dir: test
|
source-dir: test
|
||||||
targets: test_c test_cpp
|
|
||||||
c-flags: ${{ matrix.compiler == 'msvc' && '/w /WX-' || '-Wno-unused-variable' }}
|
c-flags: ${{ matrix.compiler == 'msvc' && '/w /WX-' || '-Wno-unused-variable' }}
|
||||||
cxx-flags: ${{ matrix.compiler == 'msvc' && '/w /WX-' || '-Wno-unused-variable' }}
|
cxx-flags: ${{ matrix.compiler == 'msvc' && '/w /WX-' || '-Wno-unused-variable' }}
|
||||||
args: -D CHECK_SURPASS_WARNING=ON
|
args: -D CHECK_SURPASS_WARNING=ON
|
||||||
run-build: true
|
run-build: true
|
||||||
|
build-args: --target test_c --target test_cpp
|
||||||
run-test: true
|
run-test: true
|
||||||
test-args: -R test ${{ matrix.compiler == 'msvc' && '-C Debug' || '' }}
|
test-args: -R test ${{ matrix.compiler == 'msvc' && '-C Debug' || '' }}
|
||||||
|
|
||||||
@ -77,12 +77,12 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
source-dir: test
|
source-dir: test
|
||||||
targets: test_c test_cpp
|
|
||||||
generator: Ninja
|
generator: Ninja
|
||||||
c-compiler: clang
|
c-compiler: clang
|
||||||
cxx-compiler: clang++
|
cxx-compiler: clang++
|
||||||
args: -D CHECK_USING_CLANG=ON
|
args: -D CHECK_USING_CLANG=ON
|
||||||
run-build: true
|
run-build: true
|
||||||
|
build-args: --target test_c --target test_cpp
|
||||||
run-test: true
|
run-test: true
|
||||||
test-args: -R test
|
test-args: -R test
|
||||||
|
|
||||||
|
32
README.md
32
README.md
@ -8,9 +8,9 @@ Configure, build, and test your [CMake](https://cmake.org/) project using [GitHu
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Configures a project using the [cmake](https://cmake.org/cmake/help/latest/manual/cmake.1.html) command.
|
- Configures a project using the [`cmake`](https://cmake.org/cmake/help/latest/manual/cmake.1.html) command.
|
||||||
- Option to build a project using the `cmake --build` command.
|
- Option to build a project using the `cmake --build` command.
|
||||||
- Option to test a project using the [ctest](https://cmake.org/cmake/help/latest/manual/ctest.1.html) command.
|
- Option to test a project using the [`ctest`](https://cmake.org/cmake/help/latest/manual/ctest.1.html) command.
|
||||||
- Auto-detects and installs required dependencies.
|
- Auto-detects and installs required dependencies.
|
||||||
- Supports specifying multiple CMake options directly from the Action inputs.
|
- Supports specifying multiple CMake options directly from the Action inputs.
|
||||||
|
|
||||||
@ -22,18 +22,18 @@ For more information, refer to [action.yml](./action.yml) and the [GitHub Action
|
|||||||
|
|
||||||
| Name | Value Type | Description |
|
| Name | Value Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| `source-dir` | Path | The source directory of the CMake project. Defaults to the current directory. |
|
| `source-dir` | Path | The source directory of the CMake project. It defaults to the current directory. |
|
||||||
| `build-dir` | Path | The source directory of the CMake project.. Defaults to the `build` directory inside the source directory. |
|
| `build-dir` | Path | The build directory of the CMake project. It defaults to the `build` directory inside the source directory. |
|
||||||
| `targets` | Multiple strings | A list of build targets. |
|
|
||||||
| `generator` | String | The build system generator for the CMake project. |
|
| `generator` | String | The build system generator for the CMake project. |
|
||||||
| `c-compiler` | String | The preferred executable for compiling C language files. |
|
| `c-compiler` | String | The preferred executable for compiling C language files. |
|
||||||
| `cxx-compiler` | String | The preferred executable for compiling C++ language files. |
|
| `cxx-compiler` | String | The preferred executable for compiling C++ language files. |
|
||||||
| `c-flags` | Multiple strings | Additional flags passed when compiling C language files. |
|
| `c-flags` | Multiple strings | Additional flags to pass when compiling C language files. |
|
||||||
| `cxx-flags` | Multiple strings | Additional flags passed when compiling C++ language files. |
|
| `cxx-flags` | Multiple strings | Additional flags to pass when compiling C++ language files. |
|
||||||
| `args` | Multiple strings | Additional arguments passed during the CMake configuration. |
|
| `args` | Multiple strings | Additional arguments to pass during the CMake configuration. |
|
||||||
| `run-build` | `true` or `false` | If enabled, it builds the project using [CTest](https://cmake.org/cmake/help/latest/manual/ctest.1.html). Defaults to `false`. |
|
| `run-build` | `true` or `false` | If enabled, it builds the project using [CTest](https://cmake.org/cmake/help/latest/manual/ctest.1.html). It defaults to `false`. |
|
||||||
| `run-test` | `true` or `false` | If enabled, it runs testing using [CTest](https://cmake.org/cmake/help/latest/manual/ctest.1.html). Defaults to `false`. |
|
| `build-args` | Multiple strings | Additional arguments to pass during the CMake build. |
|
||||||
| `test-args` | Multiple strings | Additional arguments passed during the CTest run. |
|
| `run-test` | `true` or `false` | If enabled, it runs testing using [CTest](https://cmake.org/cmake/help/latest/manual/ctest.1.html). It defaults to `false`. |
|
||||||
|
| `test-args` | Multiple strings | Additional arguments to pass during the CTest run. |
|
||||||
|
|
||||||
> Note: Multiple strings mean that the input can be specified with more than one value. Separate each value with a space or a new line.
|
> Note: Multiple strings mean that the input can be specified with more than one value. Separate each value with a space or a new line.
|
||||||
|
|
||||||
@ -79,16 +79,6 @@ jobs:
|
|||||||
run-test: true
|
run-test: true
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Specify the Build Targets
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: Configure and build this project
|
|
||||||
uses: threeal/cmake-action@latest
|
|
||||||
with:
|
|
||||||
run-build: true
|
|
||||||
targets: hello_mars hello_sun
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Using Ninja as the Generator and Clang as the Compiler
|
#### Using Ninja as the Generator and Clang as the Compiler
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
20
action.yml
20
action.yml
@ -9,10 +9,7 @@ inputs:
|
|||||||
description: The source directory of the CMake project
|
description: The source directory of the CMake project
|
||||||
required: false
|
required: false
|
||||||
build-dir:
|
build-dir:
|
||||||
description: The source directory of the CMake project.
|
description: The build directory of the CMake project
|
||||||
required: false
|
|
||||||
targets:
|
|
||||||
description: A list of build targets
|
|
||||||
required: false
|
required: false
|
||||||
generator:
|
generator:
|
||||||
description: The build system generator for the CMake project
|
description: The build system generator for the CMake project
|
||||||
@ -24,24 +21,27 @@ inputs:
|
|||||||
description: The preferred executable for compiling C++ language files
|
description: The preferred executable for compiling C++ language files
|
||||||
required: false
|
required: false
|
||||||
c-flags:
|
c-flags:
|
||||||
description: Additional flags passed when compiling C language files
|
description: Additional flags to pass when compiling C language files
|
||||||
required: false
|
required: false
|
||||||
cxx-flags:
|
cxx-flags:
|
||||||
description: Additional flags passed when compiling C++ language files
|
description: Additional flags to pass when compiling C++ language files
|
||||||
required: false
|
required: false
|
||||||
args:
|
args:
|
||||||
description: Additional arguments passed during the CMake configuration
|
description: Additional arguments to pass during the CMake configuration
|
||||||
required: false
|
required: false
|
||||||
run-build:
|
run-build:
|
||||||
description: If enabled, it builds the project using CMake (true/false)
|
description: If enabled, it builds the project using CMake (true/false)
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
|
build-args:
|
||||||
|
description: Additional arguments to pass during the CMake build
|
||||||
|
required: false
|
||||||
run-test:
|
run-test:
|
||||||
description: If enabled, it runs testing using CTest (true/false)
|
description: If enabled, it runs testing using CTest (true/false)
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
test-args:
|
test-args:
|
||||||
description: Additional arguments passed during the CTest run
|
description: Additional arguments to pass during the CTest run
|
||||||
required: false
|
required: false
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
@ -86,8 +86,8 @@ runs:
|
|||||||
if [ '${{ inputs.run-build }}' == 'true' ]; then
|
if [ '${{ inputs.run-build }}' == 'true' ]; then
|
||||||
BUILD_ARGS="--build '$BUILD_DIR'"
|
BUILD_ARGS="--build '$BUILD_DIR'"
|
||||||
fi
|
fi
|
||||||
if [ -n '${{ inputs.targets }}' ]; then
|
if [ -n '${{ inputs.build-args }}' ]; then
|
||||||
BUILD_ARGS="$BUILD_ARGS --target ${{ inputs.targets }}"
|
BUILD_ARGS="$BUILD_ARGS ${{ inputs.build-args }}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TEST_ARGS=""
|
TEST_ARGS=""
|
||||||
|
Loading…
Reference in New Issue
Block a user