Browse Source

[tools] 增加scons --exec-path=xxx命令 用于动态设置编译链路径
scons --target=iar --exec-path=xxxx
scons --exec-path=xxxx

Meco Man 2 years ago
parent
commit
c38259d336
2 changed files with 9 additions and 0 deletions
  1. 5 0
      tools/building.py
  2. 4 0
      tools/options.py

+ 5 - 0
tools/building.py

@@ -214,6 +214,11 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
             del os.environ['RTT_EXEC_PATH']
             del os.environ['RTT_EXEC_PATH']
             utils.ReloadModule(rtconfig)
             utils.ReloadModule(rtconfig)
 
 
+    exec_path = GetOption('exec-path')
+    if exec_path:
+        os.environ['RTT_EXEC_PATH'] = exec_path
+        utils.ReloadModule(rtconfig)
+
     # add compability with Keil MDK 4.6 which changes the directory of armcc.exe
     # add compability with Keil MDK 4.6 which changes the directory of armcc.exe
     if rtconfig.PLATFORM in ['armcc', 'armclang']:
     if rtconfig.PLATFORM in ['armcc', 'armclang']:
         if rtconfig.PLATFORM == 'armcc' and not os.path.isfile(os.path.join(rtconfig.EXEC_PATH, 'armcc.exe')):
         if rtconfig.PLATFORM == 'armcc' and not os.path.isfile(os.path.join(rtconfig.EXEC_PATH, 'armcc.exe')):

+ 4 - 0
tools/options.py

@@ -85,6 +85,10 @@ def AddOptions():
                       dest = 'target',
                       dest = 'target',
                       type = 'string',
                       type = 'string',
                       help = 'set target project: mdk/mdk4/mdk5/iar/vs/vsc/ua/cdk/ses/makefile/eclipse/codelite/cmake')
                       help = 'set target project: mdk/mdk4/mdk5/iar/vs/vsc/ua/cdk/ses/makefile/eclipse/codelite/cmake')
+    AddOption('--exec-path',
+                dest = 'exec-path',
+                type = 'string',
+                help = 'set RTT_EXEC_PATH temperately')
     AddOption('--stackanalysis',
     AddOption('--stackanalysis',
                 dest = 'stackanalysis',
                 dest = 'stackanalysis',
                 action = 'store_true',
                 action = 'store_true',