While cross-compiling Kdenlive with MXE, I had to use host's qrcAlias.
I followed the standard pattern, checking CMAKE_CROSSCOMPILING and the defined tool path.
Details
- Reviewers
apol kfunk - Maniphest Tasks
- T6715: Add cross compilation support for breeze-icons QRC generator
Using it to build Kdenlive for 1 year (several ECM/Qt updates)
Diff Detail
- Repository
- R266 Breeze Icons
- Lint
Lint Skipped - Unit
Unit Tests Skipped
CMakeLists.txt | ||
---|---|---|
33 | Maybe some documentation on how to crosscompile it would be nice. |
Thank you Aleix,
You're right!
Before launching cmake for cross compiling, I build the tool for host (this requires to have Qt5 dev files on build host):
I haven't found a way to access the host compiler & libs within cmake (which has a toolchain file to switch to cross-compiling).
My complete cross compiling sequence is (in Makefile syntax for MXE):
cd "$(1)" && $(BUILD_CXX) -std=c++11 qrcAlias.cpp -o $(PREFIX)/bin/qrcAlias -fPIC $(shell pkg-config --cflags Qt5Core --libs Qt5Core) mkdir "$(1)/build" cd "$(1)/build" && cmake .. \ -DCMAKE_TOOLCHAIN_FILE="$(CMAKE_TOOLCHAIN_FILE)" \ -DCMAKE_BUILD_TYPE=Release \ -DKDE_INSTALL_USE_QT_SYS_PATHS=ON \ -DBUILD_TESTING=OFF \ -DBINARY_ICONS_RESOURCE=ON \ -DQRCALIAS_EXECUTABLE=$(PREFIX)/bin/qrcAlias $(MAKE) -C "$(1)/build" -j $(JOBS) install
Would you have directions for a better approach? Or should I just add in comment the line to build qrcAlias?
I wanted to have a look at how KF5_HOST_TOOLING works, but couldn't find where it is defined in ECM or in the frameworks that use it (kdecoration, kdeclarative)...
Edit: I've found this link, which of course implies building everything twice...
Note: if you want to see the rest of frameworks cross-building for Kdenlive
Hey @vpinon. What's special about qrcAlias is that it's not installed. Usually this kind of tooling (thinking kconfigcompiler) is installed, then there's an easy way to pull it in.
I'd say that the ideal way to treat this is by rewriting the tool in cmake scripts (or python or a scripting language we agree it makes sense). This way this becomes a no-brainer.
As for this patch, I'd suggest adding something in README.md such as:
If you are crosscompiling breeze-icons and need a binary resource, remember to define the following variable -DQRCALIAS_EXECUTABLE.
It isn't straightforward but it's also not a shot in the dark.
Something like this could be done here too D11735.
It's better because it allows the project to self-compile instead of relying on a pre-built version of the tool that isn't even being installed.