Skip to content

Commit 650820a

Browse files
authored
Merge pull request #43 from aminya/setup_cpp_rc [skip ci]
2 parents 70649cf + 76fb16b commit 650820a

File tree

20 files changed

+124
-95
lines changed

20 files changed

+124
-95
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"CPATH",
77
"Cppcheck",
88
"CPPFLAGS",
9+
"cpprc",
910
"dyld",
1011
"eabi",
1112
"execa",

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ An example that installs llvm, cmake, ninja, ccache, and vcpkg:
6161
curl -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.9.4/setup_cpp_windows.exe"
6262
./setup_cpp_windows --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
6363
64-
RefreshEnv.cmd # reload the environment
64+
RefreshEnv.cmd # activate cpp enviroment variables
6565
```
6666

6767
```ps1
@@ -70,7 +70,7 @@ wget "https://github.com/aminya/setup-cpp/releases/download/v0.9.4/setup_cpp_lin
7070
chmod +x setup_cpp_linux
7171
sudo ./setup_cpp_linux --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
7272
73-
source ~/.profile # reload the environment
73+
source ~/.cpprc # activate cpp enviroment variables
7474
```
7575

7676
```ps1
@@ -79,13 +79,14 @@ wget "https://github.com/aminya/setup-cpp/releases/download/v0.9.4/setup_cpp_mac
7979
chmod +x setup_cpp_mac
8080
sudo ./setup_cpp_mac --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
8181
82-
source ~/.profile # reload the environment
82+
source ~/.cpprc # activate cpp enviroment variables
8383
```
8484

85-
NOTE: In the `compiler` entry, you can specify the version after `-` like `llvm-11.0.0`.
86-
For the tools, instead of `true` that chooses the default version, you can pass a specific version.
85+
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
8786

88-
NOTE: you will not need `sudo` if you are already a root user (e.g., in a GitLab runner).
87+
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`.
88+
89+
NOTE: On Unix systems, you will not need `sudo` if you are already a root user (e.g., in a GitLab runner or Docker).
8990

9091
### With Nodejs
9192

@@ -100,7 +101,7 @@ Open the shell as admin, download via `curl`, then install
100101
curl -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.9.4/setup_cpp.js"
101102
node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
102103
103-
RefreshEnv.cmd # reload the environment
104+
RefreshEnv.cmd # activate cpp enviroment variables
104105
```
105106

106107
On Linux or Mac:
@@ -109,7 +110,7 @@ On Linux or Mac:
109110
wget "https://github.com/aminya/setup-cpp/releases/download/v0.9.4/setup_cpp.js"
110111
sudo node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
111112
112-
source ~/.profile # reload the environment
113+
source ~/.cpprc # activate cpp enviroment variables
113114
```
114115

115116
## Inside GitHub Actions
@@ -190,8 +191,8 @@ RUN chmod +x ./setup_cpp_linux
190191
# install llvm, cmake, ninja, and ccache
191192
RUN ./setup_cpp_linux --compiler llvm --cmake true --ninja true --ccache true
192193

193-
# reload the environment
194-
RUN source ~/.profile
194+
# activate cpp enviroment variables
195+
RUN source ~/.cpprc
195196

196197
ENTRYPOINT [ "/bin/sh" ]
197198
```
@@ -266,7 +267,7 @@ stages:
266267
curl -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.9.4/setup_cpp_linux"
267268
chmod +x setup_cpp_linux
268269
./setup_cpp_linux --compiler $compiler --cmake true --ninja true --ccache true --vcpkg true
269-
source ~/.profile
270+
source ~/.cpprc
270271

271272
.test: &test |
272273
# Build and Test

building/docker/ubuntu.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ RUN chmod +x ./setup_cpp_linux
1111
RUN ./setup_cpp_linux --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
1212

1313
# reload the environment
14-
CMD source ~/.profile
14+
CMD source ~/.cpprc
1515

1616
ENTRYPOINT [ "/bin/sh" ]

building/docker/ubuntu_node.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ WORKDIR "/"
1111
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true
1212

1313
# reload the environment and print the versions
14-
CMD source ~/.profile && clang --version && cmake --version && ninja --version && ccache --version && cppcheck --version && vcpkg --version && doxygen --version && dot --version && gcovr --version
14+
CMD source ~/.cpprc && clang --version && cmake --version && ninja --version && ccache --version && cppcheck --version && vcpkg --version && doxygen --version && dot --version && gcovr --version
1515

1616
ENTRYPOINT [ "/bin/sh" ]

building/docker/ubuntu_stable_node.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ WORKDIR "/"
1919
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true
2020

2121
# reload the environment and print the versions
22-
CMD source ~/.profile && clang --version && cmake --version && ninja --version && ccache --version && cppcheck --version && vcpkg --version && doxygen --version && dot --version && gcovr --version
22+
CMD source ~/.cpprc && clang --version && cmake --version && ninja --version && ccache --version && cppcheck --version && vcpkg --version && doxygen --version && dot --version && gcovr --version
2323

2424
ENTRYPOINT [ "/bin/sh" ]

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/chocolatey/chocolatey.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import execa from "execa"
33
import { existsSync } from "fs"
44
import { dirname } from "path"
55
import which from "which"
6-
import { addPath } from "../utils/path/addPath"
6+
import { addPath } from "../utils/env/addEnv"
77
import { InstallationInfo } from "../utils/setup/setupBin"
88

99
let binDir: string | undefined

src/cppcheck/cppcheck.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { addPath } from "../utils/path/addPath"
1+
import { addPath } from "../utils/env/addEnv"
22
import { setupAptPack } from "../utils/setup/setupAptPack"
33
import { setupBrewPack } from "../utils/setup/setupBrewPack"
44
import { setupChocoPack } from "../utils/setup/setupChocoPack"

src/doxygen/doxygen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { addPath } from "../utils/path/addPath"
1+
import { addPath } from "../utils/env/addEnv"
22
import { setupAptPack } from "../utils/setup/setupAptPack"
33
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
44
import { setupBrewPack } from "../utils/setup/setupBrewPack"

0 commit comments

Comments
 (0)