diff --git a/README.md b/README.md index 39af9acd..d6468e76 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,18 @@ are included for Linux and OSX ie. you *should not* require to build V8 yourself V8 requires 64-bit, therefore will not work on 32-bit systems. +## Windows +While no prebuilt static V8 library is included for Windows, MSYS2 provides a package containing +a dynamically linked V8 library that works. + +To set this up: +1. Install MSYS2 (https://www.msys2.org/) +2. Add the Mingw-w64 bin to your PATH environment variable (`C:\msys64\mingw64\bin` by default) +3. Open MSYS2 MSYS and execute `pacman -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-v8` +4. This will allow building projects that depend on `v8go`, but, in order to actually run them, + you will need to copy the `snapshot_blob.bin` file from the Mingw-w64 bin folder to your program's + working directory (which is typically wherever `main.go` is) + --- V8 Gopher image based on original artwork from the amazing [Renee French](http://reneefrench.blogspot.com). diff --git a/cgo.go b/cgo.go index af5fce47..199181f4 100644 --- a/cgo.go +++ b/cgo.go @@ -1,7 +1,9 @@ package v8go -// #cgo CXXFLAGS: -fno-rtti -fpic -std=c++14 -I${SRCDIR}/deps/include -DV8_COMPRESS_POINTERS -DV8_31BIT_SMIS_ON_64BIT_ARCH +// #cgo CXXFLAGS: -fno-rtti -fpic -std=c++14 -DV8_COMPRESS_POINTERS -DV8_31BIT_SMIS_ON_64BIT_ARCH +// #cgo darwin linux CXXFLAGS: -I${SRCDIR}/deps/include // #cgo LDFLAGS: -pthread -lv8 +// #cgo windows LDFLAGS: -lv8_libplatform // #cgo darwin LDFLAGS: -L${SRCDIR}/deps/darwin-x86_64 // #cgo linux LDFLAGS: -L${SRCDIR}/deps/linux-x86_64 import "C" diff --git a/v8go.cc b/v8go.cc index 2ea3c1de..b393dfb1 100644 --- a/v8go.cc +++ b/v8go.cc @@ -85,6 +85,9 @@ extern "C" /********** Isolate **********/ void Init() { +#ifdef _WIN32 + V8::InitializeExternalStartupData("."); +#endif V8::InitializePlatform(default_platform.get()); V8::Initialize(); return;