Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MSYS2 MinGW64 builds #46

Merged
merged 12 commits into from
Dec 17, 2020
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
4 changes: 3 additions & 1 deletion cgo.go
Original file line number Diff line number Diff line change
@@ -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 OR linux) CXXFLAGS: -I${SRCDIR}/deps/include
neptoess marked this conversation as resolved.
Show resolved Hide resolved
// #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"
3 changes: 3 additions & 0 deletions v8go.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ extern "C"
/********** Isolate **********/

void Init() {
#ifdef _WIN32
V8::InitializeExternalStartupData(".");
#endif
V8::InitializePlatform(default_platform.get());
V8::Initialize();
return;
Expand Down