How to build V8 on Windows and not go mad

Max Koretskyi
May 15, 2017 · 8 min read

“Building V8 is not for the faint of heart “ — someone on the internet

Setting up environment

Git

VS 2015

Windows SDK

Depot tools

Environment variables

Update Depot tools

Get source code

fetch v8
cd v8

Building V8

python path/to/script params
path/to/script params
gclient sync
python tools/dev/v8gen.py x64.release
is_component_build = false
v8_static_library = true
gn out.gn\x64.release
is_debug = false
target_cpu = “x64”
is_component_build = false
v8_static_library = true
ninja -C out.gn/x64.release
tools/run-tests.py --gn

Build result

Embedding V8 into a custom application

Configure include and library directories

Compose HelloWorld cpp file

#include “stdafx.h”

Link static libraries

#pragma comment(lib, "v8_base.lib")
#pragma comment(lib, "v8_libbase")
#pragma comment(lib, "v8_external_snapshot")
#pragma comment(lib, "v8_libplatform")
#pragma comment(lib, "v8_libsampler")
#pragma comment(lib, "icuuc.lib")
#pragma comment(lib, "icui18n.lib")
#pragma comment(lib, "inspector")
#pragma comment(lib, "winmm.lib")
#pragma comment(lib, "dbghelp.lib")
#pragma comment(lib, "shlwapi.lib")

Build the application

..\project-folder\x64\Release\project-name.exe

A few more bits

Thanks for reading! If you liked this article, hit that clap button below 👏. It means a lot to me and it helps other people see the story. For more insights follow me on Twitter and on Medium.

Angular In Depth

The place where advanced Angular concepts are explained