vcproject_gen.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- Python -*-
00003 #
00004 
00005 #  @file vcproject_gen.py
00006 #  @brief rtc-template VC++ project file generator class
00007 #  @date $Date: 2007/09/26 07:43:29 $
00008 #  @author Noriaki Ando <n-ando@aist.go.jp> and S.Kurihara
00009 
00010 import re
00011 import os
00012 import time
00013 import StringIO
00014 import ezt
00015 import gen_base
00016 import uuid
00017 
00018 def description():
00019         return "VC++ project-file generator"
00020 
00021 def usage_short():
00022         """
00023         VC++ project-file generator specific usage (short version)
00024         """
00025         return """
00026 Options for VC++ backend:
00027 
00028 """
00029 
00030 def usage():
00031         """
00032         VC++ project-file generator specific usage
00033         """
00034         return """
00035 -------------------------------
00036   Help for VC++ project-file geenrator
00037 -------------------------------
00038 """
00039 
00040 def get_opt_fmt():
00041         opt_args_fmt = []
00042         return opt_args_fmt
00043 
00044 
00045 proj_file = """<?xml version="1.0" encoding="shift_jis"?>
00046 <VisualStudioProject
00047         ProjectType="Visual C++"
00048         Version="[vc_version]"
00049         Name="[fname]"
00050         ProjectGUID="[guid]"
00051         RootNamespace="[fname]"
00052         Keyword="Win32Proj"
00053         >
00054         <Platforms>
00055                 <Platform
00056                         Name="Win32"
00057                 />
00058         </Platforms>
00059         <ToolFiles>
00060         </ToolFiles>
00061         <Configurations>
00062                 <Configuration
00063                         Name="Debug|Win32"
00064                         OutputDirectory=".\\Debug"
00065                         IntermediateDirectory=".\\Debug"
00066                         ConfigurationType="1"
00067                         InheritedPropertySheets=".\\OpenRTM-aist.vsprops"
00068                         CharacterSet="2"
00069                         >
00070                         <Tool
00071                                 Name="VCPreBuildEventTool"
00072                         />
00073                         <Tool
00074                                 Name="VCCustomBuildTool"
00075                         />
00076                         <Tool
00077                                 Name="VCXMLDataGeneratorTool"
00078                         />
00079                         <Tool
00080                                 Name="VCWebServiceProxyGeneratorTool"
00081                         />
00082                         <Tool
00083                                 Name="VCMIDLTool"
00084                         />
00085                         <Tool
00086                                 Name="VCCLCompilerTool"
00087                                 Optimization="0"
00088                                 PreprocessorDefinitions="USE_stub_in_nt_dll;WIN32;_DEBUG;_CONSOLE;__WIN32__;__x86__;_WIN32_WINNT=0x0400;__NT__;__OSVERSION__=4;_CRT_SECURE_NO_DEPRECATE"
00089                                 MinimalRebuild="true"
00090                                 BasicRuntimeChecks="3"
00091                                 RuntimeLibrary="3"
00092                                 UsePrecompiledHeader="0"
00093                                 WarningLevel="3"
00094                                 Detect64BitPortabilityProblems="false"
00095                                 DebugInformationFormat="4"
00096                         />
00097                         <Tool
00098                                 Name="VCManagedResourceCompilerTool"
00099                         />
00100                         <Tool
00101                                 Name="VCResourceCompilerTool"
00102                         />
00103                         <Tool
00104                                 Name="VCPreLinkEventTool"
00105                         />
00106                         <Tool
00107                                 Name="VCLinkerTool"
00108                                 AdditionalDependencies="ACEd.lib RTC041d.lib omniORB407_rtd.lib omniDynamic407_rtd.lib omnithread32_rtd.lib advapi32.lib ws2_32.lib mswsock.lib"
00109                                 OutputFile="$(OutDir)\\[fname].exe"
00110                                 LinkIncremental="2"
00111                                 IgnoreDefaultLibraryNames=""
00112                                 GenerateDebugInformation="true"
00113                                 SubSystem="1"
00114                                 TargetMachine="1"
00115                         />
00116                         <Tool
00117                                 Name="VCALinkTool"
00118                         />
00119                         <Tool
00120                                 Name="VCManifestTool"
00121                         />
00122                         <Tool
00123                                 Name="VCXDCMakeTool"
00124                         />
00125                         <Tool
00126                                 Name="VCBscMakeTool"
00127                         />
00128                         <Tool
00129                                 Name="VCFxCopTool"
00130                         />
00131                         <Tool
00132                                 Name="VCAppVerifierTool"
00133                         />
00134                         <Tool
00135                                 Name="VCWebDeploymentTool"
00136                         />
00137                         <Tool
00138                                 Name="VCPostBuildEventTool"
00139                         />
00140                 </Configuration>
00141                 <Configuration
00142                         Name="Release|Win32"
00143                         OutputDirectory=".\\Release"
00144                         IntermediateDirectory=".\\Release"
00145                         ConfigurationType="1"
00146                         InheritedPropertySheets=".\\OpenRTM-aist.vsprops"
00147                         CharacterSet="0"
00148                         WholeProgramOptimization="0"
00149                         >
00150                         <Tool
00151                                 Name="VCPreBuildEventTool"
00152                         />
00153                         <Tool
00154                                 Name="VCCustomBuildTool"
00155                         />
00156                         <Tool
00157                                 Name="VCXMLDataGeneratorTool"
00158                         />
00159                         <Tool
00160                                 Name="VCWebServiceProxyGeneratorTool"
00161                         />
00162                         <Tool
00163                                 Name="VCMIDLTool"
00164                         />
00165                         <Tool
00166                                 Name="VCCLCompilerTool"
00167                                 PreprocessorDefinitions="USE_stub_in_nt_dll;WIN32;NDEBUG;_CONSOLE;__WIN32__;__x86__;_WIN32_WINNT=0x0400;__NT__;__OSVERSION__=4"
00168                                 RuntimeLibrary="2"
00169                                 UsePrecompiledHeader="0"
00170                                 WarningLevel="3"
00171                                 Detect64BitPortabilityProblems="false"
00172                                 DebugInformationFormat="3"
00173                         />
00174                         <Tool
00175                                 Name="VCManagedResourceCompilerTool"
00176                         />
00177                         <Tool
00178                                 Name="VCResourceCompilerTool"
00179                         />
00180                         <Tool
00181                                 Name="VCPreLinkEventTool"
00182                         />
00183                         <Tool
00184                                 Name="VCLinkerTool"
00185                                 AdditionalDependencies="ACE.lib RTC041.lib omniORB407_rt.lib omniDynamic407_rt.lib omnithread32_rt.lib advapi32.lib ws2_32.lib mswsock.lib"
00186                                 OutputFile="$(OutDir)/$(ProjectName).exe"
00187                                 LinkIncremental="1"
00188                                 GenerateDebugInformation="false"
00189                                 SubSystem="1"
00190                                 OptimizeReferences="2"
00191                                 EnableCOMDATFolding="2"
00192                                 LinkTimeCodeGeneration="0"
00193                                 TargetMachine="1"
00194                         />
00195                         <Tool
00196                                 Name="VCALinkTool"
00197                         />
00198                         <Tool
00199                                 Name="VCManifestTool"
00200                         />
00201                         <Tool
00202                                 Name="VCXDCMakeTool"
00203                         />
00204                         <Tool
00205                                 Name="VCBscMakeTool"
00206                         />
00207                         <Tool
00208                                 Name="VCFxCopTool"
00209                         />
00210                         <Tool
00211                                 Name="VCAppVerifierTool"
00212                         />
00213                         <Tool
00214                                 Name="VCWebDeploymentTool"
00215                         />
00216                         <Tool
00217                                 Name="VCPostBuildEventTool"
00218                         />
00219                 </Configuration>
00220         </Configurations>
00221         <References>
00222         </References>
00223         <Files>
00224                 <Filter
00225                         Name="source file"
00226                         Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
00227                         UniqueIdentifier="[SourceGUID]"
00228                         >
00229                         <File
00230                                 RelativePath=".\\[fname_cpp]"
00231                                 >
00232                         </File>
00233                         <File
00234                                 RelativePath=".\\[fname_comp]"
00235                                 >
00236                         </File>
00237                 </Filter>
00238                 <Filter
00239                         Name="header file"
00240                         Filter="h;hpp;hxx;hm;inl;inc;xsd"
00241                         UniqueIdentifier="[HeaderGUID]"
00242                         >
00243                         <File
00244                                 RelativePath=".\\[fname_h]"
00245                                 >
00246                         </File>
00247                 </Filter>
00248                 <Filter
00249                         Name="resource file"
00250                         Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
00251                         UniqueIdentifier="[ResourceGUID]"
00252                         >
00253                 </Filter>
00254         </Files>
00255         <Globals>
00256         </Globals>
00257 </VisualStudioProject>
00258 """ 
00259 
00260 props_file = """<?xml version="1.0" encoding="shift_jis"?>
00261 <VisualStudioPropertySheet
00262         ProjectType="Visual C++"
00263         Version="8.00"
00264         Name="OpenRTM-aist-0.4"
00265         >
00266         <Tool
00267                 Name="VCCLCompilerTool"
00268                 AdditionalIncludeDirectories="&quot;$(rtm_root)&quot;;&quot;$(rtm_root)\\rtm\\idl&quot;;&quot;$(ace_include)&quot;;&quot;$(omni_include)&quot;;."
00269         />
00270         <Tool
00271                 Name="VCLinkerTool"
00272                 AdditionalLibraryDirectories="&quot;$(rtm_root)\\bin&quot;;&quot;$(ace_libdir)&quot;;&quot;$(omni_libdir)&quot;"
00273         />
00274         <UserMacro
00275                 Name="ace_root"
00276                 Value="%ACE_ROOT%"
00277         />
00278         <UserMacro
00279                 Name="omni_root"
00280                 Value="%OMNI_ROOT%"
00281         />
00282         <UserMacro
00283                 Name="rtm_root"
00284                 Value="%RTM_ROOT%"
00285         />
00286         <UserMacro
00287                 Name="ace_include"
00288                 Value="$(ace_root)"
00289         />
00290         <UserMacro
00291                 Name="ace_libdir"
00292                 Value="$(ace_root)\\lib"
00293         />
00294         <UserMacro
00295                 Name="omni_include"
00296                 Value="$(omni_root)\\include"
00297         />
00298         <UserMacro
00299                 Name="omni_libdir"
00300                 Value="$(omni_root)\\lib\\x86_win32"
00301         />
00302         <UserMacro
00303                 Name="omni_bin"
00304                 Value="$(omni_root)\\bin\\x86_win32"
00305         />
00306         <UserMacro
00307                 Name="rtm_includes"
00308                 Value="&quot;$(rtm_root)&quot;;&quot;$(rtm_root)\\rtm\\idl&quot;;&quot;$(ace_include)&quot;;&quot;$(omni_include)&quot;;."
00309         />
00310         <UserMacro
00311                 Name="rtm_libdir"
00312                 Value="&quot;$(rtm_root)\\bin&quot;;&quot;$(ace_libdir)&quot;;&quot;$(omni_libdir)&quot;;."
00313         />
00314         <UserMacro
00315                 Name="rtm_path"
00316                 Value="&quot;$(rtm_root)\\bin&quot;;&quot;$(rtm_root)\\build&quot;;&quot;$(omni_bin)&quot;"
00317         />
00318 </VisualStudioPropertySheet>
00319 """
00320 
00321 
00322 class vcproject_gen(gen_base.gen_base):
00323         """
00324         VC++ project-file generator
00325         """
00326         _fname_space = 16
00327         def __init__(self, data, opts):
00328                 self.data = data.copy()
00329 
00330                 self.data["begin_brace"] = "["
00331                 self.data["end_brace"] = "]"
00332                 self.data["vcproject_file"] = self.data["fname"] + ".vcproj"
00333                 self.data["props_file"] = "OpenRTM-aist.vsprops"
00334                 self.data["l_name"] = self.data["fname"].lower()
00335                 self.data["guid"] = uuid.uuid1()
00336                 self.data["SourceGUID"] = uuid.uuid1()
00337                 self.data["HeaderGUID"] = uuid.uuid1()
00338                 self.data["ResourceGUID"] = uuid.uuid1()
00339                 self.data["vc_version"] = "8.00"
00340                 self.data["fname_h"] = self.data["fname"] + ".h"
00341                 self.data["fname_cpp"] = self.data["fname"] + ".cpp"
00342                 self.data["fname_comp"] = self.data["fname"] + "Comp.cpp"
00343 
00344                 self.tags = {}
00345                 self.gen_tags(self.tags)
00346 
00347                 return
00348 
00349         def print_vcproject(self):
00350                 """
00351                 Generate VC++ project-file
00352                 """
00353                 self.gen(self.data["props_file"],
00354                          props_file, self.data, self.tags)
00355 
00356                 self.gen(self.data["vcproject_file"],
00357                          proj_file, self.data, self.tags)
00358                 return
00359 
00360 
00361         def print_all(self):
00362                 self.print_vcproject()


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Thu Aug 27 2015 14:17:28