(一)
tao编译过程:
|
(二)
使用命令行编译ACE,TAO,CIAO等工程
下载的软件包中默认的包含vc7,vc8,vc9工程,其他平台的可以通过mwc生成,通过IDE环境打开简直就是噩梦,一会儿intelligence....一会儿vx助手又在分析,等能变异了10分钟快过去了,使用命令行编译省去了好多工作,如下:1. 进入D:/Program Files/Microsoft Visual Studio 8/Common7/Tools执行vsvars32.bat,为了准备vc环境
2. 进入D:/ACE_wrappers/TAO,执行devenv TAO_ACE_vc8.sln /build "Debug|Win32" 开始编译,开始也得等一会儿就编译了
附:devenv的命令行帮助
Microsoft (R) Visual Studio Version 8.0.50727.762.
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
Use:
devenv [solutionfile | projectfile | anyfile.ext] [switches]
The first argument for devenv is usually a solution file or project file.
You can also use any other file as the first argument if you want to have the
file open automatically in an editor. When you enter a project file, the IDE
looks for an .sln file with the same base name as the project file in the
parent directory for the project file. If no such .sln file exists, then the
IDE looks for a single .sln file that references the project. If no such single
.sln file exists, then the IDE creates an unsaved solution with a default .sln
file name that has the same base name as the project file.
Command line builds:
devenv solutionfile.sln /build solutionconfig [ /project projectnameorfile [ /projectconfig name ] ]
Available command line switches:
/Build Builds the solution or project with the specified solution
configuration. For example "Debug". If multiple platforms
are possible, the configuration name must be enclosed in quotes
and contain platform name. For example: "Debug|Win32".
/Clean Deletes build outputs.
/Command Starts the IDE and executes the command.
/Deploy Builds and then deploys the specified build configuration.
/Edit Opens the specified files in a running instance of this
application. If there are no running instances, it will
start a new instance with a simplified window layout.
/LCID Sets the default language in the IDE for the UI.
/Log Logs IDE activity to the specified file for troubleshooting.
/NoVSIP Disables the VSIP developer's license key for VSIP testing.
/Out Appends the build log to a specified file.
/Project Specifies the project to build, clean, or deploy.
Must be used with /Build, /Rebuild, /Clean, or /Deploy.
/ProjectConfig Overrides the project configuration specified in the solution
configuration. For example "Debug". If multiple platforms are
possible, the configuration name must be enclosed in quotes
and contain platform name. For example: "Debug|Win32".
Must be used with /Project.
/Rebuild Cleans and then builds the solution or project with the
specified configuration.
/ResetAddin Removes commands and command UI associated with the specified Add-in.
/ResetSettings Restores the IDE's default settings, optionally resets to
the specified VSSettings file.
/ResetSkipPkgs Clears all SkipLoading tags added to VSPackages.
/Run Compiles and runs the specified solution.
/RunExit Compiles and runs the specified solution then closes the IDE.
/SafeMode Launches the IDE in safe mode loading minimal windows.
/Upgrade Upgrades the project or the solution and all projects in it.
A backup of these files will be created as appropriate. Please
see Help on 'Visual Studio Conversion Wizard' for more
information on the backup process.
Product-specific switches:
/debugexe Open the specified executable to be debugged. The
remainder of the command line is passed to this
executable as its arguments.
/useenv Use PATH, INCLUDE, LIBPATH, and LIB environment variables
instead of IDE paths for VC++ builds.
To attach the debugger from the command line, use:
VsJITDebugger.exe -p
(三)编译ciao工程下面的RepositoryManager
我习惯称ciao为“菜鸟”
缺省的带编译工程的下载包中在ACE_wrappers/TAO/CIAO/DAnCE目录下面的DAnCE_vc8.sln中并没有包含RepositoryManager工程,打开RepositoryManager.mpc内容如下:
// -*- MPC -*-
// $Id: RepositoryManager.mpc 84671 2009-03-02 10:48:52Z johnnyw $
project (DAnCE_RepositoryManager_IDL) : ciaoidldefaults {
custom_only = 1
IDL_Files {
RepositoryManagerDaemon.idl
}
}
project (DAnCE_RepositoryManager) : dance_deployment_svnt, ciao_config_handlers, ccm_stub, dance_repository_manager_base, naming, iortable, utils, minizip, zlib {
requires += zlib
libs += Package_Config_Handlers
after += DAnCE_RepositoryManager_IDL
dynamicflags = DANCE_REPOSITORYMANAGER_MODULE_BUILD_DLL
IDL_Files {
}
Source_Files {
RepositoryManagerDaemonC.cpp
RepositoryManagerDaemonS.cpp
ZIP_Wrapper.cpp
RepositoryManager_Impl.cpp
RM_Helper.cpp
URL_Parser.cpp
PC_Updater_T.cpp
PC_Updater.cpp
Repository_Manager_Module.cpp
}
}
......
让我们简单分析一下mpc文件格式,
project (DAnCE_RepositoryManager) : dance_deployment_svnt,…
其中的project指令格式如下:
project(optional name): base_project, another_base_project {
如果optional name没有指定,工程名将取自mpc文件名,
查看上面文件内容红色部分,对于工程DAnCE_RepositoryManager需要zlib库,因此在MakeProjectCreator/config中配置包含库的选项,此文件在目录ACE_wrappers/bin/MakeProjectCreator/config下面,如果使用vc8建立工程那么打开vc8.features在里面增加zlib=1,另外还要增加xerces3=1(在其他工程中需要用到)最后使用mwc.pl命令生成工程,启动dos进入目录ACE_wrappers/TAO/CIAO/DAnCE/RepositoryManager,在命令行中输入:
perl ../../../../bin/mwc.pl -type vc8
另外工程可能还依赖其他mpc那么可以使用mpc的-include命令指定路径,比如需要ciao_lib.mpb,但是在缺省目录下找不到该文件就会提示it requires ciao_lib,ciao_lib.mpb在目录$ACE_wrappers/TAO/CIAO/MPC/config下面,那么我们在启动命令行命令时加入该路径如下所示:
perl ../../../../bin/mwc.pl –include $ACE_wrappers/TAO/CIAO/MPC/config -type vc8
查看zlib.mpc可以得知如何配置zlib库在http://www.zlib.net/下载zlib的二进制库,解压后修改里面的zdll.lib为zdll.lib,修改zdll.exp为zlib.exp,在环境变量中增加ZLIB_ROOT并指向其目录,在vc8工程的工具选项里面的vc工程中增加zlib库的目录。
另外,通过查看xerces.mpc可以得知如何配置serces库在http://xerces.apache.org/下载xerces二进制库,在环境变量中增加XERCESCROOT并指向其目录,在vc8工程的工具选项里面的vc工程中增加xerces库的目录,注意在配置vc8.feature文件时应指定是xerces2还是xerces3,这跟你下载的xerces版本相对应。
编译dance项目相关的工程时,包括其下的tools工程,会出现很多找不到路径的引用,dance开发时间不长,有些路径没有标准化,如果发现可以在工程的工具选项里面的vc工程目录中增加相应的包含文件路径。
(四)
Q:如何在Windows,Visual C++下获取、配置和构建ACE及TAO?
A:本FAQ提供 在Windows下用VisualC++安装和构建ACE+TAO的基本说明。
ACE+TAO也适用于其它主要的操作系统,例如:Linux, Solaris,
HP-UX, AIX和Tru64,还适用于一些实时,嵌入式操作系统,如
VxWorks,LynxOS, timeSys Linux和Windows CE。在Windows中,
ACE+TAO也可以用Borland C++编译器构建。
.硬件要求:
- CPU: Intel X86 P3 500 MHz或更快
- 内存:512MB (更多内存可以提高编译速度)
- 硬盘空间: 256MB交互空间+ 250MB至数GB空闲空间(取瘊于您要有
多少需要构建)
.操作系统要求:
- Windows 2000, 2003,或XP (其实Vista下我试过也可以)
.C++编译器要求:
- Microsoft Visual C++ 6.0 SP5 (新版本的ACE+TAO已不支持VC6了)
- Microsoft Visual C++ 7.1 (VS2003)
- Microsoft Visual C++ 8.0 (VS2005)
- Microsoft Visaul C++ 9.0 (VS2008)
.其他软件要求:
- WinZIP或类似的解压缩工具
- ActiveState Perl v5.6.1或更新版本(推荐,不是必需)
获取和安装ACE+TAO
1. 从下载OCI TAO 1.5a的最新补丁
http://download.ociweb.com/TAO-1.5a/ACE+TAO-1.5a_with_latest_patches.zip
或从ACE+TAO的官方网站上下载最新Beta版
http://download.dre.vanderbilt.edu/
2. 把上述压缩文件释入至没有空格的目录中(例如:C:/ACE_wrappers)
3. 设置环境变量 ACE_ROOT,TAO_ROOT和PATH.
例如:如果ACE+TAO安装至C:/ACE_wrappers,则上述环境变量如下:
* ACE_ROOT=C:/ACE_wrappers
* TAO_ROOT=%ACE_ROOT%/TAO
* PATH路径需要包含: %ACE_ROOT%/bin;%ACE_ROOT%/lib
4. 在 %ACE_ROOT%/ace 目录中config.h文件,文件内容是:
#define ACE_DISABLE_WIN32_ERROR_WINDOWS
#define ACE_HAS_STANDARD_CPP_LIBRARY 1
#define ACE_DISABLE_WIN32_INCREASE_PRIORITY
#include "ACE/config-win32.h"
5. %TAO_ROOT%/TAOACE.sln
在ACETAO工作区(workspace)中的项目构建ACE和TAO库,TAO_IDL编译器、gperf,
ORB服务库和可执行文件以及一些公共的实用工具(utilities)。他们不包含
示例、测试和性能测试。库文件将安装至%ACE_ROOT%/lib,一些可执行文件将安装
至%ACE_ROOT%/bin中,其他(ORB服务的可执行文件)将安装在他们自己的源代码所在
目录中。
如果您不想全部建议TAOACE workspace的库和可执行文件,我们建议构建Naming_Service
项目。在开发自己的应用程序里常会用到它。
如果上述的workspace文件不存在,那么你需要用MakeProjectCreator (MPC)来生成它。
命令行如下(需要Perl,上面已列出):
cd %TAO_ROOT%
%ACE_ROOT%/bin/mwc.pl -type vc71 TAOACE.mwc -- 成生visual stuido 2003 workspace文件
%ACE_ROOT%/bin/mwc.pl -type vc8 TAOACE.mwc -- 成生visual stuido 2005 workspace文件
%ACE_ROOT%/bin/mwc.pl -type vc9 TAOACE.mwc -- 成生visual stuido 2008 workspace文件