mirror of https://github.com/aminya/setup-cpp
feat: add a separate vcvarsall
This commit is contained in:
parent
902069de32
commit
f19c776f46
|
@ -4,16 +4,17 @@ setup-cpp reused some code from the following projects:
|
||||||
- [install-cmake](https://github.com/Symbitic/install-cmake/blob/master/LICENSE.md): MIT
|
- [install-cmake](https://github.com/Symbitic/install-cmake/blob/master/LICENSE.md): MIT
|
||||||
- [get-cmake](https://github.com/lukka/get-cmake/blob/main/LICENSE.txt): MIT
|
- [get-cmake](https://github.com/lukka/get-cmake/blob/main/LICENSE.txt): MIT
|
||||||
- [gha-setup-ninja](https://github.com/seanmiddleditch/gha-setup-ninja): MIT
|
- [gha-setup-ninja](https://github.com/seanmiddleditch/gha-setup-ninja): MIT
|
||||||
- [setup-python](https://github.com/actions/setup-python): MIT
|
|
||||||
|
|
||||||
This package also uses the depedencies listed in package.json. You can get the list of their licenses using the following command:
|
This package also uses the depedencies listed in package.json. You can get the list of their licenses using the following command:
|
||||||
```
|
```
|
||||||
npm install -g license-checker
|
npm install -g license-checker
|
||||||
license-checker --summary --production
|
license-checker --summary --production --excludePackages "setup-python@2.2.2"
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
├─ MIT: 8
|
├─ MIT: 9
|
||||||
├─ ISC: 2
|
├─ ISC: 2
|
||||||
└─ Apache-2.0: 1
|
└─ Apache-2.0: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
setup-python@2.2.2 is MIT license.
|
|
@ -19,6 +19,7 @@ The package can be used locally or from CI services like GitHub Actions. Stay tu
|
||||||
- gcc
|
- gcc
|
||||||
- cmake
|
- cmake
|
||||||
- ninja
|
- ninja
|
||||||
|
- vcvarsall
|
||||||
- vcpkg
|
- vcpkg
|
||||||
- meson
|
- meson
|
||||||
- conan
|
- conan
|
||||||
|
|
|
@ -18,6 +18,9 @@ inputs:
|
||||||
msvc:
|
msvc:
|
||||||
description: "The msvc version to install"
|
description: "The msvc version to install"
|
||||||
required: false
|
required: false
|
||||||
|
vcvarsall:
|
||||||
|
description: "If should run vcvarsall?"
|
||||||
|
required: false
|
||||||
cmake:
|
cmake:
|
||||||
description: "The cmake version to install."
|
description: "The cmake version to install."
|
||||||
required: false
|
required: false
|
||||||
|
|
|
@ -36,11 +36,11 @@
|
||||||
"execa": "^5.1.1",
|
"execa": "^5.1.1",
|
||||||
"hasha": "^5.2.2",
|
"hasha": "^5.2.2",
|
||||||
"mri": "^1.2.0",
|
"mri": "^1.2.0",
|
||||||
|
"msvc-dev-cmd": " https://github.com/ilammy/msvc-dev-cmd",
|
||||||
"semver": "^7.3.5",
|
"semver": "^7.3.5",
|
||||||
"untildify": "^4.0.0",
|
|
||||||
"which": "^2.0.2",
|
|
||||||
"setup-python": "https://github.com/actions/setup-python",
|
"setup-python": "https://github.com/actions/setup-python",
|
||||||
"msvc-dev-cmd": " https://github.com/ilammy/msvc-dev-cmd"
|
"untildify": "^4.0.0",
|
||||||
|
"which": "^2.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/cross-spawn": "^6.0.2",
|
"@types/cross-spawn": "^6.0.2",
|
||||||
|
|
16
src/main.ts
16
src/main.ts
|
@ -26,6 +26,7 @@ import { error, success } from "./utils/io/io"
|
||||||
import { setupVcpkg } from "./vcpkg/vcpkg"
|
import { setupVcpkg } from "./vcpkg/vcpkg"
|
||||||
import { join } from "path"
|
import { join } from "path"
|
||||||
import { warning } from "@actions/core"
|
import { warning } from "@actions/core"
|
||||||
|
import { setupVCVarsall } from "./vcvarsall/vcvarsall"
|
||||||
|
|
||||||
/** The setup functions */
|
/** The setup functions */
|
||||||
const setups = {
|
const setups = {
|
||||||
|
@ -45,6 +46,7 @@ const setups = {
|
||||||
doxygen: setupDoxygen,
|
doxygen: setupDoxygen,
|
||||||
cppcheck: setupCppcheck,
|
cppcheck: setupCppcheck,
|
||||||
msvc: setupMSVC,
|
msvc: setupMSVC,
|
||||||
|
vcvarsall: setupVCVarsall,
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The tools that can be installed */
|
/** The tools that can be installed */
|
||||||
|
@ -65,6 +67,7 @@ const tools: Array<keyof typeof setups> = [
|
||||||
"llvm",
|
"llvm",
|
||||||
"gcc",
|
"gcc",
|
||||||
"msvc",
|
"msvc",
|
||||||
|
"vcvarsall",
|
||||||
]
|
]
|
||||||
|
|
||||||
/** The possible inputs to the program */
|
/** The possible inputs to the program */
|
||||||
|
@ -116,9 +119,15 @@ export async function main(args: string[]): Promise<number> {
|
||||||
|
|
||||||
// running the setup function for this tool
|
// running the setup function for this tool
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
let installationInfo: InstallationInfo | undefined | void
|
||||||
const installationInfo = await setupFunction(getVersion(tool, value), join(setupCppDir, tool), arch)
|
if (tool === "vcvarsall") {
|
||||||
|
// TODO expose the options
|
||||||
|
// eslint-disable-next-line no-await-in-loop
|
||||||
|
;(setupFunction as typeof setupVCVarsall)(undefined, arch, undefined, undefined, false, false)
|
||||||
|
} else {
|
||||||
|
// eslint-disable-next-line no-await-in-loop
|
||||||
|
installationInfo = await setupFunction(getVersion(tool, value), join(setupCppDir, tool), arch)
|
||||||
|
}
|
||||||
// preparing a report string
|
// preparing a report string
|
||||||
if (installationInfo !== undefined) {
|
if (installationInfo !== undefined) {
|
||||||
successMessages.push(getSuccessMessage(tool, installationInfo))
|
successMessages.push(getSuccessMessage(tool, installationInfo))
|
||||||
|
@ -252,6 +261,7 @@ Install all the tools required for building and testing C++/C projects.
|
||||||
All the available tools:
|
All the available tools:
|
||||||
--llvm
|
--llvm
|
||||||
--gcc
|
--gcc
|
||||||
|
--vcvarsall
|
||||||
--cmake
|
--cmake
|
||||||
--ninja
|
--ninja
|
||||||
--vcpkg
|
--vcpkg
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
import { error, exportVariable, warning } from "@actions/core"
|
import { error, exportVariable, warning } from "@actions/core"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
import { isCI } from "../utils/env/isci"
|
import { isCI } from "../utils/env/isci"
|
||||||
import { activateMSVC } from "../vcvarsall/vcvarsall"
|
import { setupVCVarsall } from "../vcvarsall/vcvarsall"
|
||||||
|
|
||||||
type MSVCVersion = "2015" | "2017" | "2019" | string
|
type MSVCVersion = "2015" | "2017" | "2019" | string
|
||||||
|
|
||||||
|
@ -56,5 +56,5 @@ export async function setupMSVC(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// run vcvarsall.bat environment variables
|
// run vcvarsall.bat environment variables
|
||||||
activateMSVC(VCTargetsPath, arch, toolset, sdk, uwp, spectre)
|
setupVCVarsall(VCTargetsPath, arch, toolset, sdk, uwp, spectre)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ function getArch(arch: string): string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function activateMSVC(
|
export function setupVCVarsall(
|
||||||
VCTargetsPath: string | undefined,
|
VCTargetsPath: string | undefined,
|
||||||
arch: string,
|
arch: string,
|
||||||
toolset: string | undefined,
|
toolset: string | undefined,
|
||||||
|
|
|
@ -27,6 +27,5 @@
|
||||||
"outDir": "./dist"
|
"outDir": "./dist"
|
||||||
},
|
},
|
||||||
"compileOnSave": false,
|
"compileOnSave": false,
|
||||||
"include": ["./src"],
|
"include": ["./src"]
|
||||||
"exclude": ["./src/python/setup-python", "src/msvc-dev-cmd/msvc-dev-cmd"]
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue