Skip to content

Commit a2d7d8f

Browse files
committed
Merge branch 'master' into feature/cross-mingw
1 parent ae58022 commit a2d7d8f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1703
-1355
lines changed

.github/workflows/CI.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,16 @@ jobs:
103103
gzip: folders
104104
draft: true
105105
files: >
106-
./exe/setup_cpp_windows.exe
107-
./exe/setup_cpp_linux
108-
./exe/setup_cpp_mac
109-
./dist/node12/setup_cpp.js
110-
./dist/node12/setup_cpp.js.map
106+
./exe/setup-cpp-x64-windows.exe
107+
./exe/setup-cpp-x64-linux
108+
./exe/setup-cpp-x64-macos
109+
./dist/node12/setup-cpp.js
110+
./dist/node12/setup-cpp.js.map
111111
./dist/node12/
112112
./dist/node16/
113113
114114
Docker:
115-
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip docker]') }}
115+
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip test]') }}
116116
runs-on: ${{ matrix.os }}
117117
strategy:
118118
fail-fast: false
@@ -166,4 +166,4 @@ jobs:
166166
- name: Build
167167
id: docker_build
168168
run: |
169-
docker build -f ./dev/docker/${{ matrix.container }} -t setup_cpp .
169+
docker build -f ./dev/docker/${{ matrix.container }} -t setup-cpp .

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ stats.html
77
src/python/setup-python/
88
src/msvc/msvc-dev-cmd/
99
dev/cpp_vcpkg_project
10+
package.json

README.md

Lines changed: 51 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -30,69 +30,64 @@ 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:
3636

