转载请说明原出处,谢谢~~
首先感谢wke内核作者BlzFans和soui2作者flyhigh,使得基于webkit内核的浏览器控件小巧,易于使用。
wke的源码是基于vs2005和vs2008的工程,这对于现在公司的一些新项目而言,编译器版本太老了些,wke也就有了升级为高版本工程的需求。升级时,碰到了不少错误,查阅一些博客时候,发现也有不少寻找高版本工程的,不过升级的资料较少,看来大神们是不削于做这种工作的了,哈哈,开个玩笑。我就将自己升级时候碰到的一些问题,记录下来吧。
用vs2010或者vs2013直接升级时,从升级报告中可以看到很多错误,仔细查看都是“.vsprops”文件找不到这一类型错误,查看前面的路径可以知道,是该属性文件的路径有误。因此用记事本打开vs2008/vsprops/目录下面,名字中带有release和debug的文件,在其所有的路径前面增加“..\..\”,如图所示:
(为了方便,可以将这个vs2008文件夹复制2份出来,分别命名为vs2010,vs2013。)
直接用vs2010打开工程文件,可以看到升级报告里面已经没有错误了。接下来,就是处理丢失的各种工程属性和设置。在vs视图→属性管理器中展开各个项目的属性文件。依次处理每个属性页的 常规标签,用户宏标签,c/c++标签下面的常规、预处理器、预编译头、代码生成,高级,链接器标签下面的输入等。其中FeatureDefinesCairo用户宏比较多,可以从WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops中复制宏名。设置属性页时候,尽量先从list下方的属性页设置,上方的属性页选择从父级继承,有新的就添加。common属性页的WEBKITOUTPUTDIR按照自己工程设置输出目录,另外需要将ConfigurationBuiDir移动到最下面。
所有设置完成以后,vs2010工程就升级成功,可以编译通过了。
如果是vs2013,还会报大量模板语法错误,错误都指向了Source\JavaScriptCore\wtf\HashSet.h文件。如下修改HashSet.h文件。
/*
* Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef WTF_HashSet_h
#define WTF_HashSet_h
#include "FastAllocBase.h"
#include "HashTable.h"
namespace WTF {
template<typename Value, typename HashFunctions, typename Traits> class HashSet;
template<typename Value, typename HashFunctions, typename Traits>
void deleteAllValues(const HashSet<Value, HashFunctions, Traits>&);
template<typename Value, typename HashFunctions, typename Trai