资源简介
一个由源文件自动生成vs工程的脚本,使用时放到源文件的根目录下,直接执行就可以看到效果了。由于脚本是python编写的,请先安装python2.
代码片段和文件信息
# vsproj.py
import uuid
import os
import os.path
import re
def write_file(filepath str):
f = file(filepath “w“)
f.write(str)
f.close()
proj_uuid = str(uuid.uuid1()).upper()
cwd = os.getcwd()
proj_name = cwd[cwd.rfind(“\\“)+1:]
vs_dir = “vs2012“
# sln
sln = \
“Microsoft Visual Studio Solution File Format Version 12.00“\
“\n# Visual Studio 2012“\
“\nProject(\“{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\“) = \“$proj_name\“ \“vs2012.vcxproj\“ \“{$proj_uuid}\““\
“\nEndProject“\
“\nGlobal“\
“\n GlobalSection(SolutionConfigurationPlatforms) = preSolution“\
“\n Debug|Win32 = Debug|Win32“\
“\n Release|Win32 = Release|Win32“\
“\n EndGlobalSection“\
“\n GlobalSection(ProjectConfigurationPlatforms) = postSolution“\
“\n {$proj_uuid}.Debug|Win32.ActiveCfg = Debug|Win32“\
“\n {$proj_uuid}.Release|Win32.ActiveCfg = Debug|Win32“\
“\n EndGlobalSection“\
“\n GlobalSection(SolutionProperties) = preSolution“\
“\n HideSolutionNode = FALSE“\
“\n EndGlobalSection“\
“\nEndGlobal\n“
sln = sln.replace(“$proj_uuid“ proj_uuid).replace(“$proj_name“ proj_name)
#print sln
# vcxproj
vcproj = \
“l version=\“1.0\“ encoding=\“utf-8\“?>“\
“\nlns=\“http://schemas.microsoft.com/developer/msbuild/2003\“>“\
“\n “\
“\n “\
“\n Debug “\
“\n Win32 “\
“\n “\
“\n “\
“\n “\
“\n “\
“\n “\
“\n “\
“\n “\
“\n “\
“\n “\
“\n “\
“\n Application “\
“\n true “\
“\n v110 “\
“\n MultiByte “\
“\n “\
“\n “\
“\n {$proj_uuid} “\
“\n vs2012 “\
“\n $proj_name “\
“\n “\
“\n “\
“\n “\
“\n Application “\
“\n true “\
“\n v110
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7015 2016-02-28 18:59 vsproj.py
- 上一篇:fcntl.py模块
- 下一篇:caffe Makefile.config
评论
共有 条评论