Skip to content
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

Build: Generate qm files and embedded resource during build #3288

Merged
merged 4 commits into from
Jun 22, 2024

Conversation

softins
Copy link
Member

@softins softins commented Jun 10, 2024

Short description of changes

Generate the translation .qm files during build and remove them from Github.

CHANGELOG: Build: Generate qm files and embedded resource during build

Context: Fixes an issue?

This replaces previous closed PRs #2393 and #1303

The qm files are binary dependants of the ts text files. Historically they have been generated manually and stored in github. Qt versions from 5.12 include qmake rules for generating and embedding them. After a couple of years of intermittent experimentation, this PR is completely working.

The breakthrough was recently discovered in a Qt bug report. Builds for multiple architectures (e.g. on Android) or targets (Windows defaults to debug_and_release) only work if RCC_DIR and LRELEASE_DIR are allowed to default and not specified in Jamulus.pro.

Does this change need documentation? What needs to be documented and how?

It needs to be made conspicuous that Jamulus will now only build on Qt 5.12 or later. Jamulus.pro will cause qmake to exit with an error on earlier (obsolete) versions of Qt.

Status of this Pull Request

Working and ready for review.

What is missing until this pull request can be merged?

Just review and general testing.

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

@softins softins added the tooling Changes to the automated build system label Jun 10, 2024
@softins softins added this to the Release 3.11.0 milestone Jun 10, 2024
@softins softins requested review from ann0see and pljones June 10, 2024 15:52
@softins softins self-assigned this Jun 10, 2024
src/util.cpp Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
@softins softins force-pushed the embed-translations branch 2 times, most recently from 384213c to e257ad0 Compare June 10, 2024 22:03
@softins softins requested a review from pljones June 10, 2024 22:04
Jamulus.pro Outdated Show resolved Hide resolved
Jamulus.pro Outdated Show resolved Hide resolved
Previously, translations were embedded manually, via src/resources.qrc

Now they are compiled and embedded automatically, using embed_translations,
which allows them to be correctly located for multiple targets or archs.

Note that RCC_DIR and LRELEASE_DIR can no longer be specified, because the
system defaults are necessary for multiple targets/archs to build correctly.

The version of Qt must be at least 5.12 for lrelease and embed_translations.
The resources generated by embed_translations include the .qm from
the filename in the resource name, so it is necessary to remove it.
Also, the prefix generated by qmake is /i18n, not /translations.
Now that the .qm files are generated on the fly by the Makefile,
a manual lrelease step is no longer needed and wouldn't work correctly.
@softins
Copy link
Member Author

softins commented Jun 16, 2024

Once this update is merged, I can follow it up with a PR to easily solve #3092

@softins softins requested a review from ann0see June 17, 2024 16:46
Jamulus.pro Outdated Show resolved Hide resolved
Copy link
Member

@ann0see ann0see left a comment

Choose a reason for hiding this comment

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

Seems ok. I will test on windows

@ann0see ann0see added the needs documentation PRs requiring documentation changes or additions label Jun 20, 2024
Copy link
Member

@ann0see ann0see left a comment

Choose a reason for hiding this comment

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

Thanks

@ann0see ann0see merged commit 34e4d6e into jamulussoftware:main Jun 22, 2024
15 checks passed
@softins softins deleted the embed-translations branch June 26, 2024 22:24
@pljones pljones linked an issue Jun 29, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs documentation PRs requiring documentation changes or additions tooling Changes to the automated build system
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Remove QM files from source tree; generate during build process
3 participants