Review Request 125649: [OS X] install icon resources in app bundles where this doesn't happen automatically
René J.V. Bertin
rjvbertin at gmail.com
Fri Oct 16 11:52:00 BST 2015
> On Oct. 16, 2015, 12:30 a.m., Friedrich W. H. Kossebau wrote:
> > `Q_WS_MAC` is not a cmake var, or? Seems someone accidentally used the c++ macro/define here, and noone ever noticed? :)
> >
> > In Qt5/KF5/ECM worlds ecm_add_app_icon does the respective installation, right? So only the `Q_WS_MAC` fix will need porting to the master branch?
>
> René J.V. Bertin wrote:
> No, Q_WS_MAC is not something that cmake provides by default, so I guess you're right.
>
> Do calligragemini and calligraauthor get icons on Linux? For the former it seems that that should only be the case if the icon .png file(s) is/are already installed, but if that's the intended behaviour shouldn't my patch be Mac-specific? Calligraauthor's `kde4_add_app_icon` call is commented out, was that intended or should that patch *not* be Mac-specific?
>
> I have no idea at the moment what has changed in KF5/ECM. If ECM provides a function `ecm_add_app_icon` then it would make sense that it does all the required work.
> Note however that the sole use of `kde4_add_app_icon` isn't enough. It generates the icon file, and it adds the corresponding entry in the application's `Info.plist`, but that's not always enough. I haven't yet figured out why certain applications always got an icon, and why others require explicit installation of the icon resource.
>
> Friedrich W. H. Kossebau wrote:
> Yes, calligragemini has icons on linux, they are installed by the CMakeLists.txt in gemini/pics. And Author has icons as well.
> For both it was "just" those kde4_add_app_icon that were broken or not active (they do nothing on linux IIRC, that's why not noone noticed so far. And Windows builds are only done for CalligraGemini, Krita & Kexi).
>
> For `ecm_add_app_icon` see here for the sources, ll. 223-224:
> https://quickgit.kde.org/?p=extra-cmake-modules.git&a=blob&f=modules%2FECMAddAppIcon.cmake
> ```
> # Install the icon into the Resources dir in the bundle
> set_source_files_properties(${_outfilename}.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
> ```
> No idea what effect that has and if that is better than what is there in `kde4_add_app_icon`, but you might :)
No, sorry I don't. Not without delving into the cmake code. I can guess though: it installs `${_outfilename}.icns` into the `Resources` directory of the app bundle created at `MACOSX_PACKAGE_LOCATION`. It's a bit suspicious that that variable (or token) uses the term `package` instead of `bundle` (but I've learned it's useless to argue with cmake developers about such things).
Two things are required for providing an app bundle with an icon. The icon resource itself (.icns) which is expected in `foo.app/Contents/Resources`, and an entry in the `Info.plist` which declares the name of that resource. `kde4_add_app_icon` appears to guarantee only the former requirement; `ecm_add_app_icon` may be better behaved. However, looking at the `kde4_add_app_icon` source:
```
set(MACOSX_BUNDLE_ICON_FILE ${appsources}.icns)
# Append the icns file to the sources list so it will be a dependency to the
# main target
list(APPEND ${appsources} ${_outfilename}.icns)
# Install the icon into the Resources dir in the bundle
set_source_files_properties(${_outfilename}.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
```
The first line tackles the Info.plist entry, and the last line is identical to the one from `ecm_add_app_icon`.
I was going to suggest that someone more intimate with KDE's cmake build system could port the 2.9x CMake files to use ECM (ECM doesn't depend on KF5 and AFAIK it can be used with KDE4 too). However, it seems this won't change anything.
I do think that some applications didn't get icons because they were declared as kdeinit applications, but that doesn't appear to apply to all of them.
In short, it seems that for calligra 3x
- my modifications to `kde4_add_app_icon` calls can be applied to the corresponding `ecm_add_app_icon` calls
- the explicit install instructions can be copied to the corresponding locations, with syntax or name corrections where required, and then commented out so that the fixes I made here won't get lost or forgotten.
Re: `Q_WS_MAC` : it appears that this token is defined by `FindQt4.cmake` (file provided by kdelibs). To token is deprecated in Qt, so it's best not to use it.
- René J.V.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/125649/#review86899
-----------------------------------------------------------
On Oct. 15, 2015, 10:55 p.m., René J.V. Bertin wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/125649/
> -----------------------------------------------------------
>
> (Updated Oct. 15, 2015, 10:55 p.m.)
>
>
> Review request for Calligra and KDE Software on Mac OS X.
>
>
> Repository: calligra
>
>
> Description
> -------
>
> Builds on OS X currently generate icons for most Calligra applications, but those are installed only for a happy few (Krita, Braindump and Kexi). The other applications require an explicit install command of the generated `.icns` file into the app bundle's Resources directory.
>
> The attached patch takes care of that.
>
> In addition, it corrects the picture source directories for calligragemini and calligraauthor so those applications can have icons on other platforms too, and replaces the `Q_WS_MACOS` token with the (IMHO) more appropriate `APPLE` token.
>
>
> Diffs
> -----
>
> flow/part/CMakeLists.txt 58882f1
> gemini/CMakeLists.txt 85123fa
> karbon/CMakeLists.txt b574779
> plan/CMakeLists.txt ad39f57
> sheets/CMakeLists.txt b0cc134
> stage/app/CMakeLists.txt 079bece
> words/app/CMakeLists.txt 1e73971
> words/part/CMakeLists.txt 9143176
>
> Diff: https://git.reviewboard.kde.org/r/125649/diff/
>
>
> Testing
> -------
>
> On OS X 10.9 with KDELibs 4.14.12 and MacPorts 2.3.4 .
>
>
> Thanks,
>
> René J.V. Bertin
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20151016/fe2fd783/attachment.htm>
More information about the calligra-devel
mailing list