.调整构建脚本,支持vs2017环境的自动构建。

pull/173/head
Apex Liu 2018-12-28 02:58:59 +08:00
parent 96fe0a4bca
commit e96534b4d7
5 changed files with 37 additions and 25 deletions

View File

@ -29,7 +29,7 @@ class BuilderWin(BuilderBase):
def build_exe(self):
cc.i('build tp_assist...')
sln_file = os.path.join(env.root_path, 'client', 'tp_assist_win', 'tp_assist.vs2015.sln')
sln_file = os.path.join(env.root_path, 'client', 'tp_assist_win', 'tp_assist.vs2017.sln')
out_file = os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path, 'tp_assist.exe')
if os.path.exists(out_file):
utils.remove(out_file)

View File

@ -188,7 +188,7 @@ class BuilderWin(BuilderBase):
cc.v('')
cc.w('On Windows, when build libssh, need you use cmake-gui.exe to generate solution file')
cc.w('for Visual Studio 2015. Visit https://docs.tp4a.com for more details.')
cc.w('for Visual Studio 2017. Visit https://docs.tp4a.com for more details.')
cc.w('\nOnce the libssh.sln generated, press Enter to continue or Q to quit...', end='')
try:
x = env.input()

View File

@ -27,7 +27,7 @@ class BuilderWin(BuilderBase):
if ctx.target_path == 'debug':
cc.w('cannot build debug version of tp_web, skip.')
else:
sln_file = os.path.join(env.root_path, 'server', 'tp_web', 'src', 'tp_web.vs2015.sln')
sln_file = os.path.join(env.root_path, 'server', 'tp_web', 'src', 'tp_web.vs2017.sln')
out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path, 'tp_web.exe')
if os.path.exists(out_file):
utils.remove(out_file)
@ -35,7 +35,7 @@ class BuilderWin(BuilderBase):
utils.ensure_file_exists(out_file)
cc.n('build core server ...')
sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'core', 'tp_core.vs2015.sln')
sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'core', 'tp_core.vs2017.sln')
out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path, 'tp_core.exe')
if os.path.exists(out_file):
utils.remove(out_file)
@ -43,7 +43,7 @@ class BuilderWin(BuilderBase):
utils.ensure_file_exists(out_file)
cc.n('build SSH protocol ...')
sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'protocol', 'ssh', 'tpssh.vs2015.sln')
sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'protocol', 'ssh', 'tpssh.vs2017.sln')
out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path, 'tpssh.dll')
if os.path.exists(out_file):
utils.remove(out_file)
@ -52,7 +52,7 @@ class BuilderWin(BuilderBase):
utils.copy_file(os.path.join(env.root_path, 'external', 'libssh', 'lib', ctx.target_path), os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path), 'ssh.dll')
cc.n('build TELNET protocol ...')
sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'protocol', 'telnet', 'tptelnet.vs2015.sln')
sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'protocol', 'telnet', 'tptelnet.vs2017.sln')
out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path, 'tptelnet.dll')
if os.path.exists(out_file):
utils.remove(out_file)
@ -61,7 +61,7 @@ class BuilderWin(BuilderBase):
if with_rdp:
cc.n('build RDP protocol ...')
sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'protocol', 'rdp', 'tprdp.vs2015.sln')
sln_file = os.path.join(env.root_path, 'server', 'tp_core', 'protocol', 'rdp', 'tprdp.vs2017.sln')
out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path, 'tprdp.dll')
if os.path.exists(out_file):
utils.remove(out_file)

View File

@ -190,30 +190,41 @@ class Env(object):
return True
def _get_msbuild(self):
# 14.0 = VS2015
# 12.0 = VS2012
# 4.0 = VS2008
chk = ['14.0', '12.0', '4.0']
# def _get_msbuild(self):
# # 14.0 = VS2015
# # 12.0 = VS2012
# # 4.0 = VS2008
# chk = ['14.0', '12.0', '4.0']
p = None
for c in chk:
p = self._winreg_read(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\MSBuild\ToolsVersions\{}'.format(c), r'MSBuildToolsPath')
if p is not None:
break
# p = None
# for c in chk:
# p = self._winreg_read(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\MSBuild\ToolsVersions\{}'.format(c), r'MSBuildToolsPath')
# if p is not None:
# break
return os.path.join(p[0], 'MSBuild.exe') if p is not None else None
# return os.path.join(p[0], 'MSBuild.exe') if p is not None else None
# def _get_visual_studio_path(self):
# chk = ['14.0', '12.0', '4.0']
# p = None
# for c in chk:
# p = self._winreg_read(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\VisualStudio\{}'.format(c), r'ShellFolder')
# if p is not None:
# break
# return p[0] if p is not None else None
def _get_visual_studio_path(self):
chk = ['14.0', '12.0', '4.0']
p = None
for c in chk:
p = self._winreg_read(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\VisualStudio\{}'.format(c), r'ShellFolder')
if p is not None:
break
p = self._winreg_read(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7', r'15.0')
return p[0] if p is not None else None
def _get_msbuild(self):
vs2017 = self._get_visual_studio_path()
if vs2017 is None:
return None
return os.path.join(vs2017, 'MSBuild', '15.0', 'Bin', 'MSBuild.exe')
def _get_perl(self):
p = self._winreg_read(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\perl', 'BinDir')
return p[0] if p is not None else None

View File

@ -23,6 +23,7 @@
<Keyword>Win32Proj</Keyword>
<RootNamespace>tp_core</RootNamespace>
<ProjectName>tp_core</ProjectName>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -34,9 +35,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>