在 Windows CE 平台上进行开发,你也许想针对多个不同的平台和SDK来编译对应的多个Qt版本。为了创建这些不同的Qt 构建版本,你并不需要复制整个的 Qt 包或Qt 源码。 你可以从同一个源码树上创建多个Qt 的构建版本。 而这些构建版本就叫做影子构建。一个影子构建是被 configure.exe 从不同的目录中创建的。
为了确保影子构建编译可以正确进行,你可以根据下面的指南来进行:
- The original Qt source package must be left untouched - configure must never have been run in the source tree directory.
- The shadow build directory must be on the same level as the Qt source package.
If the Qt package is in C:/Qt/4.5-snapshot-20091018 the shadow build directory could be C:/Qt/shadowbuild. A shadow build from a directory like C:/shadowbuild will not compile. - Avoid using "release" and "debug" in the path to the shadow build directory. (This is an internal limitation of the build system.)
- The /bin directory of the shadow build directory must be added to the PATH environment variable.
- Perl has been installed on your system. (ActivePerl is a popular distribution of Perl on Windows.)
So lets assume you have installed Qt in C:/Qt/4.5-snapshot-20091018 and you want to create a shadow build in C:/Qt/mobile5-shadow:
- First add C:/Qt/mobile5-shadow/bin to the PATH variable.
set PATH=C:/Qt/mobile5-shadow/bin;%PATH%
- Make sure the enviroment variables for your compiler are set.
Visual Studio includes vcvars32.bat for that purpose - or simply use the "Visual Studio Command Prompt" from the Start menu.
- Now navigate to your shadow build directory and run configure:
cd c:/Qt/mobile5-shadow C:/Qt/4.5-snapshot-20091018/configure.exe -platform win32-msvc2005 -xplatform wincewm50pocket-msvc2005 -release
- To build Qt, you have to update your PATH, INCLUDE and LIB paths to point to your target platforms.
For a default installation of the Windows Mobile 5.0 Pocket PC SDK, you can do the following:
set INCLUDE=C:/Program Files/Microsoft Visual Studio 8/VC/ce/include; C:/Program Files/Windows CE Tools/wce500/Windows Mobile 5.0 Pocket PC SDK/Include/Armv4i set LIB=C:/Program Files/Microsoft Visual Studio 8/VC/ce/lib/armv4i; C:/Program Files/Windows CE Tools/wce500/Windows Mobile 5.0 Pocket PC SDK/Lib/ARMV4I set PATH=C:/Program Files/Microsoft Visual Studio 8/VC/ce/bin/x86_arm; %PATH%
We have provided a convenience script for this called setcepaths. Simply type:
setcepaths wincewm50pocket-msvc2005
- Finally, to build the shadow build type:
nmake
- That's all. You have successfully created a shadow build of Qt in C:/Qt/mobile5-shadow.