Skip to content

Commit 67f6523

Browse files
committed
cmake(ci): add CMAKE_BUILD_PARALLEL_LEVEL support
now build in -j 4 by default
1 parent f4e3051 commit 67f6523

39 files changed

+119
-0
lines changed

cmake/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ help:
159159
@echo
160160
@echo -e "\t${BOLD}NOCACHE=1${RESET}: use 'docker build --no-cache' when building container (default use cache)."
161161
@echo -e "\t${BOLD}VERBOSE=1${RESET}: use 'docker build --progress=plain' when building container."
162+
@echo -e "\t${BOLD}CMAKE_BUILD_PARALLEL_LEVEL=4${RESET}: number of concurrent processes to use when building."
162163
@echo
163164
@echo -e "branch: $(BRANCH)"
164165
@echo -e "sha1: $(SHA1)"
@@ -190,6 +191,10 @@ ifdef VERBOSE
190191
DOCKER_BUILD_CMD := ${DOCKER_BUILD_CMD} --progress=plain
191192
DOCKER_BUILDX_CMD := ${DOCKER_BUILDX_CMD} --progress=plain
192193
endif
194+
ifdef CMAKE_BUILD_PARALLEL_LEVEL
195+
DOCKER_BUILD_CMD := ${DOCKER_BUILD_CMD} --build-arg CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL}
196+
DOCKER_BUILDX_CMD := ${DOCKER_BUILDX_CMD} --build-arg CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL}
197+
endif
193198
DOCKER_RUN_CMD := docker run --rm --init --net=host
194199

195200
# Currently supported distro

cmake/docker/almalinux/cpp.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ FROM env AS devel
66
WORKDIR /home/project
77
COPY . .
88

9+
ARG CMAKE_BUILD_PARALLEL_LEVEL
10+
ENV CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-4}
11+
912
FROM devel AS build
1013
RUN cmake -S. -Bbuild -DBUILD_DEPS=ON
1114
RUN cmake --build build --target all -v

cmake/docker/almalinux/dotnet.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ WORKDIR /home/project
1414
COPY . .
1515
RUN sed -i 's/\(<SignAssembly>\).*\(<\/SignAssembly>\)/\1false\2/' ortools/dotnet/Google.OrTools*.csproj.in
1616

17+
ARG CMAKE_BUILD_PARALLEL_LEVEL
18+
ENV CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-4}
19+
1720
FROM devel AS build
1821
RUN cmake -version
1922
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF

cmake/docker/almalinux/java.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ FROM env AS devel
1111
WORKDIR /home/project
1212
COPY . .
1313

14+
ARG CMAKE_BUILD_PARALLEL_LEVEL
15+
ENV CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-4}
16+
1417
FROM devel AS build
1518
RUN cmake -S. -Bbuild -DBUILD_JAVA=ON -DSKIP_GPG=ON \
1619
-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF

cmake/docker/almalinux/python.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ FROM env AS devel
1212
WORKDIR /home/project
1313
COPY . .
1414

15+
ARG CMAKE_BUILD_PARALLEL_LEVEL
16+
ENV CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-4}
17+
1518
FROM devel AS build
1619
RUN cmake -S. -Bbuild -DBUILD_PYTHON=ON -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF
1720
RUN cmake --build build --target all -v

cmake/docker/alpine/cpp.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ FROM env AS devel
66
WORKDIR /home/project
77
COPY . .
88

9+
ARG CMAKE_BUILD_PARALLEL_LEVEL
10+
ENV CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-4}
11+
912
FROM devel AS build
1013
RUN cmake -S. -Bbuild -DBUILD_DEPS=ON
1114
RUN cmake --build build --target all -v

cmake/docker/alpine/dotnet.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ FROM env AS devel
1010
WORKDIR /home/project
1111
COPY . .
1212

13+
ARG CMAKE_BUILD_PARALLEL_LEVEL
14+
ENV CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-4}
15+
1316
FROM devel AS build
1417
RUN cmake -version
1518
RUN cmake -S. -Bbuild -DBUILD_DOTNET=ON -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF

cmake/docker/alpine/java.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ FROM env AS devel
77
WORKDIR /home/project
88
COPY . .
99

10+
ARG CMAKE_BUILD_PARALLEL_LEVEL
11+
ENV CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-4}
12+
1013
FROM devel AS build
1114
RUN cmake -S. -Bbuild -DBUILD_JAVA=ON -DSKIP_GPG=ON \
1215
-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF

cmake/docker/alpine/python.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ FROM env AS devel
1010
WORKDIR /home/project
1111
COPY . .
1212

13+
ARG CMAKE_BUILD_PARALLEL_LEVEL
14+
ENV CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-4}
15+
1316
FROM devel AS build
1417
RUN cmake -S. -Bbuild -DBUILD_PYTHON=ON -DVENV_USE_SYSTEM_SITE_PACKAGES=ON \
1518
-DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF

cmake/docker/archlinux/cpp.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ FROM env AS devel
66
WORKDIR /home/project
77
COPY . .
88

9+
ARG CMAKE_BUILD_PARALLEL_LEVEL
10+
ENV CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-4}
11+
912
FROM devel AS build
1013
RUN cmake -S. -Bbuild -DBUILD_DEPS=ON
1114
RUN cmake --build build --target all -v

0 commit comments

Comments
 (0)