37-
#### Executable
38-
39-
Download the executable for your platform from [here](https://github.com/aminya/setup-cpp/releases/tag/v0.24.1), and run it with the available options.
40-
41-
An example that installs llvm, cmake, ninja, ccache, and vcpkg:
42-
43-
```ps1
44-
# windows example (open shell as admin)
45-
curl.exe -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.24.1/setup_cpp_windows.exe"
46-
.\setup_cpp_windows --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
47-
48-
RefreshEnv.cmd # activate cpp environment variables
37+
```shell
38+
npm install -g setup-cpp
4939
```
5040

51-
```ps1
52-
# linux example
53-
wget "https://github.com/aminya/setup-cpp/releases/download/v0.24.1/setup_cpp_linux"
54-
chmod +x setup_cpp_linux
55-
sudo ./setup_cpp_linux --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
41+
Then run `setup-cpp` with the available options.
5642

57-
source ~/.cpprc # activate cpp environment variables
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
5848
```
5949

60-
```ps1
61-
# mac example
62-
wget "https://github.com/aminya/setup-cpp/releases/download/v0.24.1/setup_cpp_mac"
63-
chmod +x setup_cpp_mac
64-
sudo ./setup_cpp_mac --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
50+
```shell
51+
# linux/macos example
52+
sudo setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
6553

66-
source ~/.cpprc # activate cpp environment variables
54+
source ~/.cpprc
6755
```
6856

6957
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
7058

7159
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`.
7260

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).
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`.
7462

75-
#### With Nodejs
63+
#### With executable
7664

77-
Download the `setup_cpp.js` file form [here](https://github.com/aminya/setup-cpp/releases/download/v0.24.1/setup_cpp.js), and run it with the available options.
65+
Download the executable for your platform from [here](https://github.com/aminya/setup-cpp/releases/tag/v0.26.2), and run it with the available options. You can also automate downloading using `wget`, `curl`, or other similar tools.
7866

79-
On Windows:
80-
81-
Open the shell as admin, download via `curl`, then install
67+
An example that installs llvm, cmake, ninja, ccache, and vcpkg:
8268

83-
```ps1
84-
# open shell as admin
85-
curl.exe -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.24.1/setup_cpp.js"
86-
node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
69+
```shell
70+
# windows example (open PowerShell as admin)
71+
curl -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.26.2/setup-cpp-x64-windows.exe"
72+
./setup-cpp-x64-windows --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
8773

8874
RefreshEnv.cmd # activate cpp environment variables
8975
```
9076

91-
On Linux or Mac:
77+
```shell
78+
# linux example
79+
wget "https://github.com/aminya/setup-cpp/releases/download/v0.26.2/setup-cpp-x64-linux"
80+
chmod +x ./setup-cpp-x64-linux
81+
sudo ./setup-cpp-x64-linux --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
82+
83+
source ~/.cpprc # activate cpp environment variables
84+
```
9285

93-
```ps1
94-
wget "https://github.com/aminya/setup-cpp/releases/download/v0.24.1/setup_cpp.js"
95-
sudo node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
86+
```shell
87+
# macos example
88+
wget "https://github.com/aminya/setup-cpp/releases/download/v0.26.2/setup-cpp-x64-macos"
89+
chmod +x ./setup-cpp-x64-macos
90+
sudo ./setup-cpp-x64-macos --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
9691

9792
source ~/.cpprc # activate cpp environment variables
9893
```
@@ -160,21 +155,19 @@ jobs:
160155

161156
### Inside Docker
162157

163-
Here is an example for using setup_cpp to make a builder image that has the Cpp tools you need.
158+
Here is an example for using setup-cpp to make a builder image that has the Cpp tools you need.
164159

165160
```dockerfile
166161
#### Base Image
167162
FROM ubuntu:22.04 AS base
168163

169-
# add setup_cpp
170-
WORKDIR "/"
164+
# add setup-cpp
171165
RUN apt-get update -qq
172-
RUN apt-get install -y --no-install-recommends wget
173-
RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.24.1/setup_cpp_linux"
174-
RUN chmod +x ./setup_cpp_linux
166+
RUN apt-get install -y --no-install-recommends npm
167+
RUN npm install -g setup-cpp
175168

176169
# install llvm, cmake, ninja, and ccache
177-
RUN ./setup_cpp_linux --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --make true
170+
RUN setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --make true
178171

179172
CMD source ~/.cpprc
180173
ENTRYPOINT [ "/bin/bash" ]
@@ -199,18 +192,18 @@ See [this folder](https://github.com/aminya/setup-cpp/tree/master/dev/docker), f
199192

200193
If you want to build the ones included, then run:
201194

202-
```ps1
195+
```shell
203196
git clone --recurse-submodules https://github.com/aminya/setup-cpp
204197
cd ./setup-cpp
205-
docker build -f ./dev/docker/ubuntu.dockerfile -t setup_cpp .
198+
docker build -f ./dev/docker/ubuntu.dockerfile -t setup-cpp .
206199
```
207200

208201
Where you should use the path to the dockerfile after `-f`.
209202

210203
After build, run the following to start an interactive shell in your container
211204

212-
```ps1
213-
docker run -it setup_cpp
205+
```shell
206+
docker run -it setup-cpp
214207
```
215208

216209
### Inside Docker inside GitHub Actions
@@ -230,7 +223,7 @@ jobs:
230223
- name: Build
231224
id: docker_build
232225
run: |
233-
docker build -f ./dev/docker/debian.dockerfile -t setup_cpp .
226+
docker build -f ./dev/docker/debian.dockerfile -t setup-cpp .
234227
```
235228
236229
### Inside GitLab pipelines
@@ -261,10 +254,10 @@ stages:
261254
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
262255
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1E9377A2BA9EF27F
263256

264-
.setup_cpp: &setup_cpp |
265-
curl -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.24.1/setup_cpp_linux"
266-
chmod +x setup_cpp_linux
267-
./setup_cpp_linux --compiler $compiler --cmake true --ninja true --ccache true --vcpkg true
257+
.setup-cpp: &setup-cpp |
258+
curl -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.26.2/setup-cpp-x64-linux"
259+
chmod +x setup-cpp-x64-linux
260+
./setup-cpp-x64-linux --compiler $compiler --cmake true --ninja true --ccache true --vcpkg true
268261
source ~/.cpprc
269262

270263
.test: &test |
@@ -277,7 +270,7 @@ test_linux_llvm:
277270
compiler: llvm
278271
script:
279272
- *setup_linux
280-
- *setup_cpp
273+
- *setup-cpp
281274
- *test
282275

283276
test_linux_gcc:
@@ -286,7 +279,7 @@ test_linux_gcc:
286279
compiler: gcc
287280
script:
288281
- *setup_linux
289-
- *setup_cpp
282+
- *setup-cpp
290283
- *test
291284
```
292285

action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,13 @@ inputs:
8181
nala:
8282
description: 'The nala version to install ("" or "legacy").'
8383
required: false
84+
powershell:
85+
description: "The powershell version to install."
86+
required: false
8487

8588
runs:
8689
using: "node16"
87-
main: "dist/node16/setup_cpp.js"
90+
main: "dist/node16/setup-cpp.js"
8891

8992
branding:
9093
icon: "award"

dev/docker/arch_node.dockerfile

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,28 @@ RUN pacman -S --noconfirm --needed nodejs
1010
# curl for downloading setup-cpp
1111
RUN pacman -S --noconfirm --needed curl
1212

13-
# add setup_cpp.js
13+
# add setup-cpp.js
1414
COPY "./dist/node12" "/"
1515
WORKDIR "/"
1616

1717
# run installation
18-
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true
18+
RUN node ./setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true
1919

20-
# clean up
21-
RUN pacman -Scc --noconfirm
22-
RUN rm -rf /tmp/*
20+
CMD ["source", "~/.cpprc"]
21+
ENTRYPOINT ["/bin/bash"]
2322

24-
CMD source ~/.cpprc
25-
ENTRYPOINT [ "/bin/bash" ]
2623

2724
#### Building
28-
FROM base AS builder
25+
FROM base as builder
2926
COPY ./dev/cpp_vcpkg_project /home/app
3027
WORKDIR /home/app
3128
RUN bash -c 'source ~/.cpprc \
3229
&& task build'
3330

31+
3432
### Running environment
3533
# use a distroless image or ubuntu:22.04 if you wish
36-
FROM gcr.io/distroless/cc
34+
FROM gcr.io/distroless/cc as runner
3735
# copy the built binaries and their runtime dependencies
3836
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
3937
WORKDIR /home/app/

dev/docker/fedora_node.dockerfile

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,31 @@
11
## base image
22
FROM fedora as base
33

4-
# nodejs
5-
RUN dnf -y install nodejs
4+
# nodejs and curl for downloading setup-cpp
5+
RUN dnf -y install nodejs curl
66

7-
# curl for downloading setup-cpp
8-
RUN dnf -y install curl
9-
10-
# add setup_cpp.js
7+
# add setup-cpp.js
118
COPY "./dist/node12" "/"
129
WORKDIR "/"
1310

1411
# run installation
15-
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true --powershell true
16-
17-
# clean up
18-
RUN rm -rf /tmp/*
12+
RUN node ./setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true --powershell true
1913

20-
CMD source ~/.cpprc
14+
CMD ["source", "~/.cpprc"]
2115
ENTRYPOINT [ "/bin/bash" ]
2216

17+
2318
#### Building
24-
FROM base AS builder
19+
FROM base as builder
2520
COPY ./dev/cpp_vcpkg_project /home/app
2621
WORKDIR /home/app
2722
RUN bash -c 'source ~/.cpprc \
2823
&& task build'
2924

25+
3026
### Running environment
3127
# use a distroless image or ubuntu:22.04 if you wish
32-
FROM gcr.io/distroless/cc
28+
FROM gcr.io/distroless/cc as runner
3329
# copy the built binaries and their runtime dependencies
3430
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
3531
WORKDIR /home/app/

dev/docker/ubuntu.dockerfile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
#### Base Image
2-
FROM ubuntu:22.04 AS base
2+
FROM ubuntu:22.04 as base
33

4-
# add setup_cpp
5-
WORKDIR "/"
4+
# install setup-cpp
65
RUN apt-get update -qq
7-
RUN apt-get install -y --no-install-recommends wget
8-
RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.24.1/setup_cpp_linux"
9-
RUN chmod +x ./setup_cpp_linux
6+
RUN apt-get install -y --no-install-recommends npm
7+
RUN npm install -g setup-cpp
108

119
# install llvm, cmake, ninja, and ccache
12-
RUN ./setup_cpp_linux --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --task true
10+
RUN setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --task true
11+
12+
CMD ["source", "~/.cpprc"]
13+
ENTRYPOINT ["/bin/bash"]
1314

14-
CMD source ~/.cpprc
15-
ENTRYPOINT [ "/bin/bash" ]
1615

1716
#### Building
18-
FROM base AS builder
19-
ADD ./dev/cpp_vcpkg_project /home/app
17+
FROM base as builder
18+
COPY ./dev/cpp_vcpkg_project /home/app
2019
WORKDIR /home/app
2120
RUN bash -c 'source ~/.cpprc \
2221
&& task build'
2322

23+
2424
### Running environment
2525
# use a distroless image or ubuntu:22.04 if you wish
26-
FROM gcr.io/distroless/cc
26+
FROM gcr.io/distroless/cc as runner
2727
# copy the built binaries and their runtime dependencies
2828
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
2929
WORKDIR /home/app/

0 commit comments

Comments
 (0)