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

Port to CMake #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Port to CMake #14

wants to merge 1 commit into from

Conversation

@PureTryOut
Copy link

@PureTryOut PureTryOut commented Apr 19, 2021

Qt is slowly deprecating QMake. They have stopped building Qt itself
with QMake and moved Qt6 to CMake instead. Although QMake is still
around, it's clear the focus has shifted and it would be good for
applications to switch over to an alternative build system as well

So hereby, switch the build system to CMake

@PureTryOut PureTryOut force-pushed the PureTryOut:cmake branch from 332c7dc to 0808e95 Apr 19, 2021
@jrtberlin
Copy link
Member

@jrtberlin jrtberlin commented Apr 19, 2021

Thank you for your PR.
We discussed it and think that we have to switch to cmake at some point anyway because of the mentioned Qt6 change.
Your PR is a good start for that change.

@jrtberlin jrtberlin requested a review from MagneFire Apr 19, 2021
@PureTryOut PureTryOut force-pushed the PureTryOut:cmake branch from 0808e95 to 839f1a0 Apr 23, 2021
@PureTryOut
Copy link
Author

@PureTryOut PureTryOut commented Apr 23, 2021

Update: added CMake config files so other CMake projects can find and link to this library with find_package(AsteroidApp) and target_link_libraries(<target> AsteroidApp).

@PureTryOut
Copy link
Author

@PureTryOut PureTryOut commented Apr 23, 2021

Last change from my side, I promise 😜

I just found out about https://api.kde.org/ecm/module/ECMGeneratePkgConfigFile.html and since we already use ECM anyway, I switched the pkgconfig file to use that rather than using configure_file. Saves us a file and some lines of CMake code.

@@ -0,0 +1,8 @@
@PACKAGE_INIT@

This comment has been minimized.

@FlorentRevest

FlorentRevest May 2, 2021
Member

maybe I'm missing something but I don't see how you solved the /usr/share/applications/*.desktop file generation.

If you look at src/app/asteroidapp.prf you see that all apps have their desktop file generated out of a template file:

desktop.commands = bash $$_PRO_FILE_PWD_/i18n/generate-desktop.sh $$_PRO_FILE_PWD_ $${TARGET}.desktop

And installed into /usr/share/applications:

desktop.files = $$OUT_PWD/$${TARGET}.desktop
desktop.path = /usr/share/applications
desktop.CONFIG = no_check_exist

This is a bit convoluted but this is done so that app names can be translated via the weblate UI.

This comment has been minimized.

@PureTryOut

PureTryOut May 2, 2021
Author

I haven't at the moment. Shouldn't be too hard to do the same, but I guess you want this done from qml-asteroid rather than on the individual applications?

This comment has been minimized.

@FlorentRevest

FlorentRevest May 2, 2021
Member

mhh idk, it feels a bit out of place in qml-asteroid as well...
the idea is to keep the maintenance overhead low for all the applications so that changing how a detail works doesn't require 30 pull requests.
But generate-desktop.sh is already provided in each app anyway so that already sucks.
If asteroidapp could provide a cmake magic trick to make it easy to generate the .desktop file, I imagine it could be nice but you know cmake better, it's your call.

This comment has been minimized.

@PureTryOut

PureTryOut May 4, 2021
Author

Done it in qml-asteroid for now. A CMake module is now available which provides the CMake functions generate_desktop() and build_translations(). Other CMake package can use this to generate the desktop file and build the translations. This deduplicates the generate-desktop.sh from every repo to just a single instance provided by qml-asteroid.

In packaging everything under /usr/share/asteroidapp and /usr/bin/generate-desktop needs splitting out to a -dev package.

@PureTryOut PureTryOut force-pushed the PureTryOut:cmake branch 4 times, most recently from 253cfe4 to 8c50461 May 4, 2021
@PureTryOut PureTryOut force-pushed the PureTryOut:cmake branch 4 times, most recently from 713b649 to 471efff May 8, 2021
Qt is slowly deprecating QMake. They have stopped building Qt itself
with QMake and moved Qt6 to CMake instead. Although QMake is still
around, it's clear the focus has shifted and it would be good for
applications to switch over to an alternative build system as well

So hereby, switch the build system to CMake

This also makes qml-asteroid available for other CMake packages as
"AsteroidApp", and provides several CMake modules used to find various
Mer/SailfishOS components
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants