Skip to content

refactor(taskfiles)!: Rename and reorganize utils:cmake:install-remote-tar's parameters. #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 16, 2025
Merged
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
102 changes: 48 additions & 54 deletions exports/taskfiles/utils/cmake.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,98 +125,92 @@ tasks:
)" >> "{{.CMAKE_SETTINGS_DIR}}/{{.NAME}}.cmake"
{{- end}}

# Downloads a CMake project tar file from `URL` and then generates, builds, and installs the
# Downloads a CMake project tar file from `TAR_URL` and then generates, builds, and installs the
# project. We purposely omit `sources` and `generates` as we defer to `cmake` to decide whether it
# should perform any actions. However, the download and extraction will be skipped if unnecessary.
#
# General parameters
# @param {string} NAME Project name (used in directory names).
# @param {string} [SOURCE_DIR={{.WORK_DIR}}/{{.NAME}}-src] Directory in which to extract the tar
# file.
# @param {string} [WORK_DIR={{.TASK_DIR}}] Base directory to store the build, install, and src
# directories inside.
#
# Download parameters
# @param {string} FILE_SHA256 Content hash to verify the downloaded tar file against.
# @param {string} URL
#
# CMake generate parameters
# @param {string[]} [GEN_ARGS] Any additional arguments to pass to the CMake generate command.
# Required parameters
# @param {string} NAME CMake package name.
# @param {string} TAR_SHA256 Content hash to verify the downloaded tar file against.
# @param {string} TAR_URL URL of the tar file to download.
# @param {string} WORK_DIR Directory in which to store the build, install, and source directories.
#
# CMake build parameters
# @param {string[]} [BUILD_ARGS] Any additional arguments to pass to the CMake build command.
# @param {string} [BUILD_DIR={{.WORK_DIR}}/{{.NAME}}-build] Directory in which to generate the
# build system and perform the build.
# @param {int} [JOBS] The maximum number of concurrent processes to use when building. If
# CMake parameters
# @param {string[]} [CMAKE_BUILD_ARGS] Any additional arguments to pass to the CMake build
# command.
# @param {string[]} [CMAKE_GEN_ARGS] Any additional arguments to pass to the CMake generate
# command.
# @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`.
# @param {string[]} [TARGETS] A list of specific targets to build instead of the default target.
#
# CMake install parameters
# @param {string} [CMAKE_SETTINGS_DIR={{.WORK_DIR}}/cmake-settings] The directory where the
# project's CMake settings file should be stored.
# @param {string[]} [INSTALL_ARGS] Any additional arguments to pass to the CMake install command.
# @param {string[]} [CMAKE_TARGETS] A list of specific targets to build instead of the default
# target.
#
# Directory parameters
# @param {string} [BUILD_DIR={{.WORK_DIR}}/{{.NAME}}-build] Directory in which to generate the
# build system and perform the build.
# @param {string} [INSTALL_PREFIX={{.WORK_DIR}}/{{.NAME}}-install] Path prefix of where the
# project should be installed.
# @param {string} [SOURCE_DIR={{.WORK_DIR}}/{{.NAME}}-src] Directory in which to extract the tar
# file.
install-remote-tar:
internal: true
label: "{{.TASK}}:{{.NAME}}-{{.URL}}-{{.INSTALL_PREFIX}}"
label: "{{.TASK}}:{{.NAME}}-{{.TAR_URL}}-{{.INSTALL_PREFIX}}"
vars:
# General parameters
WORK_DIR: >-
{{default .ROOT_DIR .WORK_DIR}}
SOURCE_DIR: >-
{{default (printf "%s/%s-src" .WORK_DIR .NAME) .SOURCE_DIR}}

# CMake generate parameters
GEN_ARGS:
ref: "default (list) .GEN_ARGS"
# CMake parameters
CMAKE_BUILD_ARGS:
ref: "default (list) .CMAKE_BUILD_ARGS"
CMAKE_GEN_ARGS:
ref: "default (list) .CMAKE_GEN_ARGS"
CMAKE_INSTALL_ARGS:
ref: "default (list) .CMAKE_INSTALL_ARGS"
CMAKE_JOBS: >-
{{default "" .CMAKE_JOBS}}
CMAKE_SETTINGS_DIR: >-
{{default (printf "%s/cmake-settings" .WORK_DIR) .CMAKE_SETTINGS_DIR}}
CMAKE_TARGETS:
ref: "default (list) .CMAKE_TARGETS"

# CMake build parameters
BUILD_ARGS:
ref: "default (list) .BUILD_ARGS"
# Directory parameters
BUILD_DIR: >-
{{default (printf "%s/%s-build" .WORK_DIR .NAME) .BUILD_DIR}}
JOBS: >-
{{default "" .JOBS}}
TARGETS:
ref: "default (list) .TARGETS"

# CMake install parameters
CMAKE_SETTINGS_DIR: >-
{{default (printf "%s/cmake-settings" .WORK_DIR) .CMAKE_SETTINGS_DIR}}
INSTALL_ARGS:
ref: "default (list) .INSTALL_ARGS"
INSTALL_PREFIX: >-
{{default (printf "%s/%s-install" .WORK_DIR .NAME) .INSTALL_PREFIX}}
SOURCE_DIR: >-
{{default (printf "%s/%s-src" .WORK_DIR .NAME) .SOURCE_DIR}}

requires:
vars: ["FILE_SHA256", "NAME", "URL"]
vars: ["NAME", "TAR_SHA256", "TAR_URL", "WORK_DIR"]
deps:
- task: "remote:download-and-extract-tar"
vars:
FILE_SHA256: "{{.FILE_SHA256}}"
FILE_SHA256: "{{.TAR_SHA256}}"
OUTPUT_DIR: "{{.SOURCE_DIR}}"
URL: "{{.URL}}"
URL: "{{.TAR_URL}}"
cmds:
- task: "generate"
vars:
BUILD_DIR: "{{.BUILD_DIR}}"
EXTRA_ARGS:
ref: ".GEN_ARGS"
ref: ".CMAKE_GEN_ARGS"
SOURCE_DIR: "{{.SOURCE_DIR}}"
- task: "build"
vars:
BUILD_DIR: "{{.BUILD_DIR}}"
EXTRA_ARGS:
ref: ".BUILD_ARGS"
JOBS: "{{.JOBS}}"
ref: ".CMAKE_BUILD_ARGS"
JOBS: "{{.CMAKE_JOBS}}"
TARGETS:
ref: ".TARGETS"
ref: ".CMAKE_TARGETS"
- task: "install"
vars:
BUILD_DIR: "{{.BUILD_DIR}}"
CMAKE_SETTINGS_DIR: "{{.CMAKE_SETTINGS_DIR}}"
EXTRA_ARGS:
ref: ".INSTALL_ARGS"
ref: ".CMAKE_INSTALL_ARGS"
INSTALL_PREFIX: "{{.INSTALL_PREFIX}}"
NAME: "{{.NAME}}"

Expand Down