v8官网svn不能下载github下载地址https://github.com/v8/v8

The official mirror of the V8 SVN repository

 

http://code.google.com/p/v8/

本机环境是win7+vs2010(本来想用2012的,但是发现默认的项目是2010的)


1、首先下载V8的源码

安装好svn,并在cmd下能使用svn help:

svn下载地址(安装包):http://download.csdn.net/detail/zengraoli/5651551

v8官网svn不能下载github下载地址https://github.com/v8/v8_第1张图片


使用svn检出命令,check out V8项目:

svn checkout http://v8.googlecode.com/svn/trunk/  v8 
(末尾的V8为保存目录的相对地址,可以先cd到合适的位置运行svn) 


2、看看google给的build帮助

https://developers.google.com/v8/build

看这里:



需要使用gyp来生成项目

http://code.google.com/p/v8/wiki/BuildingWithGYP


v8官网svn不能下载github下载地址https://github.com/v8/v8_第2张图片


可以看到是需要python(版本需要2.6)cygwin

这两个东西不好导出,我等会上传到csdn中,上传之后再更新这个地方

python下载地址rar:http://download.csdn.net/detail/zengraoli/5651319

cygwin下载地址rar:http://download.csdn.net/detail/zengraoli/5651299


当然你可以试试下面的方法检出(经常会失败或者不完全,你可以试试)

svn co http://src.chromium.org/svn/trunk/deps/third_party/cygwin

svn co http://src.chromium.org/svn/trunk/tools/third_party/python_26


3、假设这里你已经把V8源码检出了

在在 V8 源码目录下建立 third_party


v8官网svn不能下载github下载地址https://github.com/v8/v8_第3张图片


把下载到的python(版本需要2.6)cygwin的项目解压到third_party里面

v8官网svn不能下载github下载地址https://github.com/v8/v8_第4张图片


4、检出gyp项目代码

svn co http://gyp.googlecode.com/svn/trunk build/gyp

为了方便,等会也上次到csdn中,目录等会更新

gyp下载地址rar:http://download.csdn.net/detail/zengraoli/5650291


将其放在 V8 源码目录/build目录下

v8官网svn不能下载github下载地址https://github.com/v8/v8_第5张图片

注意:我这里已经生成项目了,所有会出现all.sln


5、生成vs工程

v8目录底下执行cmd命令

third_party\python_26\python build\ gyp_v8

执行完毕你就可以看到gyp_v8同一级目录中出现All.vcxproj了


6、打开这个工程,生成一下解决方案

v8官网svn不能下载github下载地址https://github.com/v8/v8_第6张图片

编译之后得到v8_base.ia32.libv8_nosnapshot.ia32.libv8_snapshot.lib


在这里新建一个工程test_v8

v8官网svn不能下载github下载地址https://github.com/v8/v8_第7张图片


测试一下使用v8

测试项目的下载地址(包含需要到的lib)

http://download.csdn.net/detail/zengraoli/5651447


设置一下输出目录(为了匹配刚才生成的几个lib)..\build\$(Configuration)\

设置一下中间目录:$(OutDir)obj\$(ProjectName)\




[cpp] view plain copy print ?
  1. // test_v8.cpp : 定义控制台应用程序的入口点。   
  2. //   
  3.   
  4. #include "stdafx.h"   
  5. #include     
  6. #include "../include/v8.h" //根据自己的情况选择好文件位置,或者修改项目头文件路径    
  7.   
  8.   
  9. #ifdef _DEBUG    
  10. #pragma comment(lib,"v8_base.ia32.lib")    
  11. #pragma comment(lib,"v8_nosnapshot.ia32.lib")    
  12. #pragma comment(lib,"v8_snapshot.lib")    
  13. #else    
  14. #pragma comment(lib,"v8.lib")    
  15. #endif    
  16.   
  17.   
  18. //v8 need this  使用V8需要链接ws2_32.lib和winmm.lib    
  19. #pragma comment( lib,"ws2_32.lib" )    
  20. #pragma comment(lib,"winmm.lib")    
  21.   
  22.   
  23. using namespace v8;   
  24.   
  25. // Creates a new execution environment containing the built-in   
  26. // functions.   
  27. v8::Handle CreateShellContext(v8::Isolate* isolate) {  
  28.     // Create a template for the global object.   
  29.     return v8::Context::New(isolate);  
  30. }  
  31.   
  32.   
  33. int _tmain(int argc, _TCHAR* argv[])  
  34. {  
  35.     HandleScope handle_scope;  
  36.   
  37.     v8::Isolate* isolate = v8::Isolate::GetCurrent();  
  38.     Handle context = CreateShellContext(isolate);  
  39.     Context::Scope context_scope(context);    
  40.   
  41.     // Create a string containing the JavaScript source code.      
  42.     Handle source = String::New("'Hello' + ', World!'");    
  43.   
  44.     // Compile the source code.      
  45.     Handle

你可能感兴趣的:(v8)