BB10 Cascades Command Line Development

醉酒当歌 提交于 2019-12-03 11:52:50

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/12811027/bb10-cascades-command-line-development

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!