Skip to content

Commit 0c06ab6

Browse files
committed
docs: update the readme to include the npm docs [skip ci]
1 parent c41d430 commit 0c06ab6

File tree

1 file changed

+38
-39
lines changed

1 file changed

+38
-39
lines changed

README.md

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,55 @@ Setting up a **cross-platform** environment for building and testing C++/C proje
3030

3131
### From Terminal
3232

33-
You should download the executable file or the js file (if Nodejs installed), and run it with the available options.
33+
#### With npm and Nodejs
3434

35-
Tip: You can automate downloading using `wget`, `curl`, or other similar tools.
35+
Install setup-cpp with npm:
36+
37+
```shell
38+
npm install -g setup-cpp
39+
```
40+
41+
Then run `setup-cpp` with the available options.
42+
43+
```shell
44+
# windows example (open PowerShell as admin)
45+
setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
46+
47+
RefreshEnv.cmd # activate the environment
48+
```
3649

37-
#### Executable
50+
```shell
51+
# linux/macos example
52+
sudo setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
53+
54+
source ~/.cpprc
55+
```
56+
57+
NOTE: In the `compiler` entry, you can specify the version after `-` like `llvm-11.0.0`. For the tools, you can pass a specific version instead of `true` that chooses the default version
58+
59+
NOTE: On Unix systems, when `setup-cpp` is used locally or in other CI services like GitLab, the environment variables are added to `~/.cpprc`. You should run `source ~/.cpprc` to immediately activate the environment variables. This file is automatically sourced in the next shell restart from `~/.bashrc` or `~/.profile` if `SOURCE_CPPRC` is not set to `0`. To deactivate `.cpprc` in the next shell restart, rename/remove `~/.cpprc`.
60+
61+
NOTE: On Unix systems, if you are already a root user (e.g., in a GitLab runner or Docker), you will not need to use `sudo`.
62+
63+
#### With executable
64+
65+
You can download a self-contained executable file and run it with the available options.
3866

3967
Download the executable for your platform from [here](https://github.com/aminya/setup-cpp/releases/tag/v0.25.1), and run it with the available options.
4068

69+
Tip: You can automate downloading using `wget`, `curl`, or other similar tools.
70+
4171
An example that installs llvm, cmake, ninja, ccache, and vcpkg:
4272

43-
```ps1
73+
```shell
4474
# windows example (open PowerShell as admin)
4575
curl -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.25.1/setup-cpp-x64-windows.exe"
4676
./setup-cpp-x64-windows --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
4777

4878
RefreshEnv.cmd # activate cpp environment variables
4979
```
5080

51-
```ps1
81+
```shell
5282
# linux example
5383
wget "https://github.com/aminya/setup-cpp/releases/download/v0.25.1/setup-cpp-x64-linux"
5484
chmod +x ./setup-cpp-x64-linux
@@ -57,7 +87,7 @@ sudo ./setup-cpp-x64-linux --compiler llvm --cmake true --ninja true --ccache tr
5787
source ~/.cpprc # activate cpp environment variables
5888
```
5989

60-
```ps1
90+
```shell
6191
# macos example
6292
wget "https://github.com/aminya/setup-cpp/releases/download/v0.25.1/setup-cpp-x64-macos"
6393
chmod +x ./setup-cpp-x64-macos
@@ -66,37 +96,6 @@ sudo ./setup-cpp-x64-macos --compiler llvm --cmake true --ninja true --ccache tr
6696
source ~/.cpprc # activate cpp environment variables
6797
```
6898

69-
NOTE: In the `compiler` entry, you can specify the version after `-` like `llvm-11.0.0`. For the tools, you can pass a specific version instead of `true` that chooses the default version
70-
71-
NOTE: On Unix systems, when `setup-cpp` is used locally or in other CI services like GitLab, the environment variables are added to `~/.cpprc`. You should run `source ~/.cpprc` to immediately activate the environment variables. This file is automatically sourced in the next shell restart from `~/.bashrc` or `~/.profile` if `SOURCE_CPPRC` is not set to `0`. To deactivate `.cpprc` in the next shell restart, rename/remove `~/.cpprc`.
72-
73-
NOTE: On Unix systems, you will not need `sudo` if you are already a root user (e.g., in a GitLab runner or Docker).
74-
75-
#### With Nodejs
76-
77-
Download the `setup-cpp.js` file form [here](https://github.com/aminya/setup-cpp/releases/download/v0.25.1/setup-cpp.js), and run it with the available options.
78-
79-
On Windows:
80-
81-
Open the shell as admin, download via `curl`, then install
82-
83-
```ps1
84-
# open shell as admin
85-
curl.exe -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.25.1/setup-cpp.js"
86-
node ./setup-cpp.js --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
87-
88-
RefreshEnv.cmd # activate cpp environment variables
89-
```
90-
91-
On Linux or Mac:
92-
93-
```ps1
94-
wget "https://github.com/aminya/setup-cpp/releases/download/v0.25.1/setup-cpp.js"
95-
sudo node ./setup-cpp.js --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
96-
97-
source ~/.cpprc # activate cpp environment variables
98-
```
99-
10099
### Inside GitHub Actions
101100

102101
Here is a complete cross-platform example that tests llvm, gcc, and msvc. It also uses cmake, ninja, vcpkg, and cppcheck.
@@ -199,7 +198,7 @@ See [this folder](https://github.com/aminya/setup-cpp/tree/master/dev/docker), f
199198

200199
If you want to build the ones included, then run:
201200

202-
```ps1
201+
```shell
203202
git clone --recurse-submodules https://github.com/aminya/setup-cpp
204203
cd ./setup-cpp
205204
docker build -f ./dev/docker/ubuntu.dockerfile -t setup-cpp .
@@ -209,7 +208,7 @@ Where you should use the path to the dockerfile after `-f`.
209208

210209
After build, run the following to start an interactive shell in your container
211210

212-
```ps1
211+
```shell
213212
docker run -it setup-cpp
214213
```
215214

0 commit comments

Comments
 (0)