Ask / Submit

Create the example of including your own library and standard Qt module in a harbour compatible way

asked 2014-01-05 19:07:37 +0200

Artem gravatar image

Harbour rules let you use only few QML modules and libraries. You can ship libraries and modules together with your app, but.. there is zero examples for showing how to do it.

So, please, create some. For example, for gstreamer (a popular library you could like using) and for QtGraphicalEffects (as a random simple standard QtModule not including into a permitted harbour set).

Sure the examples can be created by Jolla or by any developer who sees answering to this question as an opportunity for becoming famous. We'll be happy anyway :)

P.S. Disclosure: I have personal interest in gstreamer and QtGraphicalEffects, any other lib and Qt module should be fine for the example too

edit retag flag offensive close delete



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 ( 2014-01-05 20:02:51 +0200 )edit

Please 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

1 Answer

Sort by » oldest newest most voted

answered 2014-01-12 23:47:48 +0200

Kontio gravatar image

updated 2014-02-06 16:54:51 +0200

Example for own QML Plugin has an example where the not allowed qml module is included. This example is also already in Store.

I put the files from the src folder into an own dbus folder

Needed changes

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.
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.

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.

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 has an example where the not allowed library 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
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.
add my own .pro file quazip/quazip/ as subdir target.

Harbour does not allow provides and requires[0] for own shipped libraries, so I had to add these two lines.
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].

[3] read the whole thread

edit flag offensive delete publish link more


Hi. I'm already trying to include QtLocation module into an harbour app. Problem is that QtLocation has a dependency with qt5-qtdeclarative-import-location and (seems to me) geoclue-provider-here, since I want to use HereMaps.

Do I have to follow the steps to include QML module (example one) or should I follow the second example (own library)?

Also: Do I have to include ALL the dependencies (i.e: QtLocation, qt5-declarative, etc.)?

Thanks in advance.

Pasko ( 2018-05-15 20:12:23 +0200 )edit
Login/Signup to Answer

Question tools



Asked: 2014-01-05 19:07:37 +0200

Seen: 1,830 times

Last updated: Feb 06 '14