Bläddra i källkod

Enable random order of hctbuild arguments (#3741)

Helena Kotas 4 år sedan
förälder
incheckning
56e22b30c5
1 ändrade filer med 65 tillägg och 70 borttagningar
  1. 65 70
      utils/hct/hctbuild.cmd

+ 65 - 70
utils/hct/hctbuild.cmd

@@ -18,18 +18,6 @@ if "%HLSL_SRC_DIR%"=="" (
   )
   )
 )
 )
 
 
-if "%1"=="-buildoutdir" (
-  echo Build output directory set to %~2
-  set "HLSL_BLD_DIR=%~2"
-  shift /1
-  shift /1
-)
-
-if "%HLSL_BLD_DIR%"=="" (
-  echo Missing build directory.
-  exit /b 1
-)
-
 if "%BUILD_ARCH%"=="" (
 if "%BUILD_ARCH%"=="" (
   set BUILD_ARCH=Win32
   set BUILD_ARCH=Win32
 )
 )
@@ -55,87 +43,95 @@ set DXILCONV=ON
 set DXC_CMAKE_SYSTEM_VERSION=
 set DXC_CMAKE_SYSTEM_VERSION=
 set SHOW_CMAKE_LOG=0
 set SHOW_CMAKE_LOG=0
 
 
+:parse_args
+if "%1"=="" (
+    goto :done_parsing_args
+) 
+if "%1"=="-buildoutdir" (
+  echo Build output directory set to %~2
+  set "HLSL_BLD_DIR=%~2"
+  shift /1
+  shift /1 & goto :parse_args
+)
 if "%1"=="-s" (
 if "%1"=="-s" (
   set DO_BUILD=0
   set DO_BUILD=0
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 if "%1"=="-b" (
 if "%1"=="-b" (
   set DO_SETUP=0
   set DO_SETUP=0
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
-
 if "%1"=="-alldef" (
 if "%1"=="-alldef" (
   set ALL_DEFS=ON
   set ALL_DEFS=ON
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 if "%1"=="-analyze" (
 if "%1"=="-analyze" (
   set ANALYZE=ON
   set ANALYZE=ON
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 if "%1"=="-official" (
 if "%1"=="-official" (
   echo Will generate official version for build
   echo Will generate official version for build
   set OFFICIAL=ON
   set OFFICIAL=ON
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 if "%1"=="-fv" (
 if "%1"=="-fv" (
   echo Fixed version flag set for build.
   echo Fixed version flag set for build.
   set FIXED_VER=ON
   set FIXED_VER=ON
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 if "%1"=="-fvloc" (
 if "%1"=="-fvloc" (
   echo Fixed version flag set for build, version file location: %~2
   echo Fixed version flag set for build, version file location: %~2
   set FIXED_VER=ON
   set FIXED_VER=ON
   set "FIXED_LOC=%~2"
   set "FIXED_LOC=%~2"
   shift /1
   shift /1
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 if "%1"=="-cv" (
 if "%1"=="-cv" (
   echo Set the CLANG_VENDOR value.
   echo Set the CLANG_VENDOR value.
   set "VENDOR=%~2"
   set "VENDOR=%~2"
   shift /1
   shift /1
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 if "%1"=="-rel" (
 if "%1"=="-rel" (
   set BUILD_CONFIG=Release
   set BUILD_CONFIG=Release
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 if "%1"=="-x86" (
 if "%1"=="-x86" (
   set BUILD_ARCH=Win32
   set BUILD_ARCH=Win32
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 if "%1"=="-x64" (
 if "%1"=="-x64" (
   set BUILD_ARCH=x64
   set BUILD_ARCH=x64
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 if /i "%1"=="-arm" (
 if /i "%1"=="-arm" (
   set BUILD_ARCH=ARM
   set BUILD_ARCH=ARM
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 if /i "%1"=="-arm64" (
 if /i "%1"=="-arm64" (
   set BUILD_ARCH=ARM64
   set BUILD_ARCH=ARM64
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 if /i "%1"=="-arm64ec" (
 if /i "%1"=="-arm64ec" (
   set BUILD_ARCH=ARM64EC
   set BUILD_ARCH=ARM64EC
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 if /i "%1"=="-Debug" (
 if /i "%1"=="-Debug" (
   set BUILD_CONFIG=Debug
   set BUILD_CONFIG=Debug
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 if /i "%1"=="-Release" (
 if /i "%1"=="-Release" (
   set BUILD_CONFIG=Release
   set BUILD_CONFIG=Release
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 if "%1"=="-vs2017" (
 if "%1"=="-vs2017" (
   set BUILD_GENERATOR=Visual Studio 15 2017
   set BUILD_GENERATOR=Visual Studio 15 2017
   set BUILD_VS_VER=2017
   set BUILD_VS_VER=2017
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 if "%1"=="-vs2019" (
 if "%1"=="-vs2019" (
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
-
 if "%1"=="-tblgen" (
 if "%1"=="-tblgen" (
   if "%~2" == "" (
   if "%~2" == "" (
     echo Missing path argument after -tblgen.
     echo Missing path argument after -tblgen.
@@ -143,85 +139,89 @@ if "%1"=="-tblgen" (
   ) 
   ) 
   set "BUILD_TBLGEN_PATH=%~2"
   set "BUILD_TBLGEN_PATH=%~2"
   shift /1
   shift /1
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
-
 if "%1"=="-dont-speak" (
 if "%1"=="-dont-speak" (
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
-
 if "%1"=="-speak-up" (
 if "%1"=="-speak-up" (
   set SPEAK=1
   set SPEAK=1
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
-
 if "%1"=="-no-parallel" (
 if "%1"=="-no-parallel" (
   set PARALLEL_OPT=
   set PARALLEL_OPT=
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
-
 if "%1"=="-no-dxilconv" (
 if "%1"=="-no-dxilconv" (
   set DXILCONV=OFF
   set DXILCONV=OFF
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
-
 if "%1"=="-dxc-cmake-extra-args" (
 if "%1"=="-dxc-cmake-extra-args" (
   set CMAKE_OPTS=%CMAKE_OPTS% %~2
   set CMAKE_OPTS=%CMAKE_OPTS% %~2
   shift /1
   shift /1
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
-
 if "%1"=="-dxc-cmake-begins-include" (
 if "%1"=="-dxc-cmake-begins-include" (
   set "CMAKE_OPTS=%CMAKE_OPTS% -DDXC_CMAKE_BEGINS_INCLUDE=%~2"
   set "CMAKE_OPTS=%CMAKE_OPTS% -DDXC_CMAKE_BEGINS_INCLUDE=%~2"
   shift /1
   shift /1
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
-
 if "%1"=="-dxc-cmake-ends-include" (
 if "%1"=="-dxc-cmake-ends-include" (
   set "CMAKE_OPTS=%CMAKE_OPTS% -DDXC_CMAKE_ENDS_INCLUDE=%~2"
   set "CMAKE_OPTS=%CMAKE_OPTS% -DDXC_CMAKE_ENDS_INCLUDE=%~2"
   shift /1
   shift /1
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
-
 if "%1"=="-dxc-cmake" (
 if "%1"=="-dxc-cmake" (
   set "CMAKE_PATH=%~2"
   set "CMAKE_PATH=%~2"
   shift /1
   shift /1
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
-
 if "%1"=="-dxc-cmake-system-version" (
 if "%1"=="-dxc-cmake-system-version" (
   set DXC_CMAKE_SYSTEM_VERSION=%~2
   set DXC_CMAKE_SYSTEM_VERSION=%~2
   shift /1
   shift /1
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 
 
 if "%1"=="-show-cmake-log" (
 if "%1"=="-show-cmake-log" (
   set SHOW_CMAKE_LOG=1
   set SHOW_CMAKE_LOG=1
-  shift /1
+  shift /1 & goto :parse_args
 )  
 )  
-
-if "%CMAKE_PATH%"=="" (
-  where cmake.exe 1>nul 2>nul
-  if errorlevel 1 (
-    echo Unable to find cmake.exe on the path.
-    echo cmake 3.4 is available from https://cmake.org/files/v3.4/cmake-3.4.0-win32-x86.exe
-    exit /b 1
-  )
-  set CMAKE_PATH=cmake
-)
-
 rem Begin SPIRV change
 rem Begin SPIRV change
 if "%1"=="-spirv" (
 if "%1"=="-spirv" (
   echo SPIR-V codegen is enabled.
   echo SPIR-V codegen is enabled.
   set SPIRV=ON
   set SPIRV=ON
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 if "%1"=="-spirvtest" (
 if "%1"=="-spirvtest" (
   echo Building SPIR-V tests is enabled.
   echo Building SPIR-V tests is enabled.
   set SPV_TEST=ON
   set SPV_TEST=ON
-  shift /1
+  shift /1 & goto :parse_args
 )
 )
 rem End SPIRV change
 rem End SPIRV change
+if "%1"=="-ninja" (
+  set BUILD_GENERATOR=Ninja
+  shift /1 & goto :parse_args
+)
+if "%1" NEQ "" ( 
+    echo Unrecognized argument: %1
+    exit /b 1
+)
+:done_parsing_args
+
+if "%HLSL_BLD_DIR%"=="" (
+  echo Missing build directory.
+  exit /b 1
+)
+
+if "%CMAKE_PATH%"=="" (
+  where cmake.exe 1>nul 2>nul
+  if errorlevel 1 (
+    echo Unable to find cmake.exe on the path.
+    echo cmake 3.4 is available from https://cmake.org/files/v3.4/cmake-3.4.0-win32-x86.exe
+    exit /b 1
+  )
+  set CMAKE_PATH=cmake
+)
 
 
 rem Get SDK version from VSDevCmd (needed for ARM64X builds), strip the backslash at the end
 rem Get SDK version from VSDevCmd (needed for ARM64X builds), strip the backslash at the end
 set ENV_SDK_VERSION=%WindowsSDKVersion%
 set ENV_SDK_VERSION=%WindowsSDKVersion%
@@ -279,11 +279,6 @@ if /i "%BUILD_ARCH%"=="arm64ec" (
   set CMAKE_OPTS=%CMAKE_OPTS% -DMSVC_BUILD_AS_X=1
   set CMAKE_OPTS=%CMAKE_OPTS% -DMSVC_BUILD_AS_X=1
 )
 )
 
 
-if "%1"=="-ninja" (
-  set BUILD_GENERATOR=Ninja
-  shift /1
-)
-
 if "%DXC_CMAKE_SYSTEM_VERSION%"=="" (
 if "%DXC_CMAKE_SYSTEM_VERSION%"=="" (
   set DXC_CMAKE_SYSTEM_VERSION=10.0.14393.0
   set DXC_CMAKE_SYSTEM_VERSION=10.0.14393.0
 )
 )