玫瑰花瓣|雨丝

2008年4月10日星期四

wxWidgets的安装

下载并解压缩wxWidgets

  • 目标目录要明确,比如C:\wxWidgets-2.8.9,姑且称之为wx目录

  • 在wx目录下创建一个目录,好生成wx库
打开MSYS后,运行如下命令:

cd /c/wxWidgets-2.8.9
mkdir mswu
cd mswu

配置

../configure --with-msw --enable-unicode --with-odbc

时间过了好久好久...

结果如下:

Configured wxWidgets 2.8.9 for `i686-pc-mingw32'

Which GUI toolkit should wxWidgets use? msw
Should wxWidgets be compiled into single library? no
Should wxWidgets be compiled in debug mode? no
Should wxWidgets be linked as a shared library? yes
Should wxWidgets be compiled in Unicode mode? yes
What level of wxWidgets compatibility should be enabled?
wxWidgets 2.4 no
wxWidgets 2.6 yes
Which libraries should wxWidgets use?
jpeg builtin
png builtin
regex builtin
tiff builtin
zlib builtin
odbc yes
expat builtin
libmspack no
sdl no

make

好长好长的时间过去之后...

ok

 minimal                    工程目录
|-bin 可执行文件和目标文件
|-build bakefile工程文件(*.bkl)
| |-msw
| | |-minimal.bkl for msw的bakefile工程文件
| |-gtk2
| | |-minimal.bkl for GTK的bakefile工程文件
| |-msw.bkl 被msw/minimal.bkl所引用
| |-gtk2.bkl 被gtk2/minimal.bkl所引用
|-images 图形资源文件
|-src 源文件


wx.bkl:

<?xml version="1.0" ?>
<!-- $Id: msw.bkl,v 1.1.1.1 2008-10-15 20:27:02 by Jerry $ -->

<makefile>
<template id="wx">
<set var="wxdir">/c/wxWidgets-2.8.9/</set>
<set var="basename">wx_mswu_</set>
<set var="base">wx_baseu</set>
<set var="version">-2.8</set>

<include>$(wxdir)mswu/lib/wx/include/msw-unicode-release-2.8</include>
<include>$(wxdir)include</include>
<include>$(wxdir)contrib/include</include>
<include>include</include>
<include>images</include>
<lib-path>$(wxdir)mswu/lib</lib-path>
<lib-path>./lib</lib-path>

<sys-lib>rpcrt4</sys-lib>
<sys-lib>oleaut32</sys-lib>
<sys-lib>ole32</sys-lib>
<sys-lib>uuid</sys-lib>
<sys-lib>odbc32</sys-lib>
<sys-lib>winspool</sys-lib>
<sys-lib>winmm</sys-lib>
<sys-lib>shell32</sys-lib>
<sys-lib>comctl32</sys-lib>
<sys-lib>comdlg32</sys-lib>
<sys-lib>ctl3d32</sys-lib>
<sys-lib>advapi32</sys-lib>
<sys-lib>wsock32</sys-lib>
<sys-lib>ws2_32</sys-lib>
<sys-lib>gdi32</sys-lib>

<sys-lib>$(basename)richtext$(version)</sys-lib>
<sys-lib>$(basename)aui$(version)</sys-lib>
<sys-lib>$(basename)xrc$(version)</sys-lib>
<sys-lib>$(basename)qa$(version)</sys-lib>
<sys-lib>$(basename)html$(version)</sys-lib>
<sys-lib>$(basename)dbgrid$(version)</sys-lib>
<sys-lib>$(basename)adv$(version)</sys-lib>
<sys-lib>$(basename)core$(version)</sys-lib>
<sys-lib>$(base)_odbc$(version)</sys-lib>
<sys-lib>$(base)_xml$(version)</sys-lib>
<sys-lib>$(base)_net$(version)</sys-lib>
<sys-lib>$(base)$(version)</sys-lib>

<define>__WXMSW__</define>
<define>WXUSINGDLL</define>
<define>_IODBC_</define>

</template>

</makefile>


minimal.bkl源码如下:

<?xml version="1.0" ?>
<!-- $Id: minimal.bkl 1 2008-10-15 19:44:42 Jerry $ -->

<makefile>


<include file="../msw.bkl" />
<set var="srcdir">src</set>
<set-srcdir>src</set-srcdir>
<set var="BUILDDIR">bin</set>

<exe id="minimal" template="wx">
<dirname>bin</dirname>
<exename>minimal</exename>
<sources>minimal.cpp</sources>
<ldflags>-mthreads -Wl,--subsystem,windows -mwindows</ldflags>
<win32-res>minimal.rc</win32-res>
</exe>

</makefile>


在minimal目录下键入命令:
$ bakefile -f mingw -o Makefile build/msw/minimal.bkl

注意:Bakefile 0.2.4 的mingw选项需要更改一番以适应MinGW+MSYS环境.

以下文件在Bakefile安装目录中:

1.mingw.bkl

在output下,将SHELL项去除,否则会产生make error 127错误;
在make clean下,把原来的命令改为下列命令

$(RM) $(__builddir)/*$(OBJEXT)
$(RM) $(__builddir)/*.d

2.makefile.bkl

修改<define-tag name="clean-files"≷项,使win32和非win32的内容相同。

3.win32.bkl
修改DIRSEP为"/".
RM为"rm -f"

4.makefile_defs_mingw.bkl

_LINK_LIB_CMD项之后,删除:

if exist $0 del $o

☆ 运行上述mswu目下的wx-config,可以获知ldflags和cppflags等信息。

没有评论: