2
0

build-v8.bat 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. @ECHO OFF
  2. REM First argument is the target architecture
  3. REM Second argument is "Debug" or "Release" mode
  4. REM Third argument is the V8 root directory path
  5. REM Fourth argument is the version of Visual Studio (optional)
  6. IF "%1" == "" GOTO Fail
  7. IF "%2" == "" GOTO Fail
  8. IF "%3" == "" GOTO Fail
  9. REM Go into the V8 lib directory
  10. cd "%3"
  11. REM Check the last build info, so we know if we're supposed to build again or not
  12. SET /P LAST_BUILD_INFO=<last_build
  13. IF "%1-%2" == "%LAST_BUILD_INFO%" (
  14. IF EXIST ".\build\%2\v8.dll" (
  15. ECHO V8 is already built!
  16. SET COPY_FILES_ONLY=1
  17. )
  18. )
  19. SET LIB_DEST_DIR=
  20. IF "%VisualStudioVersion%" == "11.0" (
  21. SET VS_VERSION=-Gmsvs_version=2012
  22. ECHO Forcing build to use Visual Studio 2012
  23. ) ELSE IF "%VisualStudioVersion%" == "12.0" (
  24. SET VS_VERSION=-Gmsvs_version=2013
  25. ECHO Forcing build to use Visual Studio 2013
  26. ) ELSE IF NOT "%4" == "" (
  27. SET VS_VERSION=-Gmsvs_version=%4
  28. ECHO Forcing build to use Visual Studio %4
  29. )
  30. IF "%1" == "x64" (
  31. REM If this is a 32-bit system (but we target x64), we must disable the snapshot feature to get it to build.
  32. IF NOT EXIST "%PROGRAMFILES(X86)%" (
  33. SET SKIP_V8_SNAPSHOT=-Dv8_use_snapshot=false
  34. )
  35. )
  36. IF "%1" == "x64" (
  37. IF NOT "%SKIP_V8_SNAPSHOT%" == "" ECHO Targeting x64 platform on a x86 system, disabling V8 snapshout feature to make this work [%SKIP_V8_SNAPSHOT%]
  38. IF NOT "%COPY_FILES_ONLY%" == "1" .\third_party\python_26\python.exe build\gyp_v8 -Dtarget_arch=x64 -Dcomponent=shared_library %SKIP_V8_SNAPSHOT% %VS_VERSION%
  39. IF ERRORLEVEL 1 GOTO Fail
  40. SET LIB_DEST_DIR=..\..\x64\%2\
  41. )
  42. IF "%1" == "x86" (
  43. IF NOT "%COPY_FILES_ONLY%" == "1" .\third_party\python_26\python.exe build\gyp_v8 -Dcomponent=shared_library %VS_VERSION%
  44. IF ERRORLEVEL 1 GOTO Fail
  45. SET LIB_DEST_DIR=..\..\Win32\%2\
  46. )
  47. IF "%LIB_DEST_DIR%" == "" GOTO Fail
  48. IF "%COPY_FILES_ONLY%" == "1" GOTO CopyFiles
  49. REM Clean build before we continue
  50. REM First try to clean using the solution path (works for most VS versions)
  51. msbuild "tools\gyp\v8.sln" /t:"_tools_\_gyp_\v8:Clean" /p:Configuration=%2 /clp:WarningsOnly
  52. IF NOT ERRORLEVEL 1 GOTO CleanDone
  53. REM If clean using solution path didn't work, try to build without the path (works for some VS versions...)
  54. msbuild "tools\gyp\v8.sln" /t:v8:Clean /p:Configuration=%2
  55. IF ERRORLEVEL 1 GOTO Fail
  56. :CleanDone
  57. REM Just to make sure that everything is cleaned up
  58. rmdir /S /Q .\build\%2
  59. REM Build the V8 library
  60. REM First try to build using the solution path (works for most VS versions)
  61. msbuild "tools\gyp\v8.sln" /t:"_tools_\_gyp_\v8:Rebuild" /p:Configuration=%2 /clp:WarningsOnly
  62. IF NOT ERRORLEVEL 1 GOTO CopyFiles
  63. REM If build using solution path didn't work, try to build without the path (works for some VS versions...)
  64. msbuild "tools\gyp\v8.sln" /t:v8:Rebuild /p:Configuration=%2
  65. IF ERRORLEVEL 1 GOTO Fail
  66. :CopyFiles
  67. xcopy /C /F /R /Y .\build\%2\icui18n.dll %LIB_DEST_DIR%
  68. IF ERRORLEVEL 1 GOTO Fail
  69. xcopy /C /F /R /Y .\build\%2\icuuc.dll %LIB_DEST_DIR%
  70. IF ERRORLEVEL 1 GOTO Fail
  71. xcopy /C /F /R /Y .\build\%2\v8.dll %LIB_DEST_DIR%
  72. IF ERRORLEVEL 1 GOTO Fail
  73. ECHO %1-%2> last_build
  74. exit /b 0
  75. :Fail
  76. REM Delete the last_build info if this build failed!
  77. @del /Q last_build
  78. exit /b 1