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
|
- gcc
|
||||||
- cmake
|
- cmake
|
||||||
- ninja
|
- ninja
|
||||||
|
- vcpkg
|
||||||
- meson
|
- meson
|
||||||
- conan
|
- conan
|
||||||
- ccache
|
- ccache
|
||||||
|
@ -168,5 +169,4 @@ docker run -it setup_cpp
|
||||||
|
|
||||||
### Incomplete
|
### Incomplete
|
||||||
|
|
||||||
- [ ] msvc. It is implemented, but has bugs. See [this issue](https://github.com/aminya/cpp/issues/1)
|
- msvc. It is implemented, but has bugs. See [this issue](https://github.com/aminya/setup-cpp/issues/1)
|
||||||
- [ ] vcpkg (TODO)
|
|
||||||
|
|
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 { setupGcc } from "./gcc/gcc"
|
||||||
import { InstallationInfo } from "./utils/setup/setupBin"
|
import { InstallationInfo } from "./utils/setup/setupBin"
|
||||||
import { error, success } from "./utils/io/io"
|
import { error, success } from "./utils/io/io"
|
||||||
|
import { setupVcpkg } from "./vcpkg/vcpkg"
|
||||||
|
|
||||||
/** The setup functions */
|
/** The setup functions */
|
||||||
const setups = {
|
const setups = {
|
||||||
cmake: setupCmake,
|
cmake: setupCmake,
|
||||||
ninja: setupNinja,
|
ninja: setupNinja,
|
||||||
python: setupPython,
|
python: setupPython,
|
||||||
|
vcpkg: setupVcpkg,
|
||||||
conan: setupConan,
|
conan: setupConan,
|
||||||
meson: setupMeson,
|
meson: setupMeson,
|
||||||
gcovr: setupGcovr,
|
gcovr: setupGcovr,
|
||||||
|
@ -47,6 +49,7 @@ const tools: Array<keyof typeof setups> = [
|
||||||
"choco",
|
"choco",
|
||||||
"brew",
|
"brew",
|
||||||
"python",
|
"python",
|
||||||
|
"vcpkg",
|
||||||
"cmake",
|
"cmake",
|
||||||
"ninja",
|
"ninja",
|
||||||
"conan",
|
"conan",
|
||||||
|
@ -233,6 +236,7 @@ All the available tools:
|
||||||
--gcc
|
--gcc
|
||||||
--cmake
|
--cmake
|
||||||
--ninja
|
--ninja
|
||||||
|
--vcpkg
|
||||||
--meson
|
--meson
|
||||||
--conan
|
--conan
|
||||||
--ccache
|
--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