This commit is contained in:
Amin Yahyaabadi 2021-11-21 14:20:51 -06:00
parent 96346084ca
commit 0b3d2fafa3
6 changed files with 50 additions and 22 deletions

28
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,28 @@
{
"cSpell.words": [
"buildtools",
"ccache",
"cmake",
"CPATH",
"Cppcheck",
"CPPFLAGS",
"dyld",
"eabi",
"execa",
"gcovr",
"Graphviz",
"isci",
"LDFLAGS",
"msbuild",
"msvc",
"msys",
"multilib",
"nothrow",
"Opencppcoverage",
"OSSDK",
"untildify",
"vcpkg",
"visualc",
"visualcpp"
]
}

View File

@ -35,55 +35,55 @@ The package can be used locally or from CI services like GitHub Actions. Stay tu
# From Terminal
You should download the exe file or the js file (if have Nodejs installed), and run it with the available options.
You should download the executable file or the js file (if Nodejs installed), and run it with the available options.
Tip: You can automate downloading using `wget`, `curl` or other similar tools.
Tip: You can automate downloading using `wget`, `curl`, or other similar tools.
### Executable
Download the executable for your platform from [here](https://github.com/aminya/setup-cpp/releases/tag/v0.2.2), and run it with the available options.
Download the executable for your platform from [here](https://github.com/aminya/setup-cpp/releases/tag/v0.3.0), and run it with the available options.
An example that installs llvm, cmake, ninja, ccache, and vcpkg:
```ps1
# windows example (open shell as admin)
curl -O "https://github.com/aminya/setup-cpp/releases/download/v0.2.2/setup_cpp_windows.exe"
curl -O "https://github.com/aminya/setup-cpp/releases/download/v0.3.0/setup_cpp_windows.exe"
./setup_cpp_windows --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
```
```ps1
# linux example
wget "https://github.com/aminya/setup-cpp/releases/download/v0.2.2/setup_cpp_linux"
wget "https://github.com/aminya/setup-cpp/releases/download/v0.3.0/setup_cpp_linux"
chmod +x setup_cpp_linux
sudo ./setup_cpp_linux --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
```
```ps1
# mac example
wget "https://github.com/aminya/setup-cpp/releases/download/v0.2.2/setup_cpp_mac"
wget "https://github.com/aminya/setup-cpp/releases/download/v0.3.0/setup_cpp_mac"
chmod +x setup_cpp_mac
sudo ./setup_cpp_mac --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
```
NOTE: In the `compiler` entry, you can specify the version after `-` like `llvm-11`.
For the tools, instead of `true`, which chooses the default version, you can pass a specific version.
For the tools, instead of `true` that chooses the default version, you can pass a specific version.
### With Nodejs
Download the `setup_cpp.js` file form [here](https://github.com/aminya/setup-cpp/releases/download/v0.2.2/setup_cpp.js), and run it with the available options.
Download the `setup_cpp.js` file form [here](https://github.com/aminya/setup-cpp/releases/download/v0.3.0/setup_cpp.js), and run it with the available options.
On Windows
```ps1
# open shell as admin
curl "https://github.com/aminya/setup-cpp/releases/download/v0.2.2/setup_cpp.js"
curl "https://github.com/aminya/setup-cpp/releases/download/v0.3.0/setup_cpp.js"
node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
```
On Linux or Mac:
```ps1
wget "https://github.com/aminya/setup-cpp/releases/download/v0.2.2/setup_cpp.js"
wget "https://github.com/aminya/setup-cpp/releases/download/v0.3.0/setup_cpp.js"
sudo node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
```
@ -131,7 +131,7 @@ jobs:
# Inside Docker
Here is an example for using setup_cpp to make a builder image that has the cpp tools you need.
Here is an example for using setup_cpp to make a builder image that has the Cpp tools you need.
```dockerfile
# debian
@ -142,7 +142,7 @@ WORKDIR "/"
RUN apt-get update -qq
RUN apt-get install -y --no-install-recommends apt-utils
RUN apt-get install -y --no-install-recommends ca-certificates wget unzip
RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.2.2/setup_cpp_linux"
RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.3.0/setup_cpp_linux"
RUN chmod +x ./setup_cpp_linux
# install llvm, cmake, ninja, ccache, and vcpkg
@ -159,7 +159,7 @@ If you want to build the ones included, then run:
docker build -f ./building/docker/debian.dockerfile -t setup_cpp .
```
Where you should use the path to the the docker after `-f`.
Where you should use the path to the docker after `-f`.
After build, run the following to start an interactive shell in your container
@ -169,4 +169,4 @@ docker run -it setup_cpp
### Incomplete
- msvc. It is implemented, but has bugs. See [this issue](https://github.com/aminya/setup-cpp/issues/1)
- `msvc`. It is implemented, but it has bugs. See [this issue](https://github.com/aminya/setup-cpp/issues/1)

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -112,7 +112,7 @@ export async function main(args: string[]): Promise<number> {
// get the setup function
const setupFunction = setups[tool]
// runnig the setup function for this tool
// running the setup function for this tool
try {
// eslint-disable-next-line no-await-in-loop
const installationInfo = await setupFunction(getVersion(tool, value), join(setupCppDir, tool), arch)
@ -135,7 +135,7 @@ export async function main(args: string[]): Promise<number> {
const maybeCompiler = opts.compiler
try {
if (maybeCompiler !== undefined) {
// detecting the compiler version. Devide the given string by `-` and use the second element as the version
// detecting the compiler version. Divide the given string by `-` and use the second element as the version
const compilerAndMaybeVersion = maybeCompiler.split("-")
const compiler = compilerAndMaybeVersion[0]
let version: string | undefined
@ -263,10 +263,10 @@ function maybeGetInput(key: string) {
function getSuccessMessage(tool: string, installationInfo: InstallationInfo) {
let msg = `${tool} was successfully installed`
if ("installDir" in installationInfo) {
msg += `\nThe installation direcotry is ${installationInfo.installDir}`
msg += `\nThe installation directory is ${installationInfo.installDir}`
}
if (installationInfo.binDir !== "") {
msg += `\nThe binary direcotry is ${installationInfo.binDir}`
msg += `\nThe binary directory is ${installationInfo.binDir}`
}
return msg
}

View File

@ -31,9 +31,9 @@ export type InstallationInfo = {
/**
* A function that:
*
* - Downlodas and extracts a package
* - Downloads and extracts a package
* - Adds the bin path of the package to PATH
* - Caches the dowloaded directory into tool cache for usage from other sessions
* - Caches the downloaded directory into tool cache for usage from other sessions
*
* @returns The installation directory
*/