mirror of
https://github.com/ilammy/msvc-dev-cmd.git
synced 2026-09-07 06:07:19 +08:00
Update usage examples (#36)
* Use newer actions/checkout@v2 in examples That's the current version. Even our own build scripts use it. * Correct actions syntax By the way, it's been ages since steps get their own section... * Provide an example with matrix Finally, have some example to showcase input usage. * Move inputs after examples Since they are more useful, put copy-pastable examples first. Then you can look at all available inputs, now that you know how to use them.
This commit is contained in:
@@ -8,14 +8,57 @@ This sets up the environment for compiling C/C++ code from command line.
|
|||||||
|
|
||||||
Supports Windows. Does nothing on Linux and macOS.
|
Supports Windows. Does nothing on Linux and macOS.
|
||||||
|
|
||||||
|
## Example usage
|
||||||
|
|
||||||
|
Basic usage for default compilation settings is like this:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
- name: Build something requiring CL.EXE
|
||||||
|
run: |
|
||||||
|
cmake -G "NMake Makefiles" .
|
||||||
|
nmake
|
||||||
|
# ...
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want something non-default,
|
||||||
|
like using a specific version of Visual Studio,
|
||||||
|
or cross-compling for a differen target,
|
||||||
|
you will need to configure those settings via inputs:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
# Run a job for each of the specified target architectures:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
arch:
|
||||||
|
- amd64
|
||||||
|
- amd64_x86
|
||||||
|
- amd64_arm64
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
with:
|
||||||
|
arch: ${{ matrix.arch }}
|
||||||
|
- name: Build something requiring CL.EXE
|
||||||
|
run: |
|
||||||
|
cmake -G "NMake Makefiles" .
|
||||||
|
nmake
|
||||||
|
# ...
|
||||||
|
```
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
- `arch` – target architecture
|
- `arch` – target architecture
|
||||||
- native compilation:
|
- native compilation:
|
||||||
- `x64` (default) or its synonyms: `amd64`, `win64`
|
- `x64` (default) or its synonyms: `amd64`, `win64`
|
||||||
- `x86` or its synonyms: `win32`
|
- `x86` or its synonyms: `win32`
|
||||||
- cross-compilation: `x86_amd64`, `x86_arm`, `x86_arm64`,
|
- cross-compilation: `x86_amd64`, `x86_arm`, `x86_arm64`, `amd64_x86`, `amd64_arm`, `amd64_arm64`
|
||||||
`amd64_x86`, `amd64_arm`, `amd64_arm64`
|
|
||||||
- `sdk` – Windows SDK to use
|
- `sdk` – Windows SDK to use
|
||||||
- do not specify to use the default SDK
|
- do not specify to use the default SDK
|
||||||
- or specify full Windows 10 SDK number (e.g, `10.0.10240.0`)
|
- or specify full Windows 10 SDK number (e.g, `10.0.10240.0`)
|
||||||
@@ -28,20 +71,6 @@ Supports Windows. Does nothing on Linux and macOS.
|
|||||||
- `uwp` – set `true` to build for Universal Windows Platform (i.e., for Windows Store)
|
- `uwp` – set `true` to build for Universal Windows Platform (i.e., for Windows Store)
|
||||||
- `spectre` – set `true` to use Visual Studio libraries with [Spectre](https://meltdownattack.com) mitigations
|
- `spectre` – set `true` to use Visual Studio libraries with [Spectre](https://meltdownattack.com) mitigations
|
||||||
|
|
||||||
## Example usage
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- uses: ilammy/msvc-dev-cmd@v1
|
|
||||||
- name: Build something requiring CL.EXE
|
|
||||||
run: |
|
|
||||||
cmake -G "NMake Makefiles" .
|
|
||||||
nmake
|
|
||||||
# ...
|
|
||||||
```
|
|
||||||
|
|
||||||
## Caveats
|
## Caveats
|
||||||
|
|
||||||
### Name conflicts with `shell: bash`
|
### Name conflicts with `shell: bash`
|
||||||
|
|||||||
Reference in New Issue
Block a user