mirror of
				https://github.com/threeal/cmake-action.git
				synced 2025-11-03 21:33:42 +00:00 
			
		
		
		
	
						commit
						7fb80ad5a2
					
				
							
								
								
									
										80
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										80
									
								
								README.md
									
									
									
									
									
								
							@ -1,5 +1,83 @@
 | 
			
		||||
# CMake Action
 | 
			
		||||
 | 
			
		||||
[](https://github.com/threeal/cmake-action/releases/)
 | 
			
		||||
[](./LICENSE)
 | 
			
		||||
[](https://github.com/threeal/cmake-action/actions/workflows/test.yml)
 | 
			
		||||
 | 
			
		||||
Configure and build [CMake](https://cmake.org/) project on [GitHub Actions](https://github.com/features/actions).
 | 
			
		||||
Configure and build a [CMake](https://cmake.org/) project on [GitHub Actions](https://github.com/features/actions).
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
For more information, see [action.yml](./action.yml) and [GitHub Actions guide](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions).
 | 
			
		||||
 | 
			
		||||
### Inputs
 | 
			
		||||
 | 
			
		||||
> Note: All inputs are optional.
 | 
			
		||||
 | 
			
		||||
| Name | Value Type | Description |
 | 
			
		||||
| --- | --- | --- |
 | 
			
		||||
| `source-dir` | Path | Source directory of the CMake project. Defaults to current directory. |
 | 
			
		||||
| `build-dir` | Path | Build directory of the CMake project. Defaults to `build` directory in current directory. |
 | 
			
		||||
| `targets` | Multiple strings | List of build targets. Could be specified more than one. Separate each target with a space or a new line. |
 | 
			
		||||
| `generator` | String | Build system generator of the CMake project. |
 | 
			
		||||
| `c-compiler` | String | Preferred executable for compiling C language files. |
 | 
			
		||||
| `cxx-compiler` | String | Preferred executable for compiling CXX language files. |
 | 
			
		||||
| `args` | Multiple strings | Additional arguments passed during the CMake configuration. Could be specified more than one. Separate each target with a space or a new line. |
 | 
			
		||||
 | 
			
		||||
### Examples
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
name: build
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
jobs:
 | 
			
		||||
  build-project:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Check out this repository
 | 
			
		||||
        uses: actions/checkout@v3.3.0
 | 
			
		||||
 | 
			
		||||
      - name: Configure and build this project
 | 
			
		||||
        uses: threeal/cmake-action@latest
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
> Note: You can replace `@latest` with any version you like.
 | 
			
		||||
 | 
			
		||||
#### Using Different Directories
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: Configure and build this project
 | 
			
		||||
  uses: threeal/cmake-action@latest
 | 
			
		||||
  with:
 | 
			
		||||
    source-dir: submodules
 | 
			
		||||
    build-dir: submodules/build
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Build Custom Targets
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: Configure and build this project
 | 
			
		||||
  uses: threeal/cmake-action@latest
 | 
			
		||||
  with:
 | 
			
		||||
    targets: hello_world_test fibonacci_test
 | 
			
		||||
    args: |
 | 
			
		||||
      -DBUILD_TESTING=ON
 | 
			
		||||
      -DCMAKE_CXX_FLAGS='-Werror'
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Build Using Ninja and Clang
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: Configure and build this project
 | 
			
		||||
  uses: threeal/cmake-action@latest
 | 
			
		||||
  with:
 | 
			
		||||
    generator: Ninja
 | 
			
		||||
    c-compiler: clang
 | 
			
		||||
    cxx-compiler: clang++
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## License
 | 
			
		||||
 | 
			
		||||
This project is licensed under the terms of the [MIT License](./LICENSE).
 | 
			
		||||
 | 
			
		||||
Copyright © 2023 [Alfi Maulana](https://github.com/threeal/)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										14
									
								
								action.yml
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								action.yml
									
									
									
									
									
								
							@ -1,32 +1,32 @@
 | 
			
		||||
name: CMake Action
 | 
			
		||||
description: Configure and build CMake project
 | 
			
		||||
description: Configure and build a CMake project
 | 
			
		||||
author: Alfi Maulana
 | 
			
		||||
branding:
 | 
			
		||||
  color: gray-dark
 | 
			
		||||
  icon: terminal
 | 
			
		||||
inputs:
 | 
			
		||||
  source-dir:
 | 
			
		||||
    description: The source directory of CMake project
 | 
			
		||||
    description: Source directory of the CMake project
 | 
			
		||||
    required: false
 | 
			
		||||
    default: .
 | 
			
		||||
  build-dir:
 | 
			
		||||
    description: The build directory of CMake project
 | 
			
		||||
    description: Build directory of the CMake project
 | 
			
		||||
    required: false
 | 
			
		||||
    default: build
 | 
			
		||||
  targets:
 | 
			
		||||
    description: List of build targets
 | 
			
		||||
    required: false
 | 
			
		||||
  generator:
 | 
			
		||||
    description: The build system generator of the CMake project
 | 
			
		||||
    description: Build system generator of the CMake project
 | 
			
		||||
    required: false
 | 
			
		||||
  c-compiler:
 | 
			
		||||
    description: The preferred executable for compiling C language files
 | 
			
		||||
    description: Preferred executable for compiling C language files
 | 
			
		||||
    required: false
 | 
			
		||||
  cxx-compiler:
 | 
			
		||||
    description: The preferred executable for compiling CXX language files
 | 
			
		||||
    description: Preferred executable for compiling CXX language files
 | 
			
		||||
    required: false
 | 
			
		||||
  args:
 | 
			
		||||
    description: Additional arguments passed during CMake configuration
 | 
			
		||||
    description: Additional arguments passed during the CMake configuration
 | 
			
		||||
    required: false
 | 
			
		||||
runs:
 | 
			
		||||
  using: composite
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user