Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 136
Registered: ‎02-01-2009
My Device: Not Specified

Library projects in Cascades

Like in Android / BlackBerry Java or any other platform, the reusable components can be pushed to a library or similar Library projects to which the main project can be made depended.

 

Is there any similar approach of Library projects for Cascades?

BlackBerry Development Advisor
Posts: 35
Registered: ‎08-01-2012
My Device: BB10 alpha-BB10 developer

Re: Library projects in Cascades

There will be a KB article for how to achieve this task, and there are serveral ways of doing so.

 

One of them is as follows:

 

Part 1: create a cascaes project for shared/static lib.

 

 From the qde,  Create a Cascades C++ Project.

 

After the IDE generates the project skeleton from the project template, modify the QT project file, e.g.: the “.pro” file.

Change the line:

 

TEMPLATE = app

 

 

To be

 

TEMPLATE = lib

 

You can add

 

CONFIG  += staticlib

 

if you want to build static lib files not only share lib files.

 

 

Build the project, it will generate the desired lib files.

 

Part 2: compile the "main" cascades project to use the lib project

 

 Edit the .pro file to update the INCLUDEPATH to add the path of the header files of the pre-built header libs.

 

 INCLUDEPATH += <Path to the lib header files>

 

 

Edit the .pro file to update the LIBS to add the pre-built libs.

 

 

LIBS += -L<path to the  libs>  -l<lib name>

 

for example: if your object file is “/usr/someuser/workdir/libdummy.so”,

  

 LIBS += -L/usr/someuser/workdir/  -ldummy

 

 

Part 3: bundle the libs together with the main app so that they will be deployed on the target.

 

You can manually add the shared lib files to the project “assets”,  then manually edit the value of “LD_LIBRARY_PATH" in the bar-descriptor.xml file to contain the path pointing to the bundled shared lib files.

 

For example, if you copy shared lib files to the “assets/myLib”, then, you will have

 

<env var="LD_LIBRARY_PATH" value=" app/native/assets/myLib:/app/native/lib:/usr/lib/qt4/lib"/>

 

Hope this will help.

 

 

Developer
Posts: 136
Registered: ‎02-01-2009
My Device: Not Specified

Re: Library projects in Cascades

Thanks, I'll give it a try.

By any chance this would be made simpler by the UI of eclipse dialogs itself :smileyhappy:
BlackBerry Development Advisor
Posts: 35
Registered: ‎08-01-2012
My Device: BB10 alpha-BB10 developer

Re: Library projects in Cascades

As far as I know, the process of creating and bundling shared libs still at least needs users' manully edit the QT project files.

However, as mentioned in the previous reply, an KB article is being created to help clarify the steps to achieve this task.