Skip to content

Conversation

@rhornung67
Copy link
Member

Summary

  • This PR modifies build scripts to accept an optional cmake version argument
  • If no cmake version is given, a default based on the RAJA cmake min version is set
  • This helps with the fact that some of these scripts can be used on multiple platforms that may have different cmake version defaults or versions that don't exist on others

If no cmake version is given, a default based on the RAJA cmake min version is set
Comment on lines +27 to +35
# Detect optional second positional argument as a CMake version if it looks like N.M or N.M.P
# Otherwise, treat it as a normal CMake argument.
if [ -n "$2" ] && [[ "$2" =~ ^[0-9]+(\.[0-9]+)*$ ]]; then
CMAKE_VER=$2
shift 2
else
CMAKE_VER=$DEFAULT_CMAKE_VER
shift 1
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be more clear if the cmake version was an optional named argument like script compiler_ver [--cmake ver] [cmake args...]? Would putting it first be more uniform script [--cmake ver] compiler_ver [cmake args...]?

Copy link
Member Author

@rhornung67 rhornung67 Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, but we don't use named args for input to any of the scripts.

I put it last because it's optional and in most cases, it probably won't be needed.

This PR is intended to deal with the specific issue that the CMake version is currently hard-coded in the scripts and we need to be more flexible and it's a pain to modify the scripts for minor changes like that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in general named arguments are better, and that it would be better if all the build scripts had only named arguments (ideally in Python). However, given that these scripts are used primarily internally, I think it would probably be better to make this as minimal of a change as possible.

In terms of improving usability of these scripts, I think the best thing would probably be a Python driver that calls the shell scripts automatically, and provides users with a nice --help description.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with that. If you feel inclined to pursue that, please do so.

My intent with this PR was to do a quick, simple change to make the scripts more useful w.r.t. a particular issue.


# Detect optional second positional argument as a CMake version if it looks like N.M or N.M.P
# Otherwise, treat it as a normal CMake argument.
if [ -n "$2" ] && [[ "$2" =~ ^[0-9]+(\.[0-9]+)*$ ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be better to have an additional clause like this

elif [ -n "$2" ] && [[ "$2" !=~ ^[0-9]+(\.[0-9]+)*$ ]]; then
echo "Unable to parse CMake version number"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this argument won't be used widely I think this help message is not strictly necessary

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we can make the scripts much more helpful. However, they are specific to LC systems and used mostly for our own development purposes. Sometimes, I point people to them for examples.

@MrBurmark
Copy link
Member

We'll have to change the RAJAPerf scripts too.

@rhornung67
Copy link
Member Author

We'll have to change the RAJAPerf scripts too.

Yes. I wanted to run this by folks first.

@rhornung67 rhornung67 enabled auto-merge January 28, 2026 17:37
@rhornung67 rhornung67 merged commit 0151da9 into develop Jan 28, 2026
21 checks passed
@rhornung67 rhornung67 deleted the task/rhornung67/scripts-cmake-option branch January 28, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants