mirror of https://github.com/aminya/setup-cpp
feat: add vcpkg
This commit is contained in:
parent
9206efb2d5
commit
08d77f1fd1
|
@ -19,6 +19,7 @@ The package can be used locally or from CI services like GitHub Actions. Stay tu
|
|||
- gcc
|
||||
- cmake
|
||||
- ninja
|
||||
- vcpkg
|
||||
- meson
|
||||
- conan
|
||||
- ccache
|
||||
|
@ -168,5 +169,4 @@ docker run -it setup_cpp
|
|||
|
||||
### Incomplete
|
||||
|
||||
- [ ] msvc. It is implemented, but has bugs. See [this issue](https://github.com/aminya/cpp/issues/1)
|
||||
- [ ] vcpkg (TODO)
|
||||
- msvc. It is implemented, but has bugs. See [this issue](https://github.com/aminya/setup-cpp/issues/1)
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -22,12 +22,14 @@ import { getVersion } from "./default_versions"
|
|||
import { setupGcc } from "./gcc/gcc"
|
||||
import { InstallationInfo } from "./utils/setup/setupBin"
|
||||
import { error, success } from "./utils/io/io"
|
||||
import { setupVcpkg } from "./vcpkg/vcpkg"
|
||||
|
||||
/** The setup functions */
|
||||
const setups = {
|
||||
cmake: setupCmake,
|
||||
ninja: setupNinja,
|
||||
python: setupPython,
|
||||
vcpkg: setupVcpkg,
|
||||
conan: setupConan,
|
||||
meson: setupMeson,
|
||||
gcovr: setupGcovr,
|
||||
|
@ -47,6 +49,7 @@ const tools: Array<keyof typeof setups> = [
|
|||
"choco",
|
||||
"brew",
|
||||
"python",
|
||||
"vcpkg",
|
||||
"cmake",
|
||||
"ninja",
|
||||
"conan",
|
||||
|
@ -233,6 +236,7 @@ All the available tools:
|
|||
--gcc
|
||||
--cmake
|
||||
--ninja
|
||||
--vcpkg
|
||||
--meson
|
||||
--conan
|
||||
--ccache
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import { setupVcpkg } from "../vcpkg"
|
||||
import { testBin } from "../../utils/tests/test-helpers"
|
||||
|
||||
jest.setTimeout(300000)
|
||||
async function testvcpkg() {
|
||||
const { binDir } = await setupVcpkg("", "", "")
|
||||
await testBin("vcpkg", ["--version"], binDir)
|
||||
return binDir
|
||||
}
|
||||
|
||||
describe("setup-vcpkg", () => {
|
||||
it("should setup vcpkg", async () => {
|
||||
await testvcpkg()
|
||||
})
|
||||
})
|
|
@ -0,0 +1,18 @@
|
|||
import { addPath } from "@actions/core"
|
||||
import execa from "execa"
|
||||
import which from "which"
|
||||
import { InstallationInfo } from "../utils/setup/setupBin"
|
||||
|
||||
let hasVCPKG = false
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export function setupVcpkg(_version: string, _setupCppDir: string, _arch: string): InstallationInfo {
|
||||
if (!hasVCPKG || which.sync("vcpkg", { nothrow: true }) === null) {
|
||||
execa.sync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: "~/" })
|
||||
execa.sync("./vcpkg/bootstrap-vcpkg", { cwd: "~/vcpkg" })
|
||||
addPath("~/vcpkg")
|
||||
hasVCPKG = true
|
||||
}
|
||||
|
||||
return { binDir: "~/vcpkg" }
|
||||
}
|
Loading…
Reference in New Issue