how to build:
http://code.google.com/p/v8/wiki/BuildingWithGYP
svn:
http://tortoisesvn.net/downloads/
python(2.7):
http://www.python.org/download/
download source and build in command lines:
1. svn checkout http://v8.googlecode.com/svn/trunk/ v8
Change to v8 dir and do the rest:
2. svn checkout http://gyp.googlecode.com/svn/trunk build/gyp
3. svn checkout http://src.chromium.org/svn/trunk/deps/third_party/cygwin@66844 third_party/cygwin
4. add python's dir such as "c:\python27" to PATH env.
5. python build\gyp_v8 -Dtarget_arch=ia32 -Dcomponent=shared_library
python build\gyp_v8 -Dtarget_arch=x64
python build\gyp_v8 -Dtarget_arch=ia32
all.sln will be generated in "build" subdir.
6. "c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com" /build Release build\All.sln
7. copy v8.dll to windows system32 dir.
edit preparser.vcxproj in preparser dir under v8, replace all "USING_V8_SHARED" with "BUILDING_V8_SHARED".
* path problems may occur when compiling using IDE, use command line please.
//////////////////////////////////////////////////////////////////////
Ubuntu 12
svn + python + gcc + make
1. svn checkout http://v8.googlecode.com/svn/trunk/ v8
2. cd v8
3. make dependencies
4. make native mode=debug library=shared snapshot=on
5. sudo cp ./out/native/lib.target/libv8.so /usr/lib/
//////////////////////////////////////////////////////////////////////
// Hello world for Visual Studio
#include "v8.h"
#pragma comment(lib, "v8.lib")
using namespace v8;
int main(int argc, char* argv[])
{
// Get the default Isolate created at startup.
Isolate* isolate = Isolate::GetCurrent();
// Create a stack-allocated handle scope.
HandleScope handle_scope(isolate);
// Create a new context.
Handle<Context> context = Context::New(isolate);
// Here's how you could create a Persistent handle to the context, if needed.
Persistent<Context> persistent_context(isolate, context);
// Enter the created context for compiling and
// running the hello world script.
Context::Scope context_scope(context);
// Create a string containing the JavaScript source code.
Handle<String> source = String::New("'Hello' + ', World!'");
// Compile the source code.
Handle<Script> script = Script::Compile(source);
// Run the script to get the result.
Handle<Value> result = script->Run();
// The persistent handle needs to be eventually disposed.
persistent_context.Dispose();
// Convert the result to an ASCII string and print it.
String::AsciiValue ascii(result);
printf("result: %s\n", *ascii);
return 0;
}