Skip to content

Commit 188befc

Browse files
committed
simulator add support for msvc auto find path
1 parent 49f366e commit 188befc

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

bsp/simulator/rtconfig.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import os
2+
import SCons.Tool.MSCommon.vc
23

34
# toolchains options
45
ARCH='sim'
56
#CROSS_TOOL='msvc' or 'gcc' or 'mingw'
67
#'msvc' and 'mingw' are both for windows
78
# 'gcc' is for linux
8-
CROSS_TOOL='mingw'
9+
CROSS_TOOL='msvc'
910

1011
if os.getenv('RTT_CC'):
1112
CROSS_TOOL = os.getenv('RTT_CC')
@@ -26,6 +27,20 @@
2627
CPU = 'win32'
2728
PLATFORM = 'cl'
2829
EXEC_PATH = ''
30+
vc_version = ''
31+
vc_versions = SCons.Tool.MSCommon.vc.get_installed_vcs()
32+
print(vc_versions)
33+
if not vc_versions:
34+
print("no vc version")
35+
exit(1)
36+
else:
37+
vc_version = vc_versions[0]
38+
EXEC_PATH = SCons.Tool.MSCommon.vc.find_vc_pdir(vc_version)
39+
if not EXEC_PATH:
40+
print('find_vs_dir(): no installed VC %s' % vc_version)
41+
else:
42+
print('find_vs_dir(): installed VC %s, path:%s' % (vc_version, EXEC_PATH))
43+
2944
else:
3045
print("bad CROSS TOOL!")
3146
exit(1)

0 commit comments

Comments
 (0)