首页>
知识库>
详情

用SDK构建meegotouch开发环境

2020-07-08 来源:CloudBest 阅读量: 0
关键词:

    也许有不少朋友会问到,网上有不少构建meego touch环境的文章了,你又何必多此一举呢?细心的朋友可能会发现,我这里不用编译QT4.7 而是用QT4.7的SDK来搭建环境的。编译QT4.7一般都需要大概一下午的时间,而是用SDK则最多不超过20分钟就搞定了。这也是希望能有更快的方法让大家来玩meego。
    下载 qt-sdk-linux-x86-opensource-2010.05-rc1.bin:
    安装 qt-sdk-linux-x86-opensource-2010.05-rc1.binchmod777 qt-sdk-linux-x86-opensource-2010.05-rc1.bin./qt-sdk-linux-x86-opensource-2010.05-rc1.bin
    下载编译好的dbus库文件(附件里),放到QT 2010.05的库里。
    安装g++
    安装依赖库文件:安装依赖库sudo apt-get install libfontconfig1-dev libfreetype6-dev libx11-dev libxcursor-dev libxext-dev libxfixes-dev libxft-dev libxi-dev libxrandr-dev libxrender-dev
    安装dbus库sudo apt-get install libgconf2-dev libdbus-qt-1-dev
    修改libmeegotouch/configure,将HAVE_DBUS=no改为yes
    安装meegotouch-theme(这个主要是一些主题css文件等。下载meegotouch-theme 代码git clone git://gitorious.org/meegotouch/meegotouch-theme.git
    进入目录meegotouch-themecd meegotouch-theme/
    执行qmake 生成makefile :qmake
    安装sudo make install
    说明: 在使用make的时候可能会说make的版本不是4.7。出现qmake与qt4的连接问题文章末尾有解决方案
    安装libmeegotouch下载源代码git clone git://gitorious.org/meegotouch/libmeegotouch.git
    安装一些依赖的库。(根据个人PC的配置情况,以及后面2.4的配置结果,可能还需要安装其他的一些依赖库)sudo apt-get install libicu-dev graphviz
    进入目录libmeegotouchcd libmeegotouch
    进入目录,生成makefile :qmake
    执行make 编译make
    安装sudo make install
    在/usr/local/lib下的目录,发现已经生成的meego 库文件
    实践:
    写一个hello world代码main.cpp代码#include <MApplication>#include <MApplicationWindow>#include <MApplicationPage>#include <MLabel>int main(int argc, char**argv){ MApplication app(argc, argv); MApplicationWindow window; MApplicationPage page; page.setTitle("My First Page"); page.setCentralWidget(new MLabel("Hello World!")); page.appear(&window); window.show();return app.exec();}
    HelloWorld.pro代码####################################################################### Automatically generated by qmake (2.01a) ?? 9? 12 21:36:22 2010######################################################################TEMPLATE= appTARGET=DEPENDPATH+= .INCLUDEPATH+= .CONFIG+= meegotouch# InputSOURCES+= main.cpp
    生成makefile文件qmake
    执行makemake
    运行程序记得要加sudosudo ./helloWorld
    程序结果如下:
    编译一个编译example目录里面的 tutorial_music_catalogue 例子tutorial_music_catalogue这个例子程序,有详细的介绍文档,在libmeegotouch的文档主页上,有个介绍 Your first MeeGo Touch application ,适合做为入门文档
    由于libmeegotouch没有安装到标准路径下,因此需要修改它的pro工程文件,打开文件 tutorial_music_catalogue.pro,在里面添加如下一段(如果meegotouch的安装路径不一样,请自行对应修改):代码unix { INCLUDEPATH+= /usr/local/include/meegotouch LIBS+= -L/usr/local/lib-lmeegotouchcore-lmeegotouchextensions-lmeegotouchsettings-lmeegotouchviews QMAKE_LFLAGS+= -Wl,-rpath,/usr/local/lib}
    执行qmake
    执行make,如果出现问题,可能是由于这个Makefile中需要调用mmoc。PATH=/usr/local/bin/:$PATH make
    运行tutorial_music_cataloguesudo ./tutorial_music_catalogue
    如果有花屏可以执行下面命令:(并非所有的电脑都会黑屏或者花屏,所以运行程序的时候,可以自行尝试一下不同的情况)sudo ./tutorial_music_catalogue-software
    程序执行后的结果图:第一页第二页第三页
    libmeegotouch程序通用的命令行参数代码MComponentData: Usage: ./tutorial_music_catalogue[-software] Enable software rendering[-fullscreen] Make the application fullscreen[-show-br] Show the bounding rectanglefor all scene items[-show-fps] Show the FPSfor the view (only with OpenGL rendering)[-log-fps] Log the FPSfor the application[-show-size] Show widget sizesin the scene[-show-object-names] Show the names of the objectsin the scene[-show-position] Show widget positionsin the scene[-show-cursor] Force the cursor to be visible[-reverse] Change the layout direction to right-to-left direction[-dev] Enable development visualization mode[-genimglist filename] Generate list of requested images to filename[-remote-theme] Waituntil remote theme daemon is available[-local-theme] Force usage of local theme processing instead of remote theme daemon[-output-level debug|warning|critical] Only show me