Skip to content

Commit e0043da

Browse files
committed
Make parallel optional
1 parent 366645f commit e0043da

File tree

4 files changed

+42
-8
lines changed

4 files changed

+42
-8
lines changed

.github/workflows/ci.yml

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ jobs:
4545
4646
mac-os-build-gcc:
4747
runs-on: macos-13
48+
strategy:
49+
matrix:
50+
parallel-build:
51+
- ON
52+
- OFF
53+
54+
fail-fast: false
55+
4856
permissions:
4957
id-token: write
5058
contents: read
@@ -62,17 +70,25 @@ jobs:
6270
- name: Build repository
6371
run: |
6472
mkdir build && cd build
65-
cmake .. -DBUILD_TEST=TRUE -DCMAKE_INSTALL_PREFIX=.
66-
make
67-
make install
73+
cmake .. -DBUILD_TEST=TRUE -DCMAKE_INSTALL_PREFIX=. -DPARALLEL_BUILD=${{ matrix.parallel-build }}
74+
75+
if [[ "${{ matrix.parallel-build }}" == 'ON' ]]; then
76+
make
77+
make -j install
78+
else
79+
make
80+
make install
81+
fi
6882
- name: Configure AWS Credentials
83+
if: ${{ matrix.parallel-build == 'ON' }} # Only need to run the tests once
6984
uses: aws-actions/configure-aws-credentials@v1-node16
7085
with:
7186
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
7287
role-session-name: ${{ secrets.AWS_ROLE_SESSION_NAME }}
7388
aws-region: ${{ secrets.AWS_REGION }}
7489
role-duration-seconds: 10800
7590
- name: Run tests
91+
if: ${{ matrix.parallel-build == 'ON' }}
7692
run: |
7793
cd build
7894
./tst/producerTest
@@ -242,6 +258,15 @@ jobs:
242258

243259
ubuntu-gcc:
244260
runs-on: ubuntu-20.04
261+
262+
strategy:
263+
matrix:
264+
parallel-build:
265+
- ON
266+
- OFF
267+
268+
fail-fast: false
269+
245270
env:
246271
AWS_KVS_LOG_LEVEL: 2
247272
CC: gcc
@@ -260,17 +285,24 @@ jobs:
260285
- name: Build repository
261286
run: |
262287
mkdir build && cd build
263-
cmake .. -DBUILD_TEST=TRUE -DBUILD_GSTREAMER_PLUGIN=TRUE -DBUILD_JNI=TRUE -DCMAKE_INSTALL_PREFIX=.
264-
make
265-
make install
288+
cmake .. -DBUILD_TEST=TRUE -DBUILD_GSTREAMER_PLUGIN=TRUE -DBUILD_JNI=TRUE -DCMAKE_INSTALL_PREFIX=. -DPARALLEL_BUILD=${{ matrix.parallel-build }}
289+
290+
if [[ "${{ matrix.parallel-build }}" == 'ON' ]]; then
291+
make -j install
292+
else
293+
make install
294+
fi
295+
266296
- name: Configure AWS Credentials
297+
if: ${{ matrix.parallel-build == 'ON' }} # Only need to run the tests once
267298
uses: aws-actions/configure-aws-credentials@v1-node16
268299
with:
269300
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
270301
role-session-name: ${{ secrets.AWS_ROLE_SESSION_NAME }}
271302
aws-region: ${{ secrets.AWS_REGION }}
272303
role-duration-seconds: 10800
273304
- name: Run tests
305+
if: ${{ matrix.parallel-build == 'ON' }}
274306
run: |
275307
cd build
276308
ulimit -c unlimited -S

CMake/Utilities.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function(fetch_repo lib_name)
99
return()
1010
endif()
1111

12-
if (WIN32)
12+
if (WIN32 OR NOT PARALLEL_BUILD)
1313
set(PARALLEL_BUILD "") # No parallel build for Windows
1414
else()
1515
set(PARALLEL_BUILD "--parallel") # Enable parallel builds for Unix-like systems
@@ -81,7 +81,7 @@ function(build_dependency lib_name)
8181

8282
file(REMOVE_RECURSE ${KINESIS_VIDEO_OPEN_SOURCE_SRC}/lib${lib_name})
8383

84-
if (WIN32)
84+
if (WIN32 OR NOT PARALLEL_BUILD)
8585
set(PARALLEL_BUILD "") # No parallel build for Windows
8686
else()
8787
set(PARALLEL_BUILD "--parallel") # Enable parallel builds for Unix-like systems

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ option(ADD_MUCLIBC "Add -muclibc c flag" OFF)
1717
option(BUILD_DEPENDENCIES "Whether or not to build depending libraries from source" ON)
1818
option(BUILD_OPENSSL_PLATFORM "If buildng OpenSSL what is the target platform" OFF)
1919
option(BUILD_LOG4CPLUS_HOST "Specify host-name for log4cplus for cross-compilation" OFF)
20+
option(PARALLEL_BUILD "Build dependencies with parallel flag" ON)
2021

2122
# Developer Flags
2223
option(BUILD_TEST "Build the testing tree" OFF)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ You can pass the following additional CMake options:
237237
| Option | Default | Description |
238238
|:-----------------------------|:-------------:|:-------------|
239239
| BUILD_GSTREAMER_PLUGIN | OFF | Build the `kvssink` GStreamer plugin
240+
| PARALLEL_BUILD | ON | When building dependencies, use multiple CPU cores in parallel (speeds up the build). Not available in Windows.
240241
| BUILD_JNI | OFF | Build C++ wrapper for JNI to expose the functionality to Java/Android
241242
| BUILD_JNI_ONLY | OFF | Build only the JNI. C++ Producer will not be built. Requires Java installed.
242243
| BUILD_DEPENDENCIES | ON | Build depending libraries from source

0 commit comments

Comments
 (0)