Skip to content

Commit

Permalink
Parallelize builds
Browse files Browse the repository at this point in the history
  • Loading branch information
etang-cw committed Oct 19, 2023
1 parent 2f13c68 commit 25a237c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ jobs:
then
clang-format --version # A check for version 9 should be added.
git fetch origin ${{ github.base_ref }} # Fetch target branch to FETCH_HEAD for code style check.
python3 scripts/build.py --skip-tests --config ${{ matrix.config.type }} --check-code-style-base FETCH_HEAD
python3 scripts/build.py --skip-tests --config ${{ matrix.config.type }} --parallel --check-code-style-base FETCH_HEAD
else
python3 scripts/build.py --skip-tests --config ${{ matrix.config.type }} --skip-check-code-style
python3 scripts/build.py --skip-tests --config ${{ matrix.config.type }} --parallel --skip-check-code-style
fi
- name: Prepare artifacts
run: |
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
run: .github/workflows/scripts/build-dependencies-macos.sh
- name: Run build script
run: |
python3 scripts/build.py --skip-check-code-style --skip-tests --config ${{ matrix.config.type }} --cmake-extra "CMAKE_PREFIX_PATH=$HOME/deps" --cmake-extra CMAKE_OSX_DEPLOYMENT_TARGET=10.13
python3 scripts/build.py --skip-check-code-style --skip-tests --config ${{ matrix.config.type }} --parallel --cmake-extra "CMAKE_PREFIX_PATH=$HOME/deps" --cmake-extra CMAKE_OSX_DEPLOYMENT_TARGET=10.13
- name: Prepare artifacts
run: |
cp LICENSE.txt ${{ matrix.config.build_dir }}/darwin/universal/output/bin/
Expand Down
4 changes: 4 additions & 0 deletions scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ def parse_args():
'--cmake-extra', dest='cmake_extra',
action='append', default=[],
help='Extra variables to set on the cmake invocation')
arg_parser.add_argument(
'--parallel', action='store_true', default=False, help='Do a multi-threaded build')
return arg_parser.parse_args()


Expand Down Expand Up @@ -300,6 +302,8 @@ def cmake_build(args):
['--config', args.configuration.capitalize()])
if args.clean or args.clobber:
cmake_build_args.extend(['--target', 'clean'])
elif args.parallel:
cmake_build_args.extend(['--parallel', str(os.cpu_count())])
cmake_build_result = subprocess.run(
cmake_build_args,
cwd=get_build_dir(args.build_dir, args.configuration, args.architecture))
Expand Down

0 comments on commit 25a237c

Please sign in to comment.