BB10 Cascades Command Line Development
Asked Answered
S

1

13

Since programming for BB10 is now supposedly much easier if you know Qt, I decided to give it a go and I have been reading this: https://developer.blackberry.com/cascades/documentation/getting_started/index.html

I noticed that all of RIM's tutorials, and all of the online tutorials that I can find centre around the QNX Momentics IDE - a customized Eclipse.

Because I'm old school, and I like VIM, I would really prefer to work with command line tools. However, I can't seem to find any documentation on how to set up a project, the build process, or a device/emulator deployment outside of this IDE. Is that even possible? If so, does anyone have any leads on some documentation or tutorials?

Soriano answered 10/10, 2012 at 2:14 Comment(5)
Create a dummy project in the IDE, and read all the project files to see what they do and what libraries it uses and all compiler/linker flags etc. Then you could create a makefile that does the same.Ellersick
@JoachimPileborg That was my first approach, and it will probably build the target. But this IDE does deployment to device, key signing, etc stuff that will not be easy to figure out. I was hoping someone already did.Soriano
Last November I wrote a few short posts on this; see openbbnews.wordpress.com/2011/11/16/tunneltilt-github I'm sure we have better documentation at the official micro-site now. I'll look at it this evening and will get back to you then.Treadmill
Microsite is developer.blackberry.com/nativeTreadmill
Sorry, I just noticed your Q is specific about Cascades; check developer.blackberry.com/cascades for that. Its mostly a matter of emphasis - you can go from one to the otherTreadmill
T
18

I also like vi and make. The really nice thing about BB10 development is that all the QNX command line tools and makefile templates are included in the Native Development Kit so it's easy to build and deploy apps from the command line.

To start developing from the command line you'll need to:

Set the NDK environment variables

Run bbndk-env.sh found in your NDK install directory.

You should now have access to a load of binaries starting with blackberry-*. These will enable you to package and deploy your app onto the simulator or device.

Build for the arm architecture

To build binaries which will run on BB10 devices you'll need to build for the arm architecture:

qcc -Vgcc_ntoarmv7le main.c

To build for the simulator you'll need to build for the x86 architecture, assuming that's your host OS. You can view a list of all supported architectures by running qcc -V

Create the BAR descriptor XML

Every BB10 app must have a BAR descriptor file called bar-descriptor.xml. This tells the target OS how to install the app. Here's a minimal sample (my app is called 'Mini'):

<qnx>
<id>com.example.Mini</id>
<versionNumber>1</versionNumber>
<name>Mini</name>
<asset path="main" entry="true">main</asset>
</qnx>

Package, sign and deploy

Assuming you've registered with RIM to sign applications you can package your app into a BAR (BlackBerry Archive) file and deploy this to the device using these commands:

#Package the app and set the author to match the debug token author
blackberry-nativepackager -package arm/mini.bar bar-descriptor.xml -devMode -debugToken ~/Library/Research\ In\ Motion/debugtoken1.bar

#Deploy the BAR to the to the device
blackberry-deploy -installApp 169.254.0.1 -password pass arm/mini.bar

Make things easier using Makefiles

You can use the Qt tools to make life easier for you:

  1. Use qmake -project to create a .pro file. Only run this once, subsequent runs will overwrite your .pro file.
  2. Run qmake. This will generate a Makefile based on your .pro file
  3. Run make to build your project.

Further info

Check out the NDK samples here: https://github.com/blackberry/NDK-Samples and Community samples here: https://github.com/blackberry/Core-Native-Community-Samples. You can build, package and deploy all these samples to your device by running:

make CPULIST=arm EXCLUDE_VARIANTLIST=g deploy

You'll need to set your DEVICEIP and DEVICEPW environment variables to match your target.

Also check out the porting guide: http://developer.blackberry.com/native/documentation/porting_getting_started.html

Transmit answered 30/10, 2012 at 15:10 Comment(3)
Dude, thank you. I've googled long and hard and couldn't find something as concise and to the point as your answer.Soriano
This does not work for me, I run: $ source bbndk-env.sh $ qmake $ make but this gives me this error: cc: no files to process Is there a documentation somewhere describing how to build BB10 projects from command line?Rickey
Yes, try the 'Command Line Rocks' series of devblog articles (full disclosure: I am the author): devblog.blackberry.com/2013/05/building-apps-without-an-ideTransmit

© 2022 - 2024 — McMap. All rights reserved.