Commit Graph

11 Commits

Author SHA1 Message Date
Amir Masoud Abdol
a83b450dbc Use configure_file instead of file(COPY
As mentioned in comments, file(COPY causes rebuilding of the file every
time the project is re-configured, so, we replace it with configure_file
to avoid that.

Amend 1dcc14f2d0

Task-number: QTBUG-118191
Change-Id: I893b36fa26168f460f3ab1320a3194561c66e5df
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-31 18:36:00 +01:00
Amir Masoud Abdol
1dcc14f2d0 Use adaptive LaunchScreen on iOS
On iOS, we can use system color variables to adjust the background color
of the LaunchScreen based on user's system preference. In addition, we
can remove the app name labels, since new Xcodes don't add it anymore.

Fixes: QTBUG-118191
Change-Id: I95fef6216f1373c749ea31ff4ed085435e8998f1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-26 17:12:18 +02:00
Joerg Bornemann
fe182c1541 CMake: Add I18N_LANGUAGES keyword to qt_standard_project_setup
[ChangeLog][CMake] Added variable QT_I18N_LANGUAGES to specify the
languages that are used for i18n in the project.

[ChangeLog][CMake] Added keyword I18N_LANGUAGES to
qt_standard_project_setup to conveniently set QT_I18N_LANGUAGES.

The call
  qt_standard_project_setup(I18N_LANGUAGES hi ho)
sets the variable QT_I18N_LANGUAGES.

The target finalizers use this variable to set up CFBundleLocalizations
on Apple platforms.

qt_add_translations will be extended to read QT_I18N_LANGUAGES as well
to determine the names of .ts files if TS_FILES is not given.

Fixes: QTBUG-116716
Change-Id: I76f0753d10efb9c32947d9239e43382c9d85eb51
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-09-19 18:53:29 +02:00
Amir Masoud Abdol
594b932c58 Silence the missing BundleIdentifier warning for non-Xcode generators
It's a bit excessive to warn every developer about this, especially if
they are using non-Xcode generators; besides, we are already generating
a bundle identifier if it is missing anyway.

Pick-to: 6.5 6.6
Change-Id: Ib11ad51a0e516e0ea61ad2f7bf499b846bc0b792
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-07-06 18:06:34 +02:00
Amir Masoud Abdol
a471324a03 Use parentheses for Xcode specific variables
If I'm not mistaken we would like to leave this to Xcode, if so, we can
use `$()` to make our intention more clear in the code.

Pick-to: 6.5 6.6
Change-Id: I3867f68f371a1cf1a5db5e639ec740f2546ccd75
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-06-06 19:49:02 +00:00
Amir Masoud Abdol
1eb4d17cb4 Generate and set a CFBundleIdentifier when none were provided on macOS
When using Ninja generator on macOS, we now do a bit of extra work to
make sure that bundle identifier is always set.

- In the case where no identifier was provided, the warning message has
  been updated indicating that the user can set either of the
  properties.
- If both `MACOSX_BUNDLE_GUI_IDENTIFIER` and
  `XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER` were set but have
  different values, a warning will be shown to encourage the user to set
  only one of them.
- In addition `_qt_internal_get_ios_bundle_identifier_prefix` is renamed
  to `_qt_internal_get_apple_bundle_identifier_prefix` to be more
  platform specific.

Note:
    In general, if Ninja is the generator, we set the value of
    `MACOSX_BUNDLE_GUI_IDENTIFIER` and don't touch the
    `XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER`. If Xcode is the
    generator, we set the value of
    `XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER`, and in addition, to
    silence a Xcode warning, we set the `MACOSX_BUNDLE_GUI_IDENTIFIER`
    to `${PRODUCT_BUNDLE_IDENTIFIER}`, ie., let Xcode figures it out if
    needed.

[ChangeLog][CMake][macOS] When using Ninja generator, if neither
`XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER` nor
`MACOSX_BUNDLE_GUI_IDENTIFIER` is provided for a target, a bundle
identifier, i.e., `com.yourcompany.<teamid>.<target>` will be generated
and set as CFBundleIdentifier.

Pick-to: 6.5
Fixes: QTBUG-110889
Change-Id: Ie071085bbaf465afcb022b760423eb6b3c921f6d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-02 19:28:04 +02:00
Tor Arne Vestbø
1d3ae5f0e9 cmake: Add known translations to CFBundleLocalizations in Info.plist
For untranslated applications we set CFBundleAllowMixedLocalizations to
true, so that the application's locale will not be limited to the
development region "en".

But once we have a set of known translations, added by qt_add_translations,
we can turn these into CFBundleLocalizations, which lets macOS/iOS
choose a best match between what the app supports and what the user
preferences are.

[ChangeLog][Internationalization] Translations added via
qt_add_translations are now reflected as CFBundleLocalizations
entries in the application's Info.plist file on Apple platforms.
to disable this behavior, set QT_NO_SET_PLIST_LOCALIZATIONS.

Change-Id: I3f7ae1a1884eaf269038fa8ee49dbe6cac855706
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-02 15:12:06 +02:00
Tor Arne Vestbø
21000ede37 cmake: Always copy Info.plist to build directory manually
Allows us to modify this file in place, before CMake copies it into
the application bundle during its generator step.

Change-Id: I73325c66b5b8919f57dbaa1cc76a7edbc145609c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-02 15:12:05 +02:00
Tor Arne Vestbø
2f273f5dfd cmake: Copy template Info.plist for macOS manually, like we do for iOS
Unifies the approach between iOS and macOS. By copying the Info.plist
to the build directory, we also open up the possibility to modify it,
which we can't do when CMake does the copy during its generator step.

Change-Id: I59f9f69ac368166bb26d8a5c57bf4ea3f503d51b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-01 14:07:18 +02:00
Alexandru Croitor
865b1721bd CMake: Fix return value of applicationName() on macOS
QCore::applicationName() is influenced by what values we insert into
the Info.plist file of an application bundle.

We accidentally inserted tokens like ${PRODUCT_NAME} that are meant to
be expanded by xcodebuild, even when using a generator like Ninja.

This caused the applicationName() to report "${PRODUCT_NAME}".

Make sure to only call relevant finalizers for macOS applications
when using a generator other than Xcode.

Amends d5580aa719

Pick-to: 6.4 6.4.0
Fixes: QTBUG-106652
Change-Id: Idbc9c84557a8f17b1302e6969f6eb317e3ef225d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-09-16 14:32:51 +00:00
Alexandru Croitor
51f8eaa328 CMake: Move Apple specific functions into a separate file
Pick-to: 6.4
Task-number: QTBUG-95838
Change-Id: Ib0ce53fe0e2068482b654921ecba3232efe656c8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-30 20:36:13 +02:00