| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
GitHub Action for configuring Developer Command Prompt for Microsoft Visual C++.
This sets up the environment for compiling C/C++ code from command line.
Supports Windows. Does nothing on Linux and macOS.
Basic usage for default compilation settings is like this:
jobs:
test:
steps:
- uses: actions/checkout@v6
- uses: step-security/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 different target, you will need to configure those settings via inputs:
jobs:
test:
# Run a job for each of the specified target architectures:
strategy:
matrix:
arch:
- amd64
- amd64_x86
- amd64_arm64
steps:
- uses: actions/checkout@v6
- uses: step-security/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Build something requiring CL.EXE
run: |
cmake -G "NMake Makefiles" .
nmake
# ...Using shell: bash in Actions may shadow some of the paths added by MSVC. In particular, link.exe (Microsoft C linker) is prone to be shadowed by /usr/bin/link (GNU filesystem link tool).
Unfortunately, this happens because GitHub Actions unconditionally prepend GNU paths when shell: bash is used, on top of any paths set by msvc-dev-cmd, every time at the start of each new step. Hence, there aren't many non-destructive options here.
If you experience compilation errors where link complains about unreasonable command-line arguments, “extra operand something-something” – that's probably it. Recommended workaround is to remove /usr/bin/link if that interferes with your builds. If this is not acceptable, please file an issue, then we'll figure out something better.
You can invoke step-security/msvc-dev-cmd multiple times during your jobs with different inputs to reconfigure the environment for building with different settings (e.g., to target multiple architectures).
jobs:
release:
steps:
# ...
- name: Configure build for amd64
uses: step-security/msvc-dev-cmd@v1
with:
arch: amd64
- run: build # (for amd64)
- name: Configure build for x86
uses: step-security/msvc-dev-cmd@v1
with:
arch: amd64_x86
- run: build # (for x86)
- name: Configure build for ARM64
uses: step-security/msvc-dev-cmd@v1
with:
arch: amd64_arm64
- run: build # (for ARM64)
# ...This mostly works but it's not really recommended since Developer Command Prompt was not meant for recursive reconfiguration. That said, if it does not work for you, please file an issue.
Consider using strategy.matrix to execute different build configuration in parallel, independent environments.
MIT, see LICENSE.
| Back | FazBrowse Home | New Git URL |