2
0

build-v8.bat 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 "%VisualStudioVersion%" == "14.0" (
  27. SET VS_VERSION=-Gmsvs_version=2015
  28. ECHO Forcing build to use Visual Studio 2015
  29. ) ELSE IF NOT "%4" == "" (
  30. SET VS_VERSION=-Gmsvs_version=%4
  31. ECHO Forcing build to use Visual Studio %4
  32. )
  33. IF "%1" == "x64" (
  34. REM If this is a 32-bit system (but we target x64), we must disable the snapshot feature to get it to build.
  35. IF NOT EXIST "%PROGRAMFILES(X86)%" (
  36. SET SKIP_V8_SNAPSHOT=-Dv8_use_snapshot=false
  37. )
  38. )
  39. IF "%1" == "x64" (
  40. IF NOT "%SKIP_V8_SNAPSHOT%" == "" ECHO Targeting x64 platform on a x86 system, disabling V8 snapshout feature to make this work [%SKIP_V8_SNAPSHOT%]
  41. 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%
  42. IF ERRORLEVEL 1 GOTO Fail
  43. SET LIB_DEST_DIR=..\..\x64\%2\
  44. )
  45. IF "%1" == "x86" (
  46. IF NOT "%COPY_FILES_ONLY%" == "1" .\third_party\python_26\python.exe build\gyp_v8 -Dcomponent=shared_library %VS_VERSION%
  47. IF ERRORLEVEL 1 GOTO Fail
  48. SET LIB_DEST_DIR=..\..\Win32\%2\
  49. )
  50. IF "%LIB_DEST_DIR%" == "" GOTO Fail
  51. IF "%COPY_FILES_ONLY%" == "1" GOTO CopyFiles
  52. REM Clean build before we continue
  53. REM First try to clean using the solution path (works for most VS versions)
  54. msbuild "tools\gyp\v8.sln" /t:"_tools_\_gyp_\v8:Clean" /p:Configuration=%2 /clp:WarningsOnly
  55. IF NOT ERRORLEVEL 1 GOTO CleanDone
  56. REM If clean using solution path didn't work, try to build without the path (works for some VS versions...)
  57. msbuild "tools\gyp\v8.sln" /t:v8:Clean /p:Configuration=%2
  58. IF ERRORLEVEL 1 GOTO Fail
  59. :CleanDone
  60. REM Just to make sure that everything is cleaned up
  61. rmdir /S /Q .\build\%2
  62. REM Build the V8 library
  63. REM First try to build using the solution path (works for most VS versions)
  64. msbuild "tools\gyp\v8.sln" /t:"_tools_\_gyp_\v8:Rebuild" /p:Configuration=%2 /clp:WarningsOnly
  65. IF NOT ERRORLEVEL 1 GOTO CopyFiles
  66. REM If build using solution path didn't work, try to build without the path (works for some VS versions...)
  67. msbuild "tools\gyp\v8.sln" /t:v8:Rebuild /p:Configuration=%2
  68. IF ERRORLEVEL 1 GOTO Fail
  69. :CopyFiles
  70. xcopy /C /F /R /Y .\build\%2\icui18n.dll %LIB_DEST_DIR%
  71. IF ERRORLEVEL 1 GOTO Fail
  72. xcopy /C /F /R /Y .\build\%2\icuuc.dll %LIB_DEST_DIR%
  73. IF ERRORLEVEL 1 GOTO Fail
  74. xcopy /C /F /R /Y .\build\%2\v8.dll %LIB_DEST_DIR%
  75. IF ERRORLEVEL 1 GOTO Fail
  76. ECHO %1-%2> last_build
  77. exit /b 0
  78. :Fail
  79. REM Delete the last_build info if this build failed!
  80. @del /Q last_build
  81. exit /b 1