經過4天的努力,我終于把QtiPlot_0.9.7.14這個版本的軟體編譯成功了,在此時此刻與廣大開源愛好者一起分享,同時感謝“于湛的部落格”中提到的方法,他的編譯的方法雖然是适合于舊的版本,但是啟發意義非同小可。終于通過這個軟體讓我真正進入了開源的新時代,可以說對于我的工作領域的擴大以及人生心結的解開有非常大的意義。
其實高中時候上了一門VB課,從此在我心裡頭就對程式有了心結,學的時候特别痛苦,大學的時候更是影響到了C語言的學習。參加工作後,我覺得自己一定要克服這個心結,于是對于各種語言都努力實作,終于在此時我學會了編譯,再也不怕程式設計了。
好了,言歸正傳,開始講述編譯的過程。一定要做好長時間編譯的準備,我用的是惠普HP6531,作業系統是Vista,每次編譯最終的檔案需要一個半小時。
1.首先從http://soft.proindependent.com/download.html把源代碼下載下傳下來,我下載下傳的是QtiPlot_0.9.7.14這個版本,作者已經修改了很多的的bug,完善了很多。
2.把源代碼解壓縮到一個檔案夾裡,一定要注意這個檔案的路徑是全英文的,比如我的解壓縮的路徑就是這樣的:I:/x/qtiplot-0.9.7.14,然後在這個路徑裡面列舉以下的檔案:
-3rdparty
-----liborigin -----QTeXEngine
-----qwt
-----qwtplot3d
-----zlib
-fitPlugins
-manual
-qtiplot
.gitignore
build.conf.example
Doxyfile
gpl_licence.txt
qtiplot.1
qtiplot.css
qtiplot.pro
qtiplot_logo.png
README.html
這個版本中的第三方插件感覺和以前的不同了,比如沒有了EMFEngine,取而代之的是QtexEngine。我記得于湛部落格中曾經提到編譯EMFEngine也還挺複雜,現在好了,不用編譯了。
首先要讀源代碼中的README.html,這個檔案會交給你如何編譯。
接下來按照說明将build.conf.example 改為build.conf,并正确設定其中一些庫的路徑。在文章的最後我附上了Qtiplot0.9.8.2的Build.conf和qtiplot.pro的具體内容以供大家參考。
好了,開始編譯。
首先到了總目錄下面(I:/x/qtiplot-0.9.7.14),然後輸入qmake,回車;接着再輸入mingw32-make,回車。執行完這個步驟你就可以等了,前提是第三方插件你都已經編譯好了。
如果想讓程式包含有Python腳本功能的話,一定要安裝Python,SIP和PyQT。
第一步,目前(2010.09)最穩定的版本Python是2.5(而且源代碼中的Python是按照2.5的文法寫的),是以首先要安裝Python2.5。
第二步,下載下傳SIP-4.11,這個需要自己編譯。首先打開cmd輸入C:/Python25/python configure.py --platform win32-g++;然後打開“QT Command Prompt”在裡面輸入mingw32-make;最後輸入mingw32-make -install。這樣所有的檔案就自動複制到了C:/Python25裡面,最重要的一個檔案是SIP.exe。
第三步,下載下傳PyQt-4.7.6,這個也需要自己編譯。首先打開cmd輸入C:/Python25/python configure.py;然後打開“QT Command Prompt”在裡面輸入mingw32-make;最後輸入mingw32-make -install。這樣所有的檔案就自動複制到了C:/Python25裡面。
當添加了Python的功能後,運作Qtiplot的時候就一定要記住載入Python Configuration File,這3個檔案就在源代碼裡面,如下:
/qtiplot/qti_wordlist.txt
/qtiplot/qtiplotrc.py
/qtiplot/qtiUtil.py
注意:運作Python的時候一定要注意以上三個檔案不能放在中文的檔案夾裡面,否則無法運作程式。
在此處寫一段簡單的程式:如果想深入學習的話,請參開這裡。
CreateObj.py
# create an empty table named "tony" with 5 rows and 2 columns:
t = newTable("tony", 5, 2)
# use defaults
t = newTable()
# create an empty matrix named "gina" with 42 rows and 23 columns:
#m = newMatrix("gina", 42, 23)
# use defaults
#m = newMatrix()
# create an empty graph window
g = newGraph()
# create a graph window named "test" with two layers disposed on a 2 rows x 1 column grid
g = newGraph("test", 2, 2, 1)
# create an empty 3D plot window with default title
#p = newPlot3D()
# create an empty note named "momo"
n = newNote("momo")
# use defaults
n = newNote()
最後附上
1.Build.conf:
isEmpty( QTI_ROOT ) {
message( "each file including this config needs to set QTI_ROOT to the dir containing this file!" )
}
##########################################################
## System specific configuration
##########################################################
# Global include path which is always added at the end of the INCLUDEPATH
SYS_INCLUDEPATH = /opt/local/include
# Global lib path and libs which is ls always added at the end of LIBS
SYS_LIBS = -L/opt/local/lib
##########################################################
## muParser (http://muparser.sourceforge.net/)
##########################################################
# include path. leave it blank to use SYS_INCLUDE
MUPARSER_INCLUDEPATH = $$QTI_ROOT/3rdparty/muparser/include
# link statically against a copy in 3rdparty/
MUPARSER_LIBS = $$QTI_ROOT/3rdparty/muparser/lib/libmuparser.a
# or dynamically against a system-wide installation
#MUPARSER_LIBS = -lmuparser
##########################################################
## GNU Sientific Library (http://www.gnu.org/software/gsl/)
##########################################################
# include path. leave it blank to use SYS_INCLUDE
GSL_INCLUDEPATH = $$QTI_ROOT/3rdparty/gsl/include
# link statically against a copy in 3rdparty/
GSL_LIBS = $$QTI_ROOT/3rdparty/gsl/lib/libgsl.a /
$$QTI_ROOT/3rdparty/gsl/lib/libgslcblas.a
# or dynamically against a system-wide installation
#GSL_LIBS = -lgsl -lgslcblas
##########################################################
## Boost libraries (http://www.boost.org/)
##########################################################
# include path. leave it blank to use SYS_INCLUDE
BOOST_INCLUDEPATH = "C:/Program Files/boost/boost_1_42"
# link statically against a copy in 3rdparty/
unix: BOOST_LIBS = $$QTI_ROOT/3rdparty/boost/lib/libboost_date_time-gcc43-mt-1_38.a /
$$QTI_ROOT/3rdparty/boost/lib/libboost_thread-gcc43-mt-1_38.a
win32:BOOST_LIBS = "C:/Program Files/boost/boost_1_42/stage/lib/libboost_date_time-mgw44-mt.lib" /
"C:/Program Files/boost/boost_1_42/stage/lib/libboost_thread-mgw44-mt.lib"
# or dynamically against a system-wide installation
#BOOST_LIBS = -lboost_date_time-mt -lboost_thread-mt
##########################################################
## QWT - use local copy till upstream catches up
# http://qwt.sourceforge.net/index.html
##########################################################
# include path.
QWT_INCLUDEPATH = $$QTI_ROOT/3rdparty/qwt/src
# link locally against a copy in 3rdparty/
QWT_LIBS = $$QTI_ROOT/3rdparty/qwt/lib/libqwt.a
##########################################################
## QwtPlot3D - use local copy till upstream catches up
# http://qwtplot3d.sourceforge.net/
##########################################################
# include path.
QWT3D_INCLUDEPATH = $$QTI_ROOT/3rdparty/qwtplot3d/include
# link locally against a copy in 3rdparty/
win32:QWT3D_LIBS = $$QTI_ROOT/3rdparty/qwtplot3d/lib/qwtplot3d.dll
unix:QWT3D_LIBS = $$QTI_ROOT/3rdparty/qwtplot3d/lib/libqwtplot3d.a
##########################################################
## ExcelFormat - optional. you don't have to set these variables
##(http://www.codeproject.com/KB/office/ExcelFormat.aspx)
##########################################################
# include path.
#XLS_INCLUDEPATH = $$QTI_ROOT/3rdparty/ExcelFormat/
# link locally against a copy in 3rdparty/
#XLS_LIBS = $$QTI_ROOT/3rdparty/ExcelFormat/lib/libExcelFormat.a
###########################################################
## QuaZIP - optional. you don't have to set these variables
# http://quazip.sourceforge.net/
###########################################################
# include path.
QUAZIP_INCLUDEPATH = $$QTI_ROOT/3rdparty/quazip/quazip/
# link locally against a copy in 3rdparty/
QUAZIP_LIBS = $$QTI_ROOT/3rdparty/quazip/lib/libquazip.a
##########################################################
## libpng - optional. you don't have to set these variables
##########################################################
# include path. leave it blank to use SYS_INCLUDE
LIBPNG_INCLUDEPATH = $$QTI_ROOT/3rdparty/libpng/
# link statically against a copy in 3rdparty/
LIBPNG_LIBS = $$QTI_ROOT/3rdparty/libpng/libpng.a
# or dynamically against a system-wide installation
#LIBPNG_LIBS = -lpng
##########################################################
## EmfEngine - optional. you don't have to set these variables
# http://soft.proindependent.com/emf/index.html
##########################################################
# include path.
#EMF_ENGINE_INCLUDEPATH = $$QTI_ROOT/3rdparty/EmfEngine/src
# link locally against a copy in 3rdparty/
#EMF_ENGINE_LIBS = $$QTI_ROOT/3rdparty/EmfEngine/libEmfEngine.a
##########################################################
## python - only used if python is needed
##########################################################
# the python interpreter to use
# (unix only, windows will use what ever is configured to execute .py files!)
PYTHON = python
##########################################################
## Qt tools - allows to use specific versions
##########################################################
LUPDATE = lupdate
LRELEASE = lrelease
############################################################
## Target specific configuration: configure Qtiplot itself
############################################################
contains( TARGET, qtiplot ) {
# building without muParser doesn't work yet
SCRIPTING_LANGS += muParser
SCRIPTING_LANGS += Python
# a console displaying output of scripts; particularly useful on Windows
# where running QtiPlot from a terminal is inconvenient
DEFINES += SCRIPTING_CONSOLE
#DEFINES += QTIPLOT_DEMO
# Comment the following lines to disable donations start-up message.
#DEFINES += QTIPLOT_SUPPORT
# Uncomment the following line if you want to perform a custom installation using the *.path variables defined in ./qtiplot.pro.
#CONFIG += CustomInstall
# Uncomment the following line if you want to build QtiPlot as a browser plugin (not working on Internet Explorer).
#CONFIG += BrowserPlugin
CONFIG += release
#CONFIG += debug
#win32: CONFIG += console
}
2.qtiplot.pro
TEMPLATE = subdirs
SUBDIRS = fitPlugins /
3rdparty/qwt /
3rdparty/qwtplot3d /
qtiplot http://hi.baidu.com/kxw102/blog/item/3fc97e9ab9ab1fbbc8eaf4f9.html