• <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>

            西城

            指尖代碼,手上年華

            聯系 聚合 管理
              20 Posts :: 0 Stories :: 62 Comments :: 0 Trackbacks
            與一個大四的學生同做一個項目,源文件有幾十個,剛開始還在為寫makefile發愁,幸好找到了automake工具鏈,覺得真是省了不少事。
            后來他跟我說他用的是qmake,比用automake更省了不少事。一比較,發現qmake確實是一個更好地選擇。

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

            qmake一般是qmake -project/qmake/make三步,中間需要適當地修改生成的*.pro文件,然后就差不多了。qmake -project主要就是用
            來生成*.pro文件。主要做的就是讀入當前目錄的源文件。一些常用的配置變量如下:

            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變量比較重要:用來決定所建工程的類型:
            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。

            再說上面的config變量,內置的有:
            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建立兩個版本。config還可以加上qt,thread,X11等用來指定建立相應的工程類型。
            如果是qt工程的話,QT變量就是一個需要關注的對象。當用到相應的庫時,就要加上相應的名字比如:
            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.其他的用到時加上就行。
            另外一個比較重要問題就是QT與其他庫的融合,LIBS和INCLUDEPATH可以做到這一點。看名字就知道其作用。
            和Gcc命令行參數的用法類似。


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


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

            Feedback

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

            # re: qmake與automake 2012-04-01 13:43 墨魂
            @yugi.fanxes
            多謝  回復  更多評論
              

            # re: qmake與automake 2012-04-01 17:32 空明流轉
            CMake, Scons,都可以。不過CMake有些bug,Scons bug更多。。。  回復  更多評論
              

            精品久久久中文字幕人妻| 亚洲中文字幕无码久久精品1| 人人狠狠综合久久亚洲88| 91久久九九无码成人网站| 无码精品久久一区二区三区| 精品久久久一二三区| 国产综合久久久久| 一本色道久久88综合日韩精品 | 久久午夜夜伦鲁鲁片免费无码影视| 久久99精品国产麻豆宅宅| 久久免费视频网站| 无码专区久久综合久中文字幕 | 成人综合久久精品色婷婷| 狠狠色丁香久久综合五月| 日韩人妻无码一区二区三区久久99| 国内精品久久久久影院优| 久久99久久99精品免视看动漫| 国产激情久久久久影院老熟女免费| 日本人妻丰满熟妇久久久久久| 久久九九久精品国产| 国产精品99久久不卡| 久久精品人人做人人爽电影蜜月 | 国产一区二区三区久久| 久久久久国产精品嫩草影院| 久久国产成人精品国产成人亚洲| 久久国产免费观看精品3| 午夜天堂av天堂久久久| 99精品国产综合久久久久五月天| 久久亚洲国产成人影院网站 | 亚洲国产精品无码久久九九| 狠狠色丁香婷综合久久| 97久久天天综合色天天综合色hd| 亚洲精品无码久久久影院相关影片| 久久99这里只有精品国产| 亚洲国产天堂久久久久久| 青草久久久国产线免观| 亚洲午夜精品久久久久久app| 三级韩国一区久久二区综合| 久久中文精品无码中文字幕| 中文成人久久久久影院免费观看| 亚洲а∨天堂久久精品9966|