前提:已下載安裝了Qt
1 下載源碼
xtuple,openrpt(報(bào)表工具),csvimp
2 編譯
先編譯openrpt,再編譯csvimp,最后編譯xtuple
盡管global.pri里允許openrpt和csvimp在xtuple目錄的../,../../,../../../,仍然建議將他們并列放置。
注:請(qǐng)勿修改這3個(gè)文件夾名稱,否則需要修改global.pri
編譯時(shí)間超過(guò)1小時(shí)
3 安裝PostgresSQL
下載:http://www.enterprisedb.com/products-services-training/pgdownload#windows
編譯完成后運(yùn)行,當(dāng)然連不上數(shù)據(jù)庫(kù)。安裝PostgresSQL 9.0,請(qǐng)不要在目錄中包含空格。
4 編譯Qt對(duì)PostgresSQL的驅(qū)動(dòng)插件
編譯方法:http://www.qtcentre.org/wiki/index.php?title=Building_the_QPSQL_plugin_on_Windows_using_MinGW
步驟進(jìn)行簡(jiǎn)單描述:
1)在支持mingw編譯器的命令行中輸入。
command:默認(rèn)不能執(zhí)行make
Qt Command Prompt:默認(rèn)不能執(zhí)行reimp
我采用了MSYS環(huán)境,并用了mingw-utils-0.3里的命令reimp
進(jìn)入PostgresSQL目錄:D:\PostgreSQL\9.0\lib,執(zhí)行:reimp libpq.lib,產(chǎn)生liblibpq.a和libpq.def
2) 修改libqp.def:將里面的'_' 全部去掉
3) 執(zhí)行命令:dlltool --input-def libpq.def --output-lib libpq.a --dllname libpq.dll
我的MSYS環(huán)境已經(jīng)包含了dlltool工具
4) 進(jìn)入Qt的目錄:D:\Qt\2010.05\qt\src\plugins\sqldrivers\psql
執(zhí)行:qmake -o Makefile "INCLUDEPATH+=D:/PostgreSQL/9.0/include" "LIBS+=D:/PostgreSQL/9.0/lib/libpq.a" psql.pro
執(zhí)行:make
5) 將PostgreSQL的bin設(shè)置為環(huán)境變量PATH中:D:\PostgreSQL\9.0\bin
5 打開(kāi)數(shù)據(jù)庫(kù),進(jìn)行初始化
打開(kāi)pgAdmin,增加數(shù)據(jù)庫(kù)demo,導(dǎo)入數(shù)據(jù)備份:postbooks_demo-3.7.0RC.backup(需下載)
增加用戶組xtrole和超級(jí)管理員admin:(Initialize PostgreSQL for xTuple (This simply means adding the super user 'admin' and the group 'xtrole'.), http://www.xtuple.org/InstallingTheDatabase)
CREATE GROUP xtrole;
CREATE USER admin WITH PASSWORD 'admin'
CREATEDB CREATEUSER
IN GROUP xtrole;
6 運(yùn)行編譯好的執(zhí)行文件,以admin/admin登錄即可。需自行設(shè)置服務(wù)器和數(shù)據(jù)庫(kù)和端口(localhost/demo/5432)。
7 運(yùn)行成功。但是調(diào)試時(shí)出現(xiàn)Warning彈出框:沒(méi)有選擇Debug構(gòu)建方式。問(wèn)題查找中....