webkit在win32下的編譯規則(三)

首先來看WTF這個project,這個project的Pre-build event如下:

   1: REM Do not edit from the Visual Studio IDE! Customize via a $(ProjectName)PreBuild.cmd file.
   2: if not exist "$(ProjectDir)$(ProjectName)PreBuild.cmd" exit /b
   3:  
   4: set CONFIGURATIONBUILDDIR=$(ConfigurationBuildDir)
   5: set CONFIGURATIONNAME=$(ConfigurationName)
   6: set INPUTDIR=$(InputDir)
   7: set INPUTFILENAME=$(InputFileName)
   8: set INPUTPATH=$(InputPath)
   9: set INTDIR=$(IntDir)
  10: set LIBRARYCONFIGSUFFIX=$(LibraryConfigSuffix)
  11: set OUTDIR=$(OutDir)
  12: set PLATFORMNAME=$(PlatformName)
  13: set PROJECTDIR=$(ProjectDir)
  14: set PROJECTFILENAME=$(ProjectFileName)
  15: set PROJECTNAME=$(ProjectName)
  16: set PROJECTPATH=$(ProjectPath)
  17: set SOLUTIONDIR=$(SolutionDir)
  18: set SOLUTIONFILENAME=$(SolutionFileName)
  19: set SOLUTIONNAME=$(SolutionName)
  20: set SOLUTIONPATH=$(SolutionPath)
  21: set TARGETDIR=$(TargetDir)
  22: set TARGETEXT=$(TargetExt)
  23: set TARGETFILENAME=$(TargetFileName)
  24: set TARGETPATH=$(TargetPath)
  25: set WEBKITCONFIGSUFFIX=$(WebKitConfigSuffix)
  26: set WEBKITDLLCONFIGSUFFIX=$(WebKitDLLConfigSuffix)
  27:  
  28: REM If any of the above variables didn't exist previously and
  29: REM were set to an empty string, set will set the errorlevel to 1,
  30: REM which will cause the project-specific script to think the build
  31: REM has failed. This cmd /c call will clear the errorlevel.
  32: cmd /c
  33:  
  34: "$(ProjectDir)$(ProjectName)PreBuild.cmd"

這些腳本首先利用vs自帶的一些內置變量來設置環境變量,然後調用"$(ProjectDir)$(ProjectName)PreBuild.cmd"這個腳本,展開後的路徑是D:/tools/cygwin/home/xufan/WebKit/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCorePreBuild.cmd。從上面的28-31行可以看出,cmd /c的主要作用是爲了清除errorlevel。JavaScriptCorePreBuild.cmd這個腳本的內容如下:

   1: %SystemDrive%/cygwin/bin/which.exe bash
   2: if errorlevel 1 set PATH=%SystemDrive%/cygwin/bin;%PATH%
   3: cmd /c
   4: if exist "%CONFIGURATIONBUILDDIR%/buildfailed" grep XX%PROJECTNAME%XX "%CONFIGURATIONBUILDDIR%/buildfailed"
   5: if errorlevel 1 exit 1
   6: echo XX%PROJECTNAME%XX > "%CONFIGURATIONBUILDDIR%/buildfailed"
   7:  
   8: bash "%WEBKITLIBRARIESDIR%/tools/scripts/auto-version.sh" "%INTDIR%"

