Skip to content

qt-build-utils can invoke qmake when it is a script #1284

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
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SanderVocke
Copy link
Contributor

Ensure qmake is called either through cmd (Windows) or sh (Linux/MacOS).

The main change is this invocation. The rest of the code change is:

  • There were two places qmake were previously invoked and they didn't share code. To prevent duplicating this shell wrapper, refactored a bit to ensure they both call the same method to query qmake.
  • Due to said refactoring, also had to change the error handling a bit because the error generation moved. Added error types.

@SanderVocke
Copy link
Contributor Author

SanderVocke commented May 22, 2025

I only tested this so far on the "happy case" on Windows (that is to say: when using a qmake .bat wrapper). Will test on other platforms too.

@SanderVocke SanderVocke marked this pull request as draft May 22, 2025 18:54
@SanderVocke SanderVocke marked this pull request as ready for review May 23, 2025 09:15
@SanderVocke
Copy link
Contributor Author

SanderVocke commented May 23, 2025

I marked as ready for review.
Tested all combinations of QMAKE=qmake6 and QMAKE=(a qmake wrapper).[sh|bat] on Windows, Ubuntu and MacOS GitHub runners and cxx-qt builds fine with these combinations.

Copy link

codecov bot commented May 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (96d3233) to head (031f080).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1284   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           75        75           
  Lines        12772     12772           
=========================================
  Hits         12772     12772           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SanderVocke SanderVocke marked this pull request as draft May 23, 2025 10:03
}

/// Query the qmake executable which was previously
/// verified. Panic on error.
pub fn qmake_query(&self, var_name: &str) -> String {
Copy link
Collaborator

Choose a reason for hiding this comment

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

note as part of refactorings going on to the build system, this code has moved to

let qmake_version = match Command::new(&qmake_path)

The problem itself appears to be that the path to qmake might not be a binary executable but a script? Wonder if we should have a general Command wrapper to always call things via sh or not 🤔

Or whether instead the user should have to provide a binary, doesn't seem to tricky to just write a bash/batch script and execute on that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where this led to failure was with a .bat script on Windows. I don't think there is a way to make a .bat "more executable". Probably, executable scripts on Linux already work, although I didn't test that.

Thanks for the heads-up, I will adapt to the refactor that was done. My PR so far solved it locally. Would you prefer such a generic Command wrapper, or do you think the current approach in the PR is OK?

I ran into some build failures on your CI I still need to investigate. Locally the PR works on Linux and Windows, with .sh and .bat qmake wrapper scripts.

@SanderVocke SanderVocke force-pushed the support_qmake_scripts branch 4 times, most recently from f08b25c to e4ef4fa Compare June 11, 2025 14:18
@SanderVocke SanderVocke force-pushed the support_qmake_scripts branch from e4ef4fa to 031f080 Compare June 11, 2025 14:33
@SanderVocke SanderVocke marked this pull request as ready for review June 11, 2025 17:33
@SanderVocke
Copy link
Contributor Author

In the refactored qt-build-utils, the change was a lot more straightforward.

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.

2 participants