BB10级联命令行开发 [英] BB10 Cascades Command Line Development

查看:261
本文介绍了BB10级联命令行开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为编程BB10现在据说更容易,如果你知道Qt,我决定给它一个去,我一直在读这个: https://developer.blackberry.com/cascades/documentation/getting_started/index.html



我注意到所有RIM的教程,以及我可以找到的所有在线教程围绕QNX Momentics IDE - 一个定制的Eclipse。



因为我是老学校,我喜欢VIM ,我真的更喜欢使用命令行工具。但是,我似乎找不到任何关于如何设置项目,构建过程或在此IDE之外的设备/模拟器部署的文档。这是可能吗?

解决方案

我也喜欢 vi make 。关于BB10开发的真正好处是,所有的QNX命令行工具和makefile模板都包含在 Native Development Kit ,因此可以轻松地从命令行构建和部署应用程序。



要从命令行开始开发,您需要:



设置NDK环境



运行NDK安装目录中的 bbndk-env.sh



您现在应该可以访问从blackberry- *开始的二进制文件。



构建臂架构



要构建将在BB10设备上运行的二进制文件,您需要为arm结构构建:

  qcc -Vgcc_ntoarmv7le main.c 

要构建模拟器,您需要为x86架构,假设这是您的主机操作系统。您可以通过运行 qcc -V



创建BAR描述符XML来查看所有支持的体系结构的列表



每个BB10应用程式都必须有一个名为 bar-descriptor.xml 的BAR描述档。这告诉目标操作系统如何安装应用程序。这里是一个最小的示例(我的应用程序称为'Mini'):

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

打包,签名和部署



假设您已向RIM注册以签署应用程序,您可以打包将您的应用程序转换为BAR(BlackBerry Archive)文件,并使用以下命令将其部署到设备:

 #包装应用程序并设置作者匹配调试令牌作者
blackberry-nativepackager -package arm / mini.bar bar-descriptor.xml -devMode -debugToken〜/ Library / Research\ In \ Motion / debugtoken1.bar

#将BAR部署到设备
blackberry-deploy -installApp 169.254.0.1 -password pass arm / mini.bar

使用Makefiles简化操作



您可以使用Qt工具您:


  1. 使用 qmake -project 创建 .pro file 。只运行一次,后续运行将覆盖您的.pro文件。

  2. 运行 qmake 。这将根据您的.pro文件生成 Makefile

  3. 运行 make


  4. p>查看NDK示例: https://github.com/blackberry/NDK-Samples和社区示例: https://github.com/blackberry/Core-Native-Community示例。您可以通过运行以下命令来构建,打包和部署所有这些示例到您的设备:

      make CPULIST = arm EXCLUDE_VARIANTLIST = g deploy 

    您需要设置 DEVICEIP code> DEVICEPW 环境变量以符合您的目标。



    还可以查看移植指南: http://developer.blackberry.com/native/documentation/porting_getting_started.html


    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?

    解决方案

    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

    这篇关于BB10级联命令行开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