Add support for running kmymoney from build dir
ClosedPublic

Authored by habacker on Nov 8 2018, 9:07 PM.

Diff Detail

Repository
R261 KMyMoney
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
habacker requested review of this revision.Nov 8 2018, 9:07 PM
habacker created this revision.
wojnilowicz set the repository for this revision to R261 KMyMoney.Nov 11 2018, 5:52 AM
wojnilowicz added a project: KMyMoney.
wojnilowicz added a subscriber: KMyMoney.
wojnilowicz added inline comments.Nov 11 2018, 6:29 AM
CMakeLists.txt
41

This dependency was too high for Thomas.

46

Why do you exclude other OSes?

47

Maybe we should rename namespace for plugins installation from kmymoney to kmymoney-plugins dir instead of workarounding it like that. What do you think?

48

I don't do it that way and I would not like to see these messages each time I build KMyMoney. Please put them in README.cmake

kmymoney/CMakeLists.txt
172

AFAIK, this works only on UNIX. You didn't exclude other OSes.

habacker added inline comments.Nov 15 2018, 10:19 PM
CMakeLists.txt
41

For ECM >= 5.38 some defaults are already set (https://cgit.kde.org/extra-cmake-modules.git/tree/kde-modules/KDECMakeSettings.cmake#n263)
If this version cannot be set as minimum version it is required to set all related variables

if("${ECM_GLOBAL_FIND_VERSION}" VERSION_LESS "5.38.0")
  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
  if(WIN32)
     set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
  else()
     set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
  endif()
elseif(NOT WIN32)
   set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
endif()
46

Because the default settings in ECM are okay for windows (https://cgit.kde.org/extra-cmake-modules.git/tree/kde-modules/KDECMakeSettings.cmake#n263) but not on linux and other unix based os, where shared library normally are expected below lib/

47

No, kmymoney plugins are normally installed into /usr/lib64/qt5/plugins/kmymoney/. Changing it to /usr/lib64/qt5/plugins/kmymoney-plugins/ is obsolate, because the term 'plugins' is already in the path and the subdirectory below plugins should be the application or library name.

48

sure.

kmymoney/CMakeLists.txt
172

yes. cmake does not has cross platform support for this yet. On windows there a symbolic link from bin/kmymoney to bin (see https://en.wikipedia.org/wiki/Symbolic_link) e.g.

cd bin
mklink /D kmymoney .
habacker updated this revision to Diff 45558.Nov 16 2018, 7:28 AM
  • fixed issues
  • todo: creating symlink need to be checked on windows
habacker marked 10 inline comments as done.Nov 16 2018, 7:45 AM
habacker edited the summary of this revision. (Show Details)

Just a hint: running kmymoney from build dir is useful inside an IDE like QtCreator

e.g. if kmymoney source lives in ~/src/kmymoney and build is in ~/src/kmymoney-build you can run

cd ~/src/kmymoney-build
XDG_DATA_DIRS=$XDG_DATA_DIRS:$PWD/tmp/usr/local/share \
 QT_PLUGIN_PATH=$QT_PLUGIN_PATH:$PWD/lib \
 LD_LIBRARY_PATH=$PWD/lib qtcreator ../kmymoney/CMakeLists.txt &

to compile and debug kmymoney completly inside QtCreator

habacker added inline comments.Nov 21 2018, 4:43 PM
CMakeLists.txt
41

This dependency was too high for Thomas.

Can you tell me what exactly prevents updating ECM to a newer version ? The latest kmymoney App Image uses KF5 version 5.51, but stays with ECM version 5.10.

tbaumgart added inline comments.Nov 24 2018, 9:38 AM
CMakeLists.txt
41

The AppImage is build on the KDE CI. My local dev environment is still on openSuSE 42.3 which only comes with ECM 5.32

README.cmake
166

Don't the entries need to be listed the other way around so that you can have an installed version and one in development, e.g.

$ XDG_DATA_DIRS=$PWD/tmp/usr/local/share:$XDG_DATA_DIRS \
  QT_PLUGIN_PATH=$PWD/lib:$QT_PLUGIN_PATH \

This way, the files in the build dir will be found first.

habacker updated this revision to Diff 46193.Nov 25 2018, 12:28 PM
  • use local path first in readme.cmake
  • add note why not using ECM 5.38
habacker marked 3 inline comments as done.Nov 25 2018, 12:29 PM
wojnilowicz resigned from this revision.Mar 10 2019, 6:51 AM
tbaumgart accepted this revision.Mar 24 2019, 9:03 AM
tbaumgart added inline comments.
README.cmake
154

s/to to/to/ please

This revision is now accepted and ready to land.Mar 24 2019, 9:03 AM
habacker marked an inline comment as done.Aug 29 2019, 1:02 AM
This revision was automatically updated to reflect the committed changes.
kossebau added inline comments.
CMakeLists.txt
47

Hi. Big warnings with call for action: ECM_GLOBAL_FIND_VERSION is an internal private variable of ECM that should not be used externally.

You want to use instead your own variable here, which you first set and then also pass to your find_package(ECM) call.

This is a time-bomb otherwise to blow up in the hands of distributions.

alex added a subscriber: alex.Aug 14 2021, 7:27 PM
alex added inline comments.
CMakeLists.txt
47

The ECM_GLOBAL_FIND_VERSION is also used in the kcoreaddons cmake stuff. Is this an issue too?

ostroffjh added inline comments.
CMakeLists.txt
47

this phabricator task is closed and done two years ago. If these issues are important, please raise them as a new issue on invent.kde.org.

kossebau added inline comments.Aug 14 2021, 7:47 PM
CMakeLists.txt
47

Less of an issue, as kcoreaddons is released in sync with ecm, so if ECM_GLOBAL_FIND_VERSION gets removed, kcoreaddons can be fixed in sync as well.

kcoreaddons relying on ECM_GLOBAL_FIND_VERSION is broken in other ways though, as the variable would have the value only of the last find_package(ECM x,y,z) call in the chain, which could be anyone else ensuring that ECM is present for their usage of ECM modules.

E,g. when doing find_packate(KF5Package), this includes also KF5PackageMacros.cmake, which changes the value for anything following after due to the macro file (in certain condition) calling find_package(ECM 5.83.0 CONFIG REQUIRED) during inclusion. Boom, now everyone sees ECM_GLOBAL_FIND_VERSION == 5.83.0.,

kossebau added inline comments.Aug 14 2021, 7:53 PM
CMakeLists.txt
47

task is closed

I am aware that phabricator is no longer the place for new things :) Reason I still make the comment here on the original review request is to highlight the mistake in context, and help anyone else looking at the histpory of the patch to see comments on it in place.

tbaumgart added inline comments.Aug 15 2021, 11:46 AM
CMakeLists.txt
47

@kossebau thanks for taking a look and issuing the warning. I just had a quick look and to me it seems that this whole logic is meanwhile unnecessary. Since v5.0.4 KMyMoney requires ECM 5.42 (see commit 6af6317315 and this patch has been added to the repo after v5.0.6 was released. At least that is how I read the git history.

Ooops, I must have overlooked that simple NOT which makes a difference: "NOT (5.42 < 5.38)" is equal to "(5.42 >= 5.38)". So it is executed and necessary. Forget what I wrote.