JavaScriptCorePreBuild.cmd首先檢查前面的編譯有沒有問題,如果沒有問題,就會調用D:/tools/cygwin/home/xufan/WebKit/WebKitLibraries/win/tools/scripts/auto-version.sh這個perl腳本,內容如下:

   1: #!/usr/bin/bash
   2:  
   3: # Copyright (C) 2007, 2009 Apple Inc.  All rights reserved.
   4: #
   5: # Redistribution and use in source and binary forms, with or without
   6: # modification, are permitted provided that the following conditions
   7: # are met:
   8: # 1. Redistributions of source code must retain the above copyright
   9: #    notice, this list of conditions and the following disclaimer.
  10: # 2. Redistributions in binary form must reproduce the above copyright
  11: #    notice, this list of conditions and the following disclaimer in the
  12: #    documentation and/or other materials provided with the distribution.
  13: #
  14: # THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
  15: # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  16: # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  17: # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
  18: # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  19: # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  20: # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  21: # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  22: # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23: # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  24: # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  25:  
  26:  
  27: # Trim any trailing /r or /n from the given variable.
  28: chomp()
  29: {
  30:     local old_value=$(eval echo "/$$1");
  31:     local value=$(echo "$old_value" | sed 's/[/r/n]*$//')
  32:     eval $1=/$value;
  33: }
  34:  
  35: if [[ -n "$WEBKITLIBRARIESDIR" ]]; then
  36:     FALLBACK_VERSION_PATH=`cygpath -u "$WEBKITLIBRARIESDIR//tools//scripts//VERSION"`
  37:     FALLBACK_VERSION=$(cat "$FALLBACK_VERSION_PATH");
  38:  
  39:     COPYRIGHT_END_YEAR_PATH=`cygpath -u "$WEBKITLIBRARIESDIR//tools//scripts//COPYRIGHT-END-YEAR"`
  40:     COPYRIGHT_END_YEAR=$(cat "$COPYRIGHT_END_YEAR_PATH");
  41:     chomp COPYRIGHT_END_YEAR
  42: fi
  43:  
  44: OUTPUT_FILE=$(cygpath -u "$1")/include/autoversion.h
  45: mkdir -p "$(dirname "$OUTPUT_FILE")"
  46:  
  47: # Take the initial version number from RC_PROJECTSOURCEVERSION if it
  48: # exists, otherwise fall back to the version number stored in the source.
  49: ENVIRONMENT_VERSION="$RC_PROJECTSOURCEVERSION";
  50: PROPOSED_VERSION=${ENVIRONMENT_VERSION:-$FALLBACK_VERSION}
  51: chomp PROPOSED_VERSION
  52:  
  53: # Split out the three components of the dotted version number.  We pad
  54: # the input with trailing dots to handle the case where the input version
  55: # has fewer components than we expect.
  56: BUILD_MAJOR_VERSION=$(echo "$PROPOSED_VERSION.." | cut -d '.' -f 1)
  57: BUILD_MINOR_VERSION=$(echo "$PROPOSED_VERSION.." | cut -d '.' -f 2)
  58: BUILD_TINY_VERSION=$(echo "$PROPOSED_VERSION.." | cut -d '.' -f 3)
  59:  
  60: # Cut the major component down to three characters by dropping any
  61: # extra leading digits, then adjust the major version portion of the
  62: # version string to match.
  63: CHARACTERS_TO_DROP=$(( ${#BUILD_MAJOR_VERSION} > 3 ? ${#BUILD_MAJOR_VERSION} - 3 : 0 ))
  64: BUILD_MAJOR_VERSION=${BUILD_MAJOR_VERSION:$CHARACTERS_TO_DROP}
  65: PROPOSED_VERSION=${PROPOSED_VERSION:$CHARACTERS_TO_DROP}
  66:  
  67: # Have the minor and tiny components default to zero if not present.
  68: BUILD_MINOR_VERSION=${BUILD_MINOR_VERSION:-0}
  69: BUILD_TINY_VERSION=${BUILD_TINY_VERSION:-0}
  70:  
  71: # Split the first component further by using the first digit for the
  72: # major version and the remaining two characters as the minor version.
  73: # The minor version is shifted down to the tiny version, with the tiny
  74: # version becoming the variant version.
  75: MAJOR_VERSION=${BUILD_MAJOR_VERSION:0:1}
  76: MINOR_VERSION=${BUILD_MAJOR_VERSION:1}
  77: TINY_VERSION=${BUILD_MINOR_VERSION}
  78: VARIANT_VERSION=${BUILD_TINY_VERSION}
  79:  
  80: VERSION_TEXT=${PROPOSED_VERSION}
  81: VERSION_TEXT_SHORT=${VERSION_TEXT}
  82:  
  83: if [ -z ${ENVIRONMENT_VERSION} ]; then
  84:     # If we didn't pull the version number from the environment then we're doing
  85:     # an engineering build and we'll stamp the build with some more information.
  86:  
  87:     BUILD_DATE=$(date)
  88:     SVN_REVISION=$(svn info | grep '^Revision' | sed 's/^Revision: //')
  89:  
  90:     chomp BUILD_DATE
  91:     chomp SVN_REVISION
  92:  
  93:     VERSION_TEXT_SHORT="${VERSION_TEXT_SHORT}+"
  94:     VERSION_TEXT="${VERSION_TEXT_SHORT} ${USER} - ${BUILD_DATE} - r${SVN_REVISION}"
  95: fi
  96:  
  97: cat > "$OUTPUT_FILE" <


    
  98: #define __VERSION_TEXT__ "${VERSION_TEXT}"
  99: #define __BUILD_NUMBER__ "${VERSION_TEXT}"
 100: #define __BUILD_NUMBER_SHORT__ "${VERSION_TEXT_SHORT}"
 101: #define __VERSION_MAJOR__ ${MAJOR_VERSION}
 102: #define __VERSION_MINOR__ ${MINOR_VERSION}
 103: #define __VERSION_TINY__ ${TINY_VERSION}
 104: #define __VERSION_BUILD__ ${VARIANT_VERSION}
 105: #define __BUILD_NUMBER_MAJOR__ ${BUILD_MAJOR_VERSION}
 106: #define __BUILD_NUMBER_MINOR__ ${BUILD_MINOR_VERSION}
 107: #define __BUILD_NUMBER_VARIANT__ ${BUILD_TINY_VERSION}
 108: #define __SVN_REVISION__ ${SVN_REVISION}
 109: EOF
 110:  
 111: if [[ -n "${COPYRIGHT_END_YEAR}" ]]; then
 112: cat >> "$OUTPUT_FILE" <


    
 113: #define __COPYRIGHT_YEAR_END_TEXT__ "${COPYRIGHT_END_YEAR}"
 114: EOF
 115: fi

auto-version.sh這個腳本主要是根據D:/tools/cygwin/home/xufan/WebKit/WebKitLibraries/win/tools/scripts/VERSION,D:/tools/cygwin/home/xufan/WebKit/WebKitLibraries/win/tools/scripts/COPYRIGHT-END-YEAR以及當前時間等生成D:/tools/cygwin/home/xufan/WebKit/WebKitBuild/Debug_Cairo_CFLite/obj/JavaScriptCore/include/autoversion.h這個描述版本信息的頭文件,這個頭文件在生成後的格式如下:

   1: #define __VERSION_TEXT__ "533+  - Mon Jan 31 12:26:06 2011 - r77102"
   2: #define __BUILD_NUMBER__ "533+  - Mon Jan 31 12:26:06 2011 - r77102"
   3: #define __BUILD_NUMBER_SHORT__ "533+"
   4: #define __VERSION_MAJOR__ 5
   5: #define __VERSION_MINOR__ 33
   6: #define __VERSION_TINY__ 0
   7: #define __VERSION_BUILD__ 0
   8: #define __BUILD_NUMBER_MAJOR__ 533
   9: #define __BUILD_NUMBER_MINOR__ 0
  10: #define __BUILD_NUMBER_VARIANT__ 0
  11: #define __SVN_REVISION__ 77102
  12: #define __COPYRIGHT_YEAR_END_TEXT__ "2011"

這些信息會體現在javascriptcore.dll這個文件的版本信息裏面,如下圖:

image

執行完prebuild腳本後,就要開始編譯了。wtf這個project有一些屬性是從別的vsprops文件集成來的,如下圖:

image

這些vsprops文件包含:

../../../../WebKitLibraries/win/tools/vsprops/FeatureDefinesCairo.vsprops
../../../../WebKitLibraries/win/tools/vsprops/common.vsprops
../../../../WebKitLibraries/win/tools/vsprops/release.vsprops
../../../../WebKitLibraries/win/tools/vsprops/WinCairo.vsprops
./WTFCommon.vsprops

首先看D:/tools/cygwin/home/xufan/WebKit/WebKitLibraries/win/tools/vsprops/FeatureDefinesCairo.vsprops這個文件:

   1: xml version="1.0" encoding="Windows-1252"?>
   2: 
   3: 
   4: 
   5: <VisualStudioPropertySheet
   6:     ProjectType="Visual C++"
   7:     Version="8.00"
   8:     Name="FeatureDefinesCairo"
   9:     >
  10:   <Tool
  11:         Name="VCCLCompilerTool"
  12:         PreprocessorDefinitions="$(ENABLE_3D_CANVAS);$(ENABLE_3D_RENDERING);$(ENABLE_ACCELERATED_2D_CANVAS);$(ENABLE_BLOB);$(ENABLE_CHANNEL_MESSAGING);$(ENABLE_CLIENT_BASED_GEOLOCATION);$(ENABLE_DATABASE);$(ENABLE_DATAGRID);$(ENABLE_DATALIST);$(ENABLE_DEVICE_ORIENTATION);$(ENABLE_DIRECTORY_UPLOAD);$(ENABLE_DOM_STORAGE);$(ENABLE_EVENTSOURCE);$(ENABLE_FILTERS);$(ENABLE_FILE_SYSTEM);$(ENABLE_FULLSCREEN_API);$(ENABLE_GEOLOCATION);$(ENABLE_ICONDATABASE);$(ENABLE_IMAGE_RESIZER);$(ENABLE_INDEXED_DATABASE);$(ENABLE_INPUT_SPEECH);$(ENABLE_JAVASCRIPT_DEBUGGER);$(ENABLE_LINK_PREFETCH);$(ENABLE_MATHML);$(ENABLE_METER_TAG);$(ENABLE_NOTIFICATIONS);$(ENABLE_OFFLINE_WEB_APPLICATIONS);$(ENABLE_PROGRESS_TAG);$(ENABLE_REGISTER_PROTOCOL_HANDLER);$(ENABLE_SHARED_WORKERS);$(ENABLE_SVG);$(ENABLE_SVG_ANIMATION);$(ENABLE_SVG_AS_IMAGE);$(ENABLE_SVG_DOM_OBJC_BINDINGS);$(ENABLE_SVG_FONTS);$(ENABLE_SVG_FOREIGN_OBJECT);$(ENABLE_SVG_USE);$(ENABLE_VIDEO);$(ENABLE_MEDIA_STATISTICS);$(ENABLE_WEB_SOCKETS);$(ENABLE_WEB_TIMING);$(ENABLE_WML);$(ENABLE_WORKERS);$(ENABLE_XHTMLMP);$(ENABLE_XPATH);$(ENABLE_XSLT)"
  13:     />
  14:   <UserMacro
  15:         Name="ENABLE_3D_CANVAS"
  16:         Value=""
  17:         PerformEnvironmentSet="true"
  18:     />
  19:   <UserMacro
  20:         Name="ENABLE_3D_RENDERING"
  21:         Value=""
  22:         PerformEnvironmentSet="true"
  23:     />
  24:   <UserMacro
  25:         Name="ENABLE_ACCELERATED_2D_CANVAS"
  26:         Value=""
  27:         PerformEnvironmentSet="true"
  28:     />
  29:   <UserMacro
  30:         Name="ENABLE_BLOB"
  31:         Value=""
  32:         PerformEnvironmentSet="true"
  33:     />
  34:   <UserMacro
  35:         Name="ENABLE_CHANNEL_MESSAGING"
  36:         Value="ENABLE_CHANNEL_MESSAGING"
  37:         PerformEnvironmentSet="true"
  38:     />
  39:   <UserMacro
  40:         Name="ENABLE_CLIENT_BASED_GEOLOCATION"
  41:         Value=""
  42:         PerformEnvironmentSet="true"
  43:     />
  44:   <UserMacro
  45:         Name="ENABLE_DATABASE"
  46:         Value="ENABLE_DATABASE"
  47:         PerformEnvironmentSet="true"
  48:     />
  49:   <UserMacro
  50:         Name="ENABLE_DATAGRID"
  51:         Value=""
  52:         PerformEnvironmentSet="true"
  53:     />
  54:   <UserMacro
  55:         Name="ENABLE_DATALIST"
  56:         Value="ENABLE_DATALIST"
  57:         PerformEnvironmentSet="true"
  58:     />
  59:   <UserMacro
  60:         Name="ENABLE_DEVICE_ORIENTATION"
  61:         Value=""
  62:         PerformEnvironmentSet="true"
  63:     />
  64:   <UserMacro
  65:                 Name="ENABLE_DIRECTORY_UPLOAD"
  66:                 Value=""
  67:                 PerformEnvironmentSet="true"
  68:         />
  69:   <UserMacro
  70:         Name="ENABLE_DOM_STORAGE"
  71:         Value="ENABLE_DOM_STORAGE"
  72:         PerformEnvironmentSet="true"
  73:     />
  74:   <UserMacro
  75:         Name="ENABLE_EVENTSOURCE"
  76:         Value="ENABLE_EVENTSOURCE"
  77:         PerformEnvironmentSet="true"
  78:     />
  79:   <UserMacro
  80:         Name="ENABLE_FILTERS"
  81:         Value="ENABLE_FILTERS"
  82:         PerformEnvironmentSet="true"
  83:     />
  84:   <UserMacro
  85:         Name="ENABLE_FILE_SYSTEM"
  86:         Value=""
  87:         PerformEnvironmentSet="true"
  88:     />
  89:   <UserMacro
  90:         Name="ENABLE_FULLSCREEN_API"
  91:         Value=""
  92:         PerformEnvironmentSet="true"
  93:     />
  94:   <UserMacro
  95:         Name="ENABLE_GEOLOCATION"
  96:         Value=""
  97:         PerformEnvironmentSet="true"
  98:     />
  99:   <UserMacro
 100:         Name="ENABLE_ICONDATABASE"
 101:         Value="ENABLE_ICONDATABASE"
 102:         PerformEnvironmentSet="true"
 103:     />
 104:   <UserMacro
 105:         Name="ENABLE_IMAGE_RESIZER"
 106:         Value=""
 107:         PerformEnvironmentSet="true"
 108:     />
 109:   <UserMacro
 110:         Name="ENABLE_INDEXED_DATABASE"
 111:         Value=""
 112:         PerformEnvironmentSet="true"
 113:     />
 114:   <UserMacro
 115:         Name="ENABLE_INPUT_SPEECH"
 116:         Value=""
 117:         PerformEnvironmentSet="true"
 118:     />
 119:   <UserMacro
 120:         Name="ENABLE_JAVASCRIPT_DEBUGGER"
 121:         Value="ENABLE_JAVASCRIPT_DEBUGGER"
 122:         PerformEnvironmentSet="true"
 123:     />
 124:   <UserMacro
 125:         Name="ENABLE_LINK_PREFETCH"
 126:         Value=""
 127:         PerformEnvironmentSet="true"
 128:     />
 129:   <UserMacro
 130:         Name="ENABLE_MATHML"
 131:         Value=""
 132:         PerformEnvironmentSet="true"
 133:     />
 134:   <UserMacro
 135:         Name="ENABLE_METER_TAG"
 136:         Value="ENABLE_METER_TAG"
 137:         PerformEnvironmentSet="true"
 138:     />
 139:   <UserMacro
 140:         Name="ENABLE_NOTIFICATIONS"
 141:         Value=""
 142:         PerformEnvironmentSet="true"
 143:     />
 144:   <UserMacro
 145:         Name="ENABLE_OFFLINE_WEB_APPLICATIONS"
 146:         Value="ENABLE_OFFLINE_WEB_APPLICATIONS"
 147:         PerformEnvironmentSet="true"
 148:     />
 149:   <UserMacro
 150:         Name="ENABLE_PROGRESS_TAG"
 151:         Value=""
 152:         PerformEnvironmentSet="true"
 153:     />
 154:   <UserMacro
 155:         Name="ENABLE_REGISTER_PROTOCOL_HANDLER"
 156:         Value=""
 157:         PerformEnvironmentSet="true"
 158:     />
 159:   <UserMacro
 160:         Name="ENABLE_SHARED_WORKERS"
 161:         Value="ENABLE_SHARED_WORKERS"
 162:         PerformEnvironmentSet="true"
 163:     />
 164:   <UserMacro
 165:         Name="ENABLE_SVG"
 166:         Value="ENABLE_SVG"
 167:         PerformEnvironmentSet="true"
 168:     />
 169:   <UserMacro
 170:         Name="ENABLE_SVG_ANIMATION"
 171:         Value="ENABLE_SVG_ANIMATION"
 172:         PerformEnvironmentSet="true"
 173:     />
 174:   <UserMacro
 175:         Name="ENABLE_SVG_AS_IMAGE"
 176:         Value="ENABLE_SVG_AS_IMAGE"
 177:         PerformEnvironmentSet="true"
 178:     />
 179:   <UserMacro
 180:         Name="ENABLE_SVG_DOM_OBJC_BINDINGS"
 181:         Value=""
 182:         PerformEnvironmentSet="true"
 183:     />
 184:   <UserMacro
 185:         Name="ENABLE_SVG_FONTS"
 186:         Value="ENABLE_SVG_FONTS"
 187:         PerformEnvironmentSet="true"
 188:     />
 189:   <UserMacro
 190:         Name="ENABLE_SVG_FOREIGN_OBJECT"
 191:         Value="ENABLE_SVG_FOREIGN_OBJECT"
 192:         PerformEnvironmentSet="true"
 193:     />
 194:   <UserMacro
 195:         Name="ENABLE_SVG_USE"
 196:         Value="ENABLE_SVG_USE"
 197:         PerformEnvironmentSet="true"
 198:     />
 199:   <UserMacro
 200:         Name="ENABLE_VIDEO"
 201:         Value=""
 202:         PerformEnvironmentSet="true"
 203:     />
 204:   <UserMacro
 205:         Name="ENABLE_MEDIA_STATISTICS"
 206:         Value=""
 207:         PerformEnvironmentSet="true"
 208:     />
 209:   <UserMacro
 210:         Name="ENABLE_WEB_AUDIO"
 211:         Value=""
 212:         PerformEnvironmentSet="true"
 213:     />
 214:   <UserMacro
 215:         Name="ENABLE_WEB_SOCKETS"
 216:         Value="ENABLE_WEB_SOCKETS"
 217:         PerformEnvironmentSet="true"
 218:     />
 219:   <UserMacro
 220:         Name="ENABLE_WEB_TIMING"
 221:         Value=""
 222:         PerformEnvironmentSet="true"
 223:     />
 224:   <UserMacro
 225:         Name="ENABLE_WML"
 226:         Value=""
 227:         PerformEnvironmentSet="true"
 228:     />
 229:   <UserMacro
 230:         Name="ENABLE_WORKERS"
 231:         Value="ENABLE_WORKERS"
 232:         PerformEnvironmentSet="true"
 233:     />
 234:   <UserMacro
 235:         Name="ENABLE_XHTMLMP"
 236:         Value=""
 237:         PerformEnvironmentSet="true"
 238:     />
 239:   <UserMacro
 240:         Name="ENABLE_XPATH"
 241:         Value="ENABLE_XPATH"
 242:         PerformEnvironmentSet="true"
 243:     />
 244:   <UserMacro
 245:         Name="ENABLE_XSLT"
 246:         Value="ENABLE_XSLT"
 247:         PerformEnvironmentSet="true"
 248:     />
 249: VisualStudioPropertySheet>

FeatureDefinesCairo.vsprops這個文件主要是用來定義一些宏,這些宏用來開啓和關閉webkit的特性,例如3D_CANVAS,BLOB,DATABASE,DATAGRID,SVG等。如果要開啓對應的屬性,只需要修改UserMacro裏面的Value屬性即可。

D:/tools/cygwin/home/xufan/WebKit/WebKitLibraries/win/tools/vsprops/common.vsprops這個文件的內容如下:

   1: xml version="1.0" encoding="Windows-1252"?>
   2: <VisualStudioPropertySheet
   3:     ProjectType="Visual C++"
   4:     Version="8.00"
   5:     Name="common"
   6:     OutputDirectory="$(ConfigurationBuildDir)/bin"
   7:     IntermediateDirectory="$(ConfigurationBuildDir)/obj/$(ProjectName)"
   8:     >
   9:     <Tool
  10:         Name="VCCLCompilerTool"
  11:         AdditionalOptions="/GS"
  12:         PreprocessorDefinitions="WIN32;_WINDOWS;WINVER=0x502;_WIN32_WINNT=0x502;_WIN32_IE=0x603;_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1;__PRODUCTION__=0$(ProductionBuild);_HAS_EXCEPTIONS=0;BUILDING_$(ProjectName)"
  13:         ExceptionHandling="0"
  14:         RuntimeTypeInfo="false"
  15:         WarningLevel="4"
  16:         WarnAsError="true"
  17:         DebugInformationFormat="3"
  18:         DisableSpecificWarnings="4018;4068;4099;4100;4127;4138;4180;4189;4201;4244;4251;4275;4288;4291;4305;4344;4355;4389;4503;4505;4510;4512;4610;4706;4800;4951;4952;4996;6011;6031;6211;6246;6255;6387"
  19:     />
  20:     <Tool
  21:         Name="VCLibrarianTool"
  22:         AdditionalOptions="/ignore:4221"
  23:         OutputFile="$(OutDir)/$(ProjectName)$(WebKitConfigSuffix).lib"
  24:     />
  25:     <Tool
  26:         Name="VCLinkerTool"
  27:         LinkLibraryDependencies="false"
  28:         AdditionalOptions="/SAFESEH /FIXED:NO /dynamicbase /ignore:4221"
  29:         OutputFile="$(OutDir)/$(ProjectName)$(WebKitConfigSuffix).exe"
  30:         AdditionalLibraryDirectories=""$(ConfigurationBuildDir)/lib";"$(WebKitLibrariesDir)/lib""
  31:         GenerateDebugInformation="true"
  32:         SubSystem="2"
  33:         ImportLibrary="$(ConfigurationBuildDir)/lib/$(TargetName).lib"
  34:         TargetMachine="1"
  35:     />
  36:     <Tool
  37:         Name="VCMIDLTool"
  38:         PreprocessorDefinitions="__PRODUCTION__=0$(ProductionBuild)"
  39:         WarnAsError="true"
  40:         HeaderFileName="$(OutDir)/$(InputName).h"
  41:     />
  42:     <Tool
  43:         Name="VCPostBuildEventTool"
  44:         CommandLine="REM Do not edit from the Visual Studio IDE! Customize via a $(ProjectName)PostBuild.cmd file
if not exist "$(ProjectDir)$(ProjectName)PostBuild.cmd" exit /b

set CONFIGURATIONBUILDDIR=$(ConfigurationBuildDir)
set CONFIGURATIONNAME=$(ConfigurationName)
set INPUTDIR=$(InputDir)
set INPUTFILENAME=$(InputFileName)
set INPUTPATH=$(InputPath)
set INTDIR=$(IntDir)
set LIBRARYCONFIGSUFFIX=$(LibraryConfigSuffix)
set OUTDIR=$(OutDir)
set PLATFORMNAME=$(PlatformName)
set PROJECTDIR=$(ProjectDir)
set PROJECTFILENAME=$(ProjectFileName)
set PROJECTNAME=$(ProjectName)
set PROJECTPATH=$(ProjectPath)
set SOLUTIONDIR=$(SolutionDir)
set SOLUTIONFILENAME=$(SolutionFileName)
set SOLUTIONNAME=$(SolutionName)
set SOLUTIONPATH=$(SolutionPath)
set TARGETDIR=$(TargetDir)
set TARGETEXT=$(TargetExt)
set TARGETFILENAME=$(TargetFileName)
set TARGETPATH=$(TargetPath)
set WEBKITCONFIGSUFFIX=$(WebKitConfigSuffix)
set WEBKITDLLCONFIGSUFFIX=$(WebKitDLLConfigSuffix)

REM If any of the above variables didn't exist previously and
REM were set to an empty string, set will set the errorlevel to 1,
REM which will cause the project-specific script to think the build
REM has failed. This cmd /c call will clear the errorlevel.
cmd /c

"$(ProjectDir)$(ProjectName)PostBuild.cmd"
"
  45:     />
  46:     <Tool
  47:         Name="VCPreBuildEventTool"
  48:         CommandLine="REM Do not edit from the Visual Studio IDE! Customize via a $(ProjectName)PreBuild.cmd file.
if not exist "$(ProjectDir)$(ProjectName)PreBuild.cmd" exit /b

set CONFIGURATIONBUILDDIR=$(ConfigurationBuildDir)
set CONFIGURATIONNAME=$(ConfigurationName)
set INPUTDIR=$(InputDir)
set INPUTFILENAME=$(InputFileName)
set INPUTPATH=$(InputPath)
set INTDIR=$(IntDir)
set LIBRARYCONFIGSUFFIX=$(LibraryConfigSuffix)
set OUTDIR=$(OutDir)
set PLATFORMNAME=$(PlatformName)
set PROJECTDIR=$(ProjectDir)
set PROJECTFILENAME=$(ProjectFileName)
set PROJECTNAME=$(ProjectName)
set PROJECTPATH=$(ProjectPath)
set SOLUTIONDIR=$(SolutionDir)
set SOLUTIONFILENAME=$(SolutionFileName)
set SOLUTIONNAME=$(SolutionName)
set SOLUTIONPATH=$(SolutionPath)
set TARGETDIR=$(TargetDir)
set TARGETEXT=$(TargetExt)
set TARGETFILENAME=$(TargetFileName)
set TARGETPATH=$(TargetPath)
set WEBKITCONFIGSUFFIX=$(WebKitConfigSuffix)
set WEBKITDLLCONFIGSUFFIX=$(WebKitDLLConfigSuffix)

REM If any of the above variables didn't exist previously and
REM were set to an empty string, set will set the errorlevel to 1,
REM which will cause the project-specific script to think the build
REM has failed. This cmd /c call will clear the errorlevel.
cmd /c

"$(ProjectDir)$(ProjectName)PreBuild.cmd"
"
  49:     />
  50:     <Tool
  51:         Name="VCPreLinkEventTool"
  52:         CommandLine="REM Do not edit from the Visual Studio IDE! Customize via a $(ProjectName)PreLink.cmd file.
if not exist "$(ProjectDir)$(ProjectName)PreLink.cmd" exit /b

set CONFIGURATIONBUILDDIR=$(ConfigurationBuildDir)
set CONFIGURATIONNAME=$(ConfigurationName)
set INPUTDIR=$(InputDir)
set INPUTFILENAME=$(InputFileName)
set INPUTPATH=$(InputPath)
set INTDIR=$(IntDir)
set LIBRARYCONFIGSUFFIX=$(LibraryConfigSuffix)
set OUTDIR=$(OutDir)
set PLATFORMNAME=$(PlatformName)
set PROJECTDIR=$(ProjectDir)
set PROJECTFILENAME=$(ProjectFileName)
set PROJECTNAME=$(ProjectName)
set PROJECTPATH=$(ProjectPath)
set SOLUTIONDIR=$(SolutionDir)
set SOLUTIONFILENAME=$(SolutionFileName)
set SOLUTIONNAME=$(SolutionName)
set SOLUTIONPATH=$(SolutionPath)
set TARGETDIR=$(TargetDir)
set TARGETEXT=$(TargetExt)
set TARGETFILENAME=$(TargetFileName)
set TARGETPATH=$(TargetPath)
set WEBKITCONFIGSUFFIX=$(WebKitConfigSuffix)
set WEBKITDLLCONFIGSUFFIX=$(WebKitDLLConfigSuffix)

REM If any of the above variables didn't exist previously and
REM were set to an empty string, set will set the errorlevel to 1,
REM which will cause the project-specific script to think the build
REM has failed. This cmd /c call will clear the errorlevel.
cmd /c

"$(ProjectDir)$(ProjectName)PreLink.cmd"
"
  53:     />
  54:     <Tool
  55:         Name="VCResourceCompilerTool"
  56:         Culture="1033"
  57:         AdditionalIncludeDirectories=""$(IntDir)/include""
  58:     />
  59:   <UserMacro
  60:         Name="ProductionBuild"
  61:         Value="$(PRODUCTION)"
  62:     />
  63:   <UserMacro
  64:         Name="ConfigurationBuildDir"
  65:         Value="$(WebKitOutputDir)/$(ConfigurationName)"
  66:     />
  67:   <UserMacro
  68:         Name="AnalyzeWithLargeStack"
  69:         Value=""
  70:     />
  71: VisualStudioPropertySheet>

這個文件包含了定義了公用的宏,PreBuildEvent,PostBuildEvent等,例如上面講到的PreBuildEvent就是在這裏定義的。

D:/tools/cygwin/home/xufan/WebKit/WebKitLibraries/win/tools/vsprops/release.vsprops這個文件的內容如下:

   1: xml version="1.0" encoding="Windows-1252"?>
   2: <VisualStudioPropertySheet
   3:     ProjectType="Visual C++"
   4:     Version="8.00"
   5:     Name="release"
   6:     >
   7:     <Tool
   8:         Name="VCCLCompilerTool"
   9:         Optimization="2"
  10:         PreprocessorDefinitions="NDEBUG"
  11:         RuntimeLibrary="0"
  12:         WarnAsError="false"
  13:     />
  14:     <Tool
  15:         Name="VCLinkerTool"
  16:         LinkIncremental="1"
  17:         OptimizeReferences="2"
  18:         EnableCOMDATFolding="2"
  19:         OptimizeForWindows98="1"
  20:     />
  21:     <Tool
  22:         Name="VCResourceCompilerTool"
  23:         PreprocessorDefinitions="NDEBUG"
  24:     />
  25:     <UserMacro
  26:         Name="WebKitConfigSuffix"
  27:         Value=""
  28:         PerformEnvironmentSet="true"
  29:     />
  30:     <UserMacro
  31:         Name="LibraryConfigSuffix"
  32:         Value=""
  33:         PerformEnvironmentSet="true"
  34:     />
  35:     <UserMacro
  36:         Name="WebKitDLLConfigSuffix"
  37:         Value=""
  38:     />
  39: VisualStudioPropertySheet>

release.vsprops這個文件主要定義編譯的一些選項,例如使用的crt版本,優化選項等。

D:/tools/cygwin/home/xufan/WebKit/WebKitLibraries/win/tools/vsprops/WinCairo.vsprops這個文件的內容如下:

   1: xml version="1.0" encoding="Windows-1252"?>
   2: <VisualStudioPropertySheet
   3:     ProjectType="Visual C++"
   4:     Version="8.00"
   5:     Name="WinCairo"
   6:     >
   7:     <Tool
   8:         Name="VCCLCompilerTool"
   9:         AdditionalIncludeDirectories=""$(WebKitLibrariesDir)/include/cairo";"$(SolutionDir)/../../../JavaScriptCore/os-win32""
  10:         PreprocessorDefinitions="WIN_CAIRO=1"
  11:     />
  12:     <Tool
  13:         Name="VCLinkerTool"
  14:         AdditionalDependencies="cairo.lib libjpeg.lib zlib.lib libpng.lib"
  15:         AdditionalLibraryDirectories=""$(WebKitLibrariesDir)/lib""
  16:     />
  17: VisualStudioPropertySheet>

WinCairo.vsprops定義了cairo這個版本的wenkit編譯需要依賴的頭文件目錄和庫文件。

D:/tools/cygwin/home/xufan/WebKit/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops的內容如下:

   1: xml version="1.0" encoding="Windows-1252"?>
   2: <VisualStudioPropertySheet
   3:     ProjectType="Visual C++"
   4:     Version="8.00"
   5:     Name="WTFCommon"
   6:     OutputDirectory="$(ConfigurationBuildDir)/lib"
   7:     >
   8:     <Tool
   9:         Name="VCCLCompilerTool"
  10:         AdditionalIncludeDirectories=""$(ConfigurationBuildDir)/obj/JavaScriptCore/DerivedSources/";../../;"../../os-win32/";../../pcre/;../../parser/;../../wtf/;../../wtf/unicode/;"$(ConfigurationBuildDir)/include/private";"$(WebKitLibrariesDir)/include";../../../icu/include;../../bindings;../../bindings/c;../../bindings/jni;"$(ConfigurationBuildDir)/include/JavaScriptCore";"$(WebKitLibrariesDir)/include/pthreads""
  11:         PreprocessorDefinitions="__STD_C"
  12:         ForcedIncludeFiles="ICUVersion.h"
  13:         ProgramDataBaseFileName="$(OutDir)/$(TargetName).vc80.pdb"
  14:     />
  15:     <Tool
  16:         Name="VCLibrarianTool"
  17:         AdditionalDependencies="user32.lib"
  18:         OutputFile="$(OutDir)/$(ProjectName)$(WebKitConfigSuffix).lib"
  19:     />
  20: VisualStudioPropertySheet>

WTFCommon.vsprops這個文件定義了wtf這個工程依賴的頭文件目錄和庫等。

需要注意的是,FeatureDefinesCairo.vsprops,common.vsprops,release.vsprops,WinCairo.vsprops是大部分webkit工程都會繼承的,因此修改後會一些所有繼承這幾個文件的工程。例如如果你想將webkit編譯依賴的crt由Multi-threaded DLL(/MD)改爲Multi-threaded (/MT),只需要修改release.vsprops這個文件的RuntimeLibrary這個屬性即可。

WTF這個工程的編譯過程就和普遍的vc工程一樣了,這裏就不介紹了。

WTF這個工程的PreLink Event和PostBuild Event主要是調用WTFPreLink.cmd和WTFPostBuild.cmd,這兩個bat都比較簡單,就不介紹了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章