• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            西城

            指尖代碼,手上年華

            聯(lián)系 聚合 管理
              20 Posts :: 0 Stories :: 62 Comments :: 0 Trackbacks
            與一個(gè)大四的學(xué)生同做一個(gè)項(xiàng)目,源文件有幾十個(gè),剛開(kāi)始還在為寫(xiě)makefile發(fā)愁,幸好找到了automake工具鏈,覺(jué)得真是省了不少事。
            后來(lái)他跟我說(shuō)他用的是qmake,比用automake更省了不少事。一比較,發(fā)現(xiàn)qmake確實(shí)是一個(gè)更好地選擇。

            automake工具鏈比較復(fù)雜。一般要autoscan+修改configure.in+aclocal+寫(xiě)Makefile.am+configure+make。很不容易上手,而且
            容易出錯(cuò)。automake提供了更為精細(xì)的控制,復(fù)雜但強(qiáng)大。但其實(shí)一般我們也用不了那么多的功能,而且中間生成的那些配置文件也不在
            少數(shù)。這時(shí)候還要將源碼與makefile部分分離開(kāi)來(lái)。一般的開(kāi)源軟件就采用這種方法,文件層次清楚,易于管理。但是一般的很少的文件
            的話,我覺(jué)得用qmake就足夠了,易于上手,也不易出錯(cuò)。

            qmake一般是qmake -project/qmake/make三步,中間需要適當(dāng)?shù)匦薷纳傻?.pro文件,然后就差不多了。qmake -project主要就是用
            來(lái)生成*.pro文件。主要做的就是讀入當(dāng)前目錄的源文件。一些常用的配置變量如下:

            VariableContents
            CONFIGGeneral project configuration options.
            DESTDIRThe directory in which the executable or binary file will be placed.
            FORMSA list of UI files to be processed by uic.
            HEADERSA list of filenames of header (.h) files used when building the project.
            QTQt-specific configuration options.
            RESOURCESA list of resource (.rc) files to be included in the final project. See the The Qt Resource System for more information about these files.
            SOURCESA list of source code files to be used when building the project.
            TEMPLATEThe template to use for the project. This determines whether the output of the build process will be an application, a library, or a plugin.
            變量之間可以相互賦值比如。 TEMP_SOURCES = $$SOURCES

            Template變量比較重要:用來(lái)決定所建工程的類型:
            TemplateDescription of qmake output
            app (default)Creates a Makefile to build an application.
            libCreates a Makefile to build a library.
            subdirsCreates a Makefile containing rules for the subdirectories specified using the SUBDIRSvariable. Each subdirectory must contain its own project file.
            vcappCreates a Visual Studio Project file to build an application.
            vclibCreates a Visual Studio Project file to build a library.
            vcsubdirsCreates a Visual Studio Solution file to build projects in sub-directories.
            一般用的都是app。

            再說(shuō)上面的config變量,內(nèi)置的有:
            OptionDescription
            releaseThe project is to be built in release mode. This is ignored if debug is also specified.
            debugThe project is to be built in debug mode.
            debug_and_releaseThe project is built in both debug and release modes.
            debug_and_release_targetThe project is built in both debug and release modes. TARGET is built intoboth the debug and release directories.
            build_allIf debug_and_release is specified, the project is built in both debug and release modes by default.
            autogen_precompile_sourceAutomatically generates a .cpp file that includes the precompiled header file specified in the .pro file.
            orderedWhen using the subdirs template, this option specifies that the directories listed should be processed in the order in which they are given.
            warn_onThe compiler should output as many warnings as possible. This is ignored ifwarn_off is specified.
            warn_offThe compiler should output as few warnings as possible.
            copy_dir_filesEnables the install rule to also copy directories, not just files.

            debug_and_release建立兩個(gè)版本。config還可以加上qt,thread,X11等用來(lái)指定建立相應(yīng)的工程類型。
            如果是qt工程的話,QT變量就是一個(gè)需要關(guān)注的對(duì)象。當(dāng)用到相應(yīng)的庫(kù)時(shí),就要加上相應(yīng)的名字比如:
            OptionFeatures
            core (included by default)QtCore module
            gui (included by default)QtGui module
            networkQtNetwork module
            openglQtOpenGL module
            sqlQtSql module
            svgQtSvg module
            xmlQtXml module
            xmlpatternsQtXmlPatterns module
            qt3supportQt3Support module

            常用的就是core,gui.其他的用到時(shí)加上就行。
            另外一個(gè)比較重要問(wèn)題就是QT與其他庫(kù)的融合,LIBS和INCLUDEPATH可以做到這一點(diǎn)。看名字就知道其作用。
            和Gcc命令行參數(shù)的用法類似。


            qmake也有一些內(nèi)置的函數(shù)用來(lái)提供更為強(qiáng)大的功能。常用到的有include,可以用來(lái)包含其他的工程文件,類似于C的頭文件。還有條件控制類的,如:
            win32 {      SOURCES += paintwidget_win.cpp  }
            win32就是一個(gè)條件。甚至還有循環(huán)控制語(yǔ)句:
             EXTRAS = handlers tests docs  for(dir, EXTRAS) {      exists($$dir) {          SUBDIRS += $$dir      }  }
            這樣算下來(lái),其實(shí)qmake也挺復(fù)雜的,不過(guò)相對(duì)于automake來(lái)說(shuō),還是很容易的。


            posted on 2012-04-01 12:30 西城 閱讀(2247) 評(píng)論(3)  編輯 收藏 引用 所屬分類: Linux

            Feedback

            # re: qmake與automake 2012-04-01 13:39 yugi.fanxes
            可以嘗試下 waf 或者 cmake  回復(fù)  更多評(píng)論
              

            # re: qmake與automake 2012-04-01 13:43 墨魂
            @yugi.fanxes
            多謝  回復(fù)  更多評(píng)論
              

            # re: qmake與automake 2012-04-01 17:32 空明流轉(zhuǎn)
            CMake, Scons,都可以。不過(guò)CMake有些bug,Scons bug更多。。。  回復(fù)  更多評(píng)論
              

            亚洲国产成人久久精品99 | 久久本道久久综合伊人| 久久综合欧美成人| 久久国产V一级毛多内射| 日韩欧美亚洲国产精品字幕久久久 | 久久精品国产免费观看| 亚洲国产精品无码久久久不卡| 97r久久精品国产99国产精| 久久久青草青青国产亚洲免观| 久久亚洲中文字幕精品有坂深雪 | 欧美精品福利视频一区二区三区久久久精品 | 亚洲va久久久久| 曰曰摸天天摸人人看久久久| 囯产极品美女高潮无套久久久| 久久久久亚洲AV成人网人人软件 | 九九热久久免费视频| 99久久国产宗和精品1上映| 97精品国产97久久久久久免费| 亚洲精品无码专区久久同性男| 久久久久一区二区三区| 无遮挡粉嫩小泬久久久久久久| 久久午夜综合久久| 91麻精品国产91久久久久| 久久久免费精品re6| 亚洲va久久久噜噜噜久久狠狠| 国产精品久久久天天影视香蕉| 99久久99久久精品国产片果冻| 无码国产69精品久久久久网站| 久久亚洲国产成人影院网站| 99久久精品免费看国产免费| 97久久超碰成人精品网站| 国产成人精品三上悠亚久久| 思思久久99热只有频精品66| 国产99久久久国产精品小说| 日产久久强奸免费的看| 亚洲成人精品久久| 国产叼嘿久久精品久久| 国产免费久久精品丫丫| 久久国产免费直播| 久久综合成人网| 久久精品卫校国产小美女|