c++visual-studiov8gyp

How do you compile V8 with Visual Studio?


I've been trying to compile V8. I've obtained a copy of the v8-master folder from GitHub, but I can't figure out how to compile it. A lot of the documentation I could find online are conflicting.

From what I've gathered, it appears as if my best chance of getting it to compile (out of the various methods I've found, though I couldn't get any of them to work) is to create the project files by calling the gyp_v8 script (located in the build folder of v8-master). But it simply gives me File "gyp_v8", line 86 print 'Error running GYP' SyntaxError: Missing parentheses in call to 'print'. From there, I tried to install Gyp (since according to the documentation, I'm led to believe that's what's causing the error). That required me to install depot_tools and do gclient sync. That failed with the error Error: client not configured; see 'gclient config'. And gclient config fails with the erropr gclient.py: error: Inconsistency arguments. Use either --spec or one or 2 args.

Honestly, I'm lost at this point. Is there any way I could just use CMake or something? Or at least a build tutorial that doesn't assume you have a bunch of Google-specific build tools involved?


Solution

    1. Confirm Git is installed. git 2.2.1+ recommended.
    2. Temporarily, disable Windows Indexing.
    3. Install "Microsoft Visual C++ 2008 Redistributable Package"
    4. Run bat file as administrator

    Bat file:

    @echo on
    
    CD /D %~dp0
    SET DEPOT_TOOLS_WIN_TOOLCHAIN=0
    SET DEPOT_TOOLS=%CD%/depot_tools
    SET PYTHONHOME=%DEPOT_TOOLS%/python276_bin
    SET PYTHONPATH=%CD%/v8/build/gyp
    SET PATH=%DEPOT_TOOLS%;%PYTHONHOME%;%PATH%
    
    SET GYP_DEFINES=target_arch=x64
    REM SET GYP_DEFINES=target_arch=x64 component=shared_library v8_use_snapshot=false
    REM About GYP_DEFINES: https://github.com/v8/v8/wiki/Building-with-Gyp
    
    IF EXIST %DEPOT_TOOLS% (
      ECHO Updating depot_tools
      CD %DEPOT_TOOLS%
      CALL git pull
      CD ..
    ) ELSE (
      ECHO Getting depot_tools
      CALL git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    )
    
    CALL gclient
    CALL gclient config https://chromium.googlesource.com/v8/v8.git
    CALL gclient sync