answered
2014-01-12 23:47:48 +0200
Kontio 4995 ●58 ●54 ●63 moderator
Example for own QML Plugin
https://github.com/d0b3rm4n/harbour-simpletorch has an example where the not allowed qml module https://github.com/nemomobile/nemo-qml-plugin-dbus is included. This example is also already in Store.
I put the files from the src folder into an own dbus folder
Needed changes
qmldir
rename the module to match the Harbour rules[0]. Libraries have to be in /usr/share/$NAME/lib
and I set an additional qml import path to /usr/share/$NAME/lib
so the qmldir
files goes to /usr/share/$NAME/lib/harbour/simpletorch/dbus
so the plugin (the library) can be found here ../../../
relative from the qmldir
file.
dbus.pro
new file ensure things get installed in /usr/share/$NAME/lib
and /usr/share/$NAME/lib/harbour/simpletorch/dbus
and header and source files are listed for the module.
plugin.cpp
ensure to have the correct names harbour.simpletorch.dbus
[0], this requires that the qmldir
needs to be in a folder harbour/simpletorch/dbus
in the qml import path.
harbour-simpletorch.cpp
set the qml import path to /usr/share/$NAME/lib
(Note: in SDK this expands to /opt/sdk/$NAME/usr/share/$NAME/lib
, but files are also installed there, so it works).
Imports in QML
the module can then be imported like import harbour.simpletorch.dbus 1.0
in qml files.
Example for own library
https://github.com/d0b3rm4n/harbour-sidudict has an example where the not allowed library quazip http://sourceforge.net/projects/quazip/ is included. UPDATE 06.02.2014: This app is since end of January in Store with this configuration (Sidudict version 0.2-2).
I put all the files checked out from subversion repository to a quazip folder, I didn't change any original files but added my own .pro file.
Needed changes
sidudict-quazip.pro
New file, just ensure the library gets installed to /usr/share/$NAME/lib
, luckily upstream has .pri file which contains all header and source files, so it gets just included.
harbour-sidudict.pro
add my own .pro file quazip/quazip/sidudict-quazip.pro
as subdir target.
harbour-sidudict.spec
Harbour does not allow provides and requires[0] for own shipped libraries, so I had to add these two lines.
src.pro
Line 3 tells the linker to link against which library and where to find, during build time the library is in ../quazip/quazip
. Line 5 and 6 help the compiler to find the header files for quazip (currently not used in the project). Line 7, (the pièce de résistance) sets the rpath to $ORIGIN/../share/harbour-sidudict/lib
[1] so ld
finds the library relative to the binary install path, this allows us to use it on device (/usr/bin/../share/$NAME/lib
) and with SDK (/opt/sdk/$NAME/usr/bin/../share/$NAME/lib
). The $${LITERAL_DOLLAR}
expands in the Makefile
to $
[2]. Why 2 $
are needed and the backslashes has to do with further escapes in make
and bash
[3].
[0] https://harbour.jolla.com/faq
[1] http://linux.die.net/man/8/ld-linux
[2] http://blog.qt.digia.com/blog/2012/02/09/qt-commercial-support-weekly-13-literals-in-qmake-and-loading-resources-in-qtextedit-2/
[3] http://lists.gnu.org/archive/html/help-make/2007-08/msg00042.html read the whole thread
There should be at least 2 examples:
- libraries that are precompiled and you just want to use them
- libraries that you wrote on your own and want to reuse
hardcodes.de ( 2014-01-05 20:02:51 +0200 )editPlease note that statically linking gstreamer is hard, and if you do it slightly wrong (e.g. look for plugins in standard paths) you'll be accidentally linking with a lot of system libraries, and in a way that will be indetectable to the Harbour "validator".
You should discuss about this with Jolla. I'm sure this is not what they intended.
javispedro ( 2014-01-13 01:08:41 +0200 )edit