GenByteCode.cmd 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. ::-------------------------------------------------------------------------------------------------------
  2. :: Copyright (C) Microsoft. All rights reserved.
  3. :: Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. ::-------------------------------------------------------------------------------------------------------
  5. @echo off
  6. setlocal
  7. set _HASERROR=0
  8. set _binary=ch.exe
  9. set _BuildDir=%~dp0..\..\..\..\Build
  10. if "%_FILE%" == "" (
  11. set "_FILE=%~dp0*.js"
  12. )
  13. :ContinueArgParse
  14. if not [%1]==[] (
  15. if [%1]==[-nojit] (
  16. set _suffix=.nojit
  17. goto :ContinueArgParseEnd
  18. )
  19. if [%1]==[-binary] (
  20. if [%2]==[] (
  21. echo Error: no argument supplied to -binary. Exiting ...
  22. exit /b 1
  23. )
  24. set _binary=%2
  25. shift
  26. goto :ContinueArgParseEnd
  27. )
  28. if [%1]==[-bindir] (
  29. if [%2]==[] (
  30. echo Error: no argument supplied to -bindir. Exiting ...
  31. exit /b 1
  32. )
  33. set _BinLocation=%2
  34. shift
  35. goto :ContinueArgParseEnd
  36. )
  37. :ContinueArgParseEnd
  38. shift
  39. goto :ContinueArgParse
  40. )
  41. :: This script will expect %_binary% to be built for x86_debug and x64_debug
  42. if "%OutBaseDir%" NEQ "" (
  43. set _BinLocation=%OutBaseDir%\Chakra.Core%_suffix%\bin
  44. )
  45. if "%_BinLocation%"=="" (
  46. set _BinLocation=%_BuildDir%\VcBuild%_suffix%\bin
  47. )
  48. if not exist %_BinLocation%\x86_debug\%_binary% (
  49. echo Error: %_BinLocation%\x86_debug\%_binary% not found, please build sources. Exiting ...
  50. exit /b 1
  51. )
  52. if not exist %_BinLocation%\x64_debug\%_binary% (
  53. echo Error: %_BinLocation%\x64_debug\%_binary% not found, please build sources. Exiting ...
  54. exit /b 1
  55. )
  56. for %%i in (%_FILE%) do (
  57. call :GenerateLibraryByteCodeHeader %%i
  58. )
  59. exit /B %_HASERROR%
  60. :GenerateLibraryBytecodeHeader
  61. echo Generating %1%_suffix%.bc.32b.h
  62. call :Generate %1 %_BinLocation%\x86_debug %1%_suffix%.bc.32b.h
  63. echo Generating %1%_suffix%.bc.64b.h
  64. call :Generate %1 %_BinLocation%\x64_debug %1%_suffix%.bc.64b.h
  65. exit /B 0
  66. :Generate
  67. %2\%_binary% -GenerateLibraryByteCodeHeader:%3 -JsBuiltIn -LdChakraLib %1
  68. if "%errorlevel%" NEQ "0" (
  69. echo %1: Error generating bytecode file. Ensure %3 writable.
  70. set _HASERROR=1
  71. ) else (
  72. echo Bytecode generated. Please rebuild to incorporate the new bytecode.
  73. )