hctlabverify.cmd 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. @echo off
  2. if "%1"=="/?" goto :showhelp
  3. if "%1"=="-?" goto :showhelp
  4. if "%1"=="-help" goto :showhelp
  5. if "%1"=="--help" goto :showhelp
  6. setlocal ENABLEDELAYEDEXPANSION
  7. set X86_DBG=1
  8. set X86_REL=1
  9. set X86_TST=1
  10. set X64_DBG=1
  11. set X64_REL=1
  12. set X64_TST=1
  13. set ARM64_DBG=1
  14. set ARM64_REL=1
  15. set ARM64_TST=0
  16. set ANALYZE=-analyze
  17. set FV_FLAG=
  18. set CV_FLAG=
  19. if "%1"=="-short" (
  20. echo Building / testing fewer versions.
  21. set X86_DBG=0
  22. set X86_REL=1
  23. set X86_TST=0
  24. set X64_DBG=1
  25. set X64_REL=0
  26. set X64_TST=1
  27. set ARM64_DBG=1
  28. set ARM64_REL=0
  29. set ARM64_TST=0
  30. set ANALYZE=
  31. shift /1
  32. )
  33. if "%1"=="-fv" (
  34. echo Fixed version flag set for lab verification.
  35. set FV_FLAG=-fv
  36. shift /1
  37. )
  38. if "%1"=="-cv" (
  39. echo Setting the CLANG_VENDOR value.
  40. set CV_FLAG=-cv %2
  41. shift /1
  42. shift /1
  43. )
  44. if "%HLSL_SRC_DIR%"=="" (
  45. echo Missing source directory.
  46. if exist %~dp0..\..\LLVMBuild.txt (
  47. set HLSL_SRC_DIR=%~dp0..\..
  48. echo Source directory deduced to be %~dp0..\..
  49. ) else (
  50. exit /b 1
  51. )
  52. )
  53. if "%1"=="-buildoutdir" (
  54. echo Build output directory set to %2
  55. set HLSL_BLD_DIR=%2
  56. shift /1
  57. shift /1
  58. )
  59. rem Build all supported architectures (x86, x64, ARM64)
  60. call :verify_arch x86 %X86_TST% %X86_DBG% %X86_REL%
  61. if errorlevel 1 (
  62. echo Failed to verify for x86.
  63. exit /b 1
  64. )
  65. call :verify_arch x64 %X64_TST% %X64_DBG% %X64_REL%
  66. if errorlevel 1 (
  67. echo Failed to verify for x64.
  68. exit /b 1
  69. )
  70. rem Set path to x86 tblgen tools for the ARM64 build
  71. if "%BUILD_TBLGEN_PATH%" == "" (
  72. set BUILD_TBLGEN_PATH=%HLSL_BLD_DIR%\x86\Release\bin
  73. )
  74. call :verify_arch arm64 %ARM64_TST% %ARM64_DBG% %ARM64_REL%
  75. if errorlevel 1 (
  76. echo Failed to verify for arm64.
  77. exit /b 1
  78. )
  79. endlocal
  80. exit /b 0
  81. :showhelp
  82. echo Runs the verification steps for a lab configuration.
  83. echo.
  84. echo Usage:
  85. echo hctlabverify [-short] [-fv] [-buildOutDir dir]
  86. echo.
  87. echo Options:
  88. echo -short builds fewer components
  89. echo -fv fixes version information
  90. echo -buildOutDir sets the base output directory
  91. echo.
  92. goto :eof
  93. :verify_arch
  94. rem Performs a per-architecture build and test.
  95. rem 1 - architecture
  96. rem 2 - '1' to run tests, 0 otherwise
  97. rem 3 - '1' to build debug, 0 to skip
  98. rem 4 - '1' to build release, 0 to skip
  99. setlocal
  100. set HLSL_BLD_DIR=%HLSL_BLD_DIR%\%1
  101. mkdir %HLSL_BLD_DIR%
  102. rem Build the solution.
  103. call :announce Building solution files for %1
  104. call %HLSL_SRC_DIR%\utils\hct\hctbuild.cmd -s %FV_FLAG% %CV_FLAG% -%1
  105. if errorlevel 1 (
  106. echo Failed to create solution for architecture %1
  107. exit /b 1
  108. )
  109. rem Build debug.
  110. if "%3"=="1" (
  111. call :announce Debug build - %1
  112. call %HLSL_SRC_DIR%\utils\hct\hctbuild.cmd -b -%1
  113. if errorlevel 1 (
  114. echo Failed to build for architecture %1
  115. exit /b 1
  116. )
  117. );
  118. rem Build retail.
  119. if "%4"=="1" (
  120. call :announce Retail build - %1
  121. call %HLSL_SRC_DIR%\utils\hct\hctbuild.cmd -b %ANALYZE% -rel -%1
  122. if errorlevel 1 (
  123. echo Failed to build for architecture %1 in release
  124. exit /b 1
  125. )
  126. )
  127. rem Run tests.
  128. if "%2"=="1" (
  129. call :announce Starting tests
  130. rem Pick Debug if available, retail otherwise.
  131. if "%3"=="1" (
  132. call %HLSL_SRC_DIR%\utils\hct\hcttest.cmd
  133. ) else (
  134. call %HLSL_SRC_DIR%\utils\hct\hcttest.cmd -rel
  135. )
  136. ) else (
  137. echo Skipping tests.
  138. )
  139. endlocal
  140. exit /b 0
  141. :announce
  142. echo -------------------------------------------------------------------------
  143. echo.
  144. echo %*
  145. echo.
  146. echo -------------------------------------------------------------------------
  147. exit /b 0