Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions exports/taskfiles/utils/cmake.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,25 @@ tasks:
# @param {string} BUILD_DIR Directory containing the generated build system to use.
# @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the build command.
# @param {int} [JOBS] The maximum number of concurrent processes to use when building. If
# omitted, the native build tool's default number is used. See `man cmake`.
# omitted, defaults to the number of logical CPUs reported by the system. Falls back to 1 for a
# serial build if the CPU count cannot be determined.
# @param {string[]} [TARGETS] A list of specific targets to build instead of the default target.
build:
internal: true
label: "{{.TASK}}:{{.BUILD_DIR}}-{{.TARGETS}}-{{.EXTRA_ARGS}}"
vars:
EXTRA_ARGS:
ref: "default (list) .EXTRA_ARGS"
# Number of logical CPUs, used as the default for `JOBS` when the caller doesn't set it.
# Portable across Linux (`nproc`), POSIX (`getconf`), and macOS (`sysctl`).
_CPU_COUNT:
sh: |-
nproc 2>/dev/null \
|| getconf _NPROCESSORS_ONLN 2>/dev/null \
|| sysctl -n hw.logicalcpu 2>/dev/null \
|| echo 1
JOBS: >-
{{default "" .JOBS}}
{{default ._CPU_COUNT .JOBS}}
TARGETS:
ref: "default (list) .TARGETS"
requires:
Expand Down Expand Up @@ -154,7 +163,8 @@ tasks:
# @param {string[]} [CMAKE_INSTALL_ARGS] Any additional arguments to pass to the CMake install
# command.
# @param {int} [CMAKE_JOBS] The maximum number of concurrent processes to use when building. If
# omitted, the native build tool's default number is used. See `man cmake`.
# omitted, defaults to the number of logical CPUs reported by the system. Falls back to 1 for a
# serial build if the CPU count cannot be determined.
# @param {string} [CMAKE_SETTINGS_DIR] The directory where the project's CMake settings file
# should be stored.
# @param {string} [CMAKE_SOURCE_DIR=.] The path, within the extraction directory, containing the
Expand Down
Loading