Merge pull request #53 from jasonbu/master

simulator add support for msvc auto find path
This commit is contained in:
Jianting (Meco) Man 2021-10-12 12:20:02 -05:00 committed by GitHub
commit 7544b40122
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 1 deletions

View File

@ -1,11 +1,12 @@
import os import os
import SCons.Tool.MSCommon.vc
# toolchains options # toolchains options
ARCH='sim' ARCH='sim'
#CROSS_TOOL='msvc' or 'gcc' or 'mingw' #CROSS_TOOL='msvc' or 'gcc' or 'mingw'
#'msvc' and 'mingw' are both for windows #'msvc' and 'mingw' are both for windows
# 'gcc' is for linux # 'gcc' is for linux
CROSS_TOOL='mingw' CROSS_TOOL='msvc'
if os.getenv('RTT_CC'): if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC') CROSS_TOOL = os.getenv('RTT_CC')
@ -26,6 +27,20 @@ elif CROSS_TOOL == 'msvc':
CPU = 'win32' CPU = 'win32'
PLATFORM = 'cl' PLATFORM = 'cl'
EXEC_PATH = '' EXEC_PATH = ''
vc_version = ''
vc_versions = SCons.Tool.MSCommon.vc.get_installed_vcs()
print(vc_versions)
if not vc_versions:
print("no vc version")
exit(1)
else:
vc_version = vc_versions[0]
EXEC_PATH = SCons.Tool.MSCommon.vc.find_vc_pdir(vc_version)
if not EXEC_PATH:
print('find_vs_dir(): no installed VC %s' % vc_version)
else:
print('find_vs_dir(): installed VC %s, path:%s' % (vc_version, EXEC_PATH))
else: else:
print("bad CROSS TOOL!") print("bad CROSS TOOL!")
exit(1) exit(1)