-
Notifications
You must be signed in to change notification settings - Fork 8
refactor(taskfiles)!: Require NAME
to be set if CMAKE_SETTINGS_DIR
is set in utils:cmake:install
(fixes #50).
#57
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
Open
davidlion
wants to merge
3
commits into
y-scope:main
Choose a base branch
from
davidlion:task-cmake-settings-dir-tweak
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+26
−17
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -86,18 +86,19 @@ tasks: | |||||
|
||||||
# Runs the CMake install step for the given build directory. The caller must have previously | ||||||
# called `build` on `BUILD_DIR` for this task to succeed. If `CMAKE_SETTINGS_DIR` is set, a | ||||||
# settings file will be created in that directory, containing a `{{.NAME}}_ROOT` CMake variable | ||||||
# that points to `INSTALL_PREFIX`. | ||||||
# settings file will be created in that directory, containing a `{{.CMAKE_PACKAGE_NAME}}_ROOT` | ||||||
# CMake variable that points to `INSTALL_PREFIX`. | ||||||
# | ||||||
# NOTE: We purposely omit `sources` and `generates` as we defer to `cmake` to decide whether it | ||||||
# should perform any actions. | ||||||
# | ||||||
# @param {string} BUILD_DIR Directory containing the completed build to use. | ||||||
# @param {string} INSTALL_PREFIX Path prefix of where the project should be installed. | ||||||
# @param {string} NAME CMake project name (used in directory names and the CMake settings file). | ||||||
# @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings | ||||||
# file should be stored. | ||||||
# @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the install command. | ||||||
# @param {string} [CMAKE_PACKAGE_NAME] CMake project name (used in directory names and the CMake | ||||||
# settings file). Required if `CMAKE_SETTINGS_DIR` is set. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
install: | ||||||
internal: true | ||||||
label: "{{.TASK}}:{{.BUILD_DIR}}-{{.INSTALL_PREFIX}}-{{.EXTRA_ARGS}}" | ||||||
|
@@ -107,7 +108,15 @@ tasks: | |||||
EXTRA_ARGS: | ||||||
ref: "default (list) .EXTRA_ARGS" | ||||||
requires: | ||||||
vars: ["BUILD_DIR", "INSTALL_PREFIX", "NAME"] | ||||||
vars: ["BUILD_DIR", "INSTALL_PREFIX"] | ||||||
preconditions: | ||||||
- sh: >- | ||||||
{{if .CMAKE_SETTINGS_DIR}} | ||||||
{{not (empty .CMAKE_PACKAGE_NAME)}} | ||||||
{{end}} | ||||||
msg: |- | ||||||
CMAKE_PACKAGE_NAME must be set if CMAKE_SETTINGS_DIR is set. | ||||||
CMAKE_SETTINGS_DIR: {{.CMAKE_SETTINGS_DIR}} | ||||||
cmds: | ||||||
- >- | ||||||
cmake | ||||||
|
@@ -118,19 +127,19 @@ tasks: | |||||
{{- end}} | ||||||
- >- | ||||||
{{- if .CMAKE_SETTINGS_DIR}} | ||||||
echo "set({{.NAME}}_ROOT | ||||||
echo "set({{.CMAKE_PACKAGE_NAME}}_ROOT | ||||||
\"{{.INSTALL_PREFIX}}\" | ||||||
CACHE PATH | ||||||
\"Package root for {{.NAME}}.\" | ||||||
)" >> "{{.CMAKE_SETTINGS_DIR}}/{{.NAME}}.cmake" | ||||||
\"Package root for {{.CMAKE_PACKAGE_NAME}}.\" | ||||||
)" >> "{{.CMAKE_SETTINGS_DIR}}/{{.CMAKE_PACKAGE_NAME}}.cmake" | ||||||
{{- end}} | ||||||
|
||||||
# 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. | ||||||
# | ||||||
# Required parameters | ||||||
# @param {string} NAME CMake package name. | ||||||
# @param {string} CMAKE_PACKAGE_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. | ||||||
|
@@ -144,13 +153,13 @@ tasks: | |||||
# 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} [CMAKE_SETTINGS_DIR={{.WORK_DIR}}/cmake-settings] The directory where the | ||||||
# project's CMake settings file should be stored. | ||||||
# @param {string} [CMAKE_SETTINGS_DIR] The directory where the project's CMake settings file | ||||||
# should be stored. | ||||||
# @param {string[]} [CMAKE_TARGETS] A list of specific targets to build instead of the default | ||||||
# target. | ||||||
install-remote-tar: | ||||||
internal: true | ||||||
label: "{{.TASK}}:{{.NAME}}-{{.TAR_URL}}-{{.INSTALL_PREFIX}}" | ||||||
label: "{{.TASK}}:{{.CMAKE_PACKAGE_NAME}}-{{.TAR_URL}}-{{.INSTALL_PREFIX}}" | ||||||
vars: | ||||||
# CMake parameters | ||||||
CMAKE_BUILD_ARGS: | ||||||
|
@@ -162,17 +171,17 @@ tasks: | |||||
CMAKE_JOBS: >- | ||||||
{{default "" .CMAKE_JOBS}} | ||||||
CMAKE_SETTINGS_DIR: >- | ||||||
{{default (printf "%s/cmake-settings" .WORK_DIR) .CMAKE_SETTINGS_DIR}} | ||||||
{{default "" .CMAKE_SETTINGS_DIR}} | ||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
CMAKE_TARGETS: | ||||||
ref: "default (list) .CMAKE_TARGETS" | ||||||
|
||||||
# Directory parameters | ||||||
BUILD_DIR: "{{.WORK_DIR}}/{{.NAME}}-build" | ||||||
INSTALL_PREFIX: "{{.WORK_DIR}}/{{.NAME}}-install" | ||||||
SOURCE_DIR: "{{.WORK_DIR}}/{{.NAME}}-src" | ||||||
BUILD_DIR: "{{.WORK_DIR}}/{{.CMAKE_PACKAGE_NAME}}-build" | ||||||
INSTALL_PREFIX: "{{.WORK_DIR}}/{{.CMAKE_PACKAGE_NAME}}-install" | ||||||
SOURCE_DIR: "{{.WORK_DIR}}/{{.CMAKE_PACKAGE_NAME}}-src" | ||||||
|
||||||
requires: | ||||||
vars: ["NAME", "TAR_SHA256", "TAR_URL", "WORK_DIR"] | ||||||
vars: ["CMAKE_PACKAGE_NAME", "TAR_SHA256", "TAR_URL", "WORK_DIR"] | ||||||
deps: | ||||||
- task: "remote:download-and-extract-tar" | ||||||
vars: | ||||||
|
@@ -201,7 +210,7 @@ tasks: | |||||
EXTRA_ARGS: | ||||||
ref: ".CMAKE_INSTALL_ARGS" | ||||||
INSTALL_PREFIX: "{{.INSTALL_PREFIX}}" | ||||||
NAME: "{{.NAME}}" | ||||||
CMAKE_PACKAGE_NAME: "{{.CMAKE_PACKAGE_NAME}}" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could alphabetize? |
||||||
|
||||||
# Sets up all CMake dependencies for a project by: | ||||||
# | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to re-alphabetize this now that the var name has changed?