BaseTools: Update edksetup.bat to support multiple workspaces

1. Update edksetup.bat and toolsetup.bat to handle PACKAGES_PATH.
   BaseTools directory may be in PACKAGES_PATH instead of WORKSAPCE.
2. Introduce EDK_TOOLS_BIN env points to the windows binary tools dir.
   Windows BaseTools Win32 may be a separate directory.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Wu Hao A <hao.a.wu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18582 6f19259b-4bc3-4df7-8a09-765794883524
diff --git a/edksetup.bat b/edksetup.bat
index 25a5a6e..b63c299 100755
--- a/edksetup.bat
+++ b/edksetup.bat
@@ -42,9 +42,11 @@
 :SetWorkSpace

 @REM set new workspace

 @REM clear EFI_SOURCE and EDK_SOURCE for the new workspace

-set WORKSPACE=%CD%

-set EFI_SOURCE=

-set EDK_SOURCE=

+if not defined WORKSPACE (

+  set WORKSPACE=%CD%

+  set EFI_SOURCE=

+  set EDK_SOURCE=

+)

 

 :ParseArgs

 if /I "%1"=="-h" goto Usage

@@ -92,8 +94,28 @@
 shift

 

 :no_nt32

+

 if /I "%1"=="NewBuild" shift

-set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools

+if exist %WORKSPACE%\BaseTools (

+  set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools

+) else (

+  if defined PACKAGES_PATH (

+    for %%i IN (%PACKAGES_PATH%) DO (

+      if exist %%~fi\BaseTools (

+        set EDK_TOOLS_PATH=%%~fi\BaseTools

+        goto checkBaseTools

+      )

+    )

+  ) else (

+    echo.

+    echo !!! ERROR !!! Cannot find BaseTools !!!

+    echo. 

+    goto BadBaseTools

+  )

+)

+if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%

+

+:checkBaseTools

 IF NOT EXIST "%EDK_TOOLS_PATH%\toolsetup.bat" goto BadBaseTools

 call %EDK_TOOLS_PATH%\toolsetup.bat %*

 if /I "%1"=="Reconfig" shift