| 1 |
(: |
| 2 |
* IMPORTANT: this file is shared (identical) between the BDB XML and XQilla |
| 3 |
* projects. It should not be changed independently or in any way that makes |
| 4 |
* it project-dependent. |
| 5 |
* |
| 6 |
* @PROJECT_NAME@ - name of the Visual Studio project |
| 7 |
* @PROJECT_INPUT@ - input XML document that drives the script. |
| 8 |
* TBD: |
| 9 |
* 1. Could drive the remaining variables, including Visual Studio |
| 10 |
* variables, off of the xml file and provide the XML input |
| 11 |
* file as an external variable to the query. E.g. some projects |
| 12 |
* may want to parameterize the optimization and warnings levels |
| 13 |
* 2. Generate AdditionalIncludeDirectories based on the <depends> elements for |
| 14 |
* projects rather than just including "all" |
| 15 |
:) |
| 16 |
declare variable $projectList := "@PROJECT_INPUT@"; |
| 17 |
declare variable $vsversion := "@VISUAL_STUDIO_VERSION@"; |
| 18 |
declare variable $sourcePath := doc($projectList)/projects/variable[@name="sourcePath"]; |
| 19 |
declare variable $outputBase := doc($projectList)/projects/variable[@name="outputBase.@VISUAL_STUDIO_VERSION@"]; |
| 20 |
declare variable $mobile := xs:boolean(doc($projectList)/projects/variable[@name="mobile"]); |
| 21 |
|
| 22 |
(: Visual Studio Variables --relatively static :) |
| 23 |
declare variable $debugOptLevel := "0"; (: VS -- no optimization :) |
| 24 |
declare variable $releaseOptLevel := "2"; (: VS -- level 2 opt :) |
| 25 |
declare variable $warnLevel := "3"; (: VS warning level :) |
| 26 |
declare variable $appType := "1"; (: VS type 1 is a program :) |
| 27 |
declare variable $dllType := "2"; (: VS type 2 is a DLL :) |
| 28 |
declare variable $staticType := "4"; (: VS type 4 is a static lib :) |
| 29 |
declare variable $debugInfo := "3"; (: VS debug information format :) |
| 30 |
declare variable $libExtension := ".lib"; |
| 31 |
|
| 32 |
(: formatting :) |
| 33 |
declare function local:indent($n) |
| 34 |
{ |
| 35 |
concat("
",string-join(for $i in (1 to $n) return " ", "")) |
| 36 |
}; |
| 37 |
|
| 38 |
(: is it a DLL, Application, or static library? :) |
| 39 |
declare function local:configurationType($projectType, $config) |
| 40 |
{ |
| 41 |
if ($projectType eq "library") then |
| 42 |
if (contains($config,"Static")) then $staticType else $dllType |
| 43 |
else $appType |
| 44 |
}; |
| 45 |
|
| 46 |
(: "normalize" Windows file paths :) |
| 47 |
declare function local:windowsPath($path) as xs:string |
| 48 |
{ |
| 49 |
translate($path,"/","\\") |
| 50 |
}; |
| 51 |
|
| 52 |
(: debug vs release :) |
| 53 |
declare function local:isDebug($config) as xs:boolean |
| 54 |
{ |
| 55 |
contains($config,"Debug") |
| 56 |
}; |
| 57 |
|
| 58 |
declare function local:isRelease($config) as xs:boolean |
| 59 |
{ |
| 60 |
contains($config,"Release") |
| 61 |
}; |
| 62 |
|
| 63 |
declare function local:characterSet() |
| 64 |
{ |
| 65 |
if ($mobile) then "1" else "2" |
| 66 |
}; |
| 67 |
|
| 68 |
(: machine-target-dependent link options :) |
| 69 |
declare function local:addLinkOptions($project, $platform, $config) |
| 70 |
{ |
| 71 |
let $machine := |
| 72 |
if ($mobile) then "" |
| 73 |
else if (contains($platform,"Win32")) then "/machine:x86" |
| 74 |
else concat("/machine:",$platform) |
| 75 |
let $opt := string-join(($machine,$project/options/link[contains(@config,$config)])," ") |
| 76 |
return if (not($opt eq "")) then attribute{"AdditionalOptions"}{$opt} |
| 77 |
else () |
| 78 |
}; |
| 79 |
|
| 80 |
declare function local:addDebugInformation($config) |
| 81 |
{ |
| 82 |
attribute{"DebugInformationFormat"}{$debugInfo}, |
| 83 |
if (local:isDebug($config)) then attribute{"BasicRuntimeChecks"}{"3"} else () |
| 84 |
}; |
| 85 |
|
| 86 |
declare function local:getProjectType($project, $config) |
| 87 |
{ |
| 88 |
if ($project/type eq "library") then if (contains($config,"Static")) then "static_lib" |
| 89 |
else "dll" |
| 90 |
else if ($project/type eq "app") then if (contains($config,"Static")) then "static_app" |
| 91 |
else "app" |
| 92 |
else error(QName("","dbxml"),"getProjectType:unkown project type") |
| 93 |
}; |
| 94 |
|
| 95 |
declare function local:generateCompilerPreprocessorDefs($project, $config) |
| 96 |
{ |
| 97 |
let $ptype := local:getProjectType($project,$config) |
| 98 |
let $generic := doc($projectList)/projects/preprocessor[@config="all" or @config=$config] |
| 99 |
let $proj := $project/preprocessor[@config="all" or @config=$config or @config=$ptype] |
| 100 |
let $type := doc($projectList)/projects/preprocessor[@config=$ptype] |
| 101 |
return string-join(($generic,$proj,$type),";") |
| 102 |
}; |
| 103 |
|
| 104 |
declare function local:generateResourcePreprocessorDefs($config) |
| 105 |
{ |
| 106 |
if (not(empty(doc($projectList)/projects/preprocessor[@config="rc_all"]))) then |
| 107 |
attribute{"PreprocessorDefinitions"}{doc($projectList)/projects/preprocessor[@config="rc_all"]} |
| 108 |
else () |
| 109 |
}; |
| 110 |
|
| 111 |
(: Optimization level :) |
| 112 |
declare function local:optLevel($config) |
| 113 |
{ |
| 114 |
if (local:isDebug($config)) then $debugOptLevel |
| 115 |
else $releaseOptLevel |
| 116 |
}; |
| 117 |
|
| 118 |
(: MDd is 3, MD is 2, MTd is 1, MT is 0 :) |
| 119 |
declare function local:runtimeLibrary($config,$static as xs:boolean) |
| 120 |
{ |
| 121 |
if (local:isDebug($config)) then |
| 122 |
if ($static or $mobile) then "1" else "3" |
| 123 |
else |
| 124 |
if ($static or $mobile) then "0" else "2" |
| 125 |
}; |
| 126 |
|
| 127 |
declare function local:getLibName($name, $config) |
| 128 |
{ |
| 129 |
doc($projectList)/projects/library[@name=$name]/libname[@config=$config] |
| 130 |
}; |
| 131 |
|
| 132 |
declare function local:makeStaticOutputFile($project, $config) |
| 133 |
{ |
| 134 |
attribute{"OutputFile"} |
| 135 |
{concat("$(OutDir)/", local:getLibName($project/@name, $config),".lib") |
| 136 |
} |
| 137 |
}; |
| 138 |
|
| 139 |
declare function local:makeImportLibrary($project, $config) |
| 140 |
{ |
| 141 |
if ($project/type eq "library") then |
| 142 |
attribute{"ImportLibrary"}{concat("$(OutDir)/", local:getLibName($project/@name, $config),".lib")} |
| 143 |
else () |
| 144 |
}; |
| 145 |
|
| 146 |
declare function local:makeModuleDefinition($project, $config) |
| 147 |
{ |
| 148 |
if (not(empty($project/moddef))) then |
| 149 |
attribute{"ModuleDefinitionFile"}{local:windowsPath(concat($sourcePath,$project/moddef/@file))} |
| 150 |
else () |
| 151 |
}; |
| 152 |
|
| 153 |
declare function local:makeOutputPDBFile($project, $config) |
| 154 |
{ |
| 155 |
attribute{"ProgramDatabaseFile"} |
| 156 |
{ |
| 157 |
if ($project/type eq "library") then |
| 158 |
concat("$(OutDir)/", local:getLibName($project/@name, $config),".pdb") |
| 159 |
else |
| 160 |
concat("$(OutDir)/",if (not(empty($project/@output))) then $project/@output else $project/@name,".pdb") |
| 161 |
} |
| 162 |
}; |
| 163 |
|
| 164 |
declare function local:makeOutputFile($project, $config) |
| 165 |
{ |
| 166 |
attribute{"OutputFile"} |
| 167 |
{ |
| 168 |
if ($project/type eq "library") then |
| 169 |
concat("$(OutDir)/", local:getLibName($project/@name, $config), ".dll") |
| 170 |
else |
| 171 |
concat("$(OutDir)/",if (not(empty($project/@output))) then $project/@output else $project/@name,".exe") |
| 172 |
} |
| 173 |
}; |
| 174 |
|
| 175 |
declare function local:makeOutputObjectFile($project, $config) |
| 176 |
{ |
| 177 |
attribute{"ObjectFile"} |
| 178 |
{ |
| 179 |
concat("$(OutDir)/",if (not(empty($project/@output))) then $project/@output else $project/@name,"/") |
| 180 |
} |
| 181 |
}; |
| 182 |
|
| 183 |
(: The simple thing is to add all libraries for all projects :) |
| 184 |
declare function local:addLibraryDependencies($project,$config) |
| 185 |
{ |
| 186 |
attribute{"AdditionalDependencies"}{string-join(for $dep in $project/depends |
| 187 |
return concat(local:getLibName($dep, $config),".lib")," ")} |
| 188 |
}; |
| 189 |
|
| 190 |
declare function local:makeLibraryDirectory($lib,$platform,$config) |
| 191 |
{ |
| 192 |
for $dir in $lib/platform[contains(@name,$platform)]/config[$config=./@type]/libdir |
| 193 |
return |
| 194 |
if (not(empty($lib/libbase[@vsver=$vsversion]))) then |
| 195 |
concat($lib/libbase[@vsver=$vsversion],"/", $dir) |
| 196 |
else $dir |
| 197 |
}; |
| 198 |
|
| 199 |
(: The simple thing is to add all libraries for all projects :) |
| 200 |
(: Add an unconditional "../../lib" to the end :) |
| 201 |
declare function local:addLibraryDirectories($project,$platform,$config) |
| 202 |
{ |
| 203 |
attribute{"AdditionalLibraryDirectories"}{string-join((for $dep in $project/depends |
| 204 |
return local:makeLibraryDirectory(doc($projectList)/projects/library[@name=$dep],$platform,$config),"../../lib"),";")} |
| 205 |
}; |
| 206 |
|
| 207 |
(: The simple thing is to add all libraries for all projects :) |
| 208 |
declare function local:addIncludeDirectories($project,$config) |
| 209 |
{ |
| 210 |
let $incref := for $inc in $project/include[@type="ref"] return doc($projectList)/projects/include[@name=$inc] |
| 211 |
let $increl := $project/include[@type="rel"] |
| 212 |
return |
| 213 |
attribute{"AdditionalIncludeDirectories"}{string-join(($incref,$increl),",")} |
| 214 |
}; |
| 215 |
|
| 216 |
(: look for project-specific tool, then a type-specific event :) |
| 217 |
declare function local:generatePostBuildEvent($project, $config) |
| 218 |
{ |
| 219 |
local:indent(6),<Tool> |
| 220 |
{attribute{"Name"}{"VCPostBuildEventTool"}} |
| 221 |
{if (not(empty($project/event[@name="postbuild"]))) then |
| 222 |
(attribute{"CommandLine"}{$project/event[@name="postbuild"]/command[@config=$config]}, |
| 223 |
attribute{"Description"}{$project/event[@name="postbuild"]/description}) |
| 224 |
else let $ev := doc($projectList)/projects/event[@name="postbuild" and @type=$project/type] |
| 225 |
return if (not(empty($ev))) then |
| 226 |
(attribute{"CommandLine"}{replace($ev/command[@config=$config],"@pname@",if (not(empty($project/@output))) then $project/@output else $project/@name)}, |
| 227 |
attribute{"Description"}{$ev/description}) |
| 228 |
else () |
| 229 |
} |
| 230 |
</Tool> |
| 231 |
}; |
| 232 |
|
| 233 |
(: look for project-specific tool, then a type-specific event :) |
| 234 |
declare function local:generatePreBuildEvent($project, $config) |
| 235 |
{ |
| 236 |
local:indent(6),<Tool> |
| 237 |
{attribute{"Name"}{"VCPreBuildEventTool"}} |
| 238 |
{if (not(empty($project/event[@name="prebuild"]))) then |
| 239 |
(attribute{"CommandLine"}{$project/event[@name="prebuild"]/command[contains(@config,$config)]}, |
| 240 |
attribute{"Description"}{$project/event[@name="prebuild"]/description}) |
| 241 |
else let $ev := doc($projectList)/projects/event[@name="prebuild" and @type=$project/type] |
| 242 |
return if (not(empty($ev))) then |
| 243 |
(attribute{"CommandLine"}{replace($ev/command[contains(@config,$config)],"@pname@",if (not(empty($project/@output))) then $project/@output else $project/@name)}, |
| 244 |
attribute{"Description"}{$ev/description}) |
| 245 |
else () |
| 246 |
} |
| 247 |
</Tool> |
| 248 |
}; |
| 249 |
|
| 250 |
declare function local:generateCustomBuildTool($project, $config) |
| 251 |
{ |
| 252 |
local:indent(6),<Tool> |
| 253 |
{attribute{"Name"}{"VCCustomBuildTool"}} |
| 254 |
{if (not(empty($project/event[@name="custom"]))) then |
| 255 |
(attribute{"CommandLine"}{$project/event[@name="custom"]/command[contains(@config,$config)]}, |
| 256 |
attribute{"Outputs"}{$project/event[@name="custom"]/output}) |
| 257 |
else ()} |
| 258 |
</Tool> |
| 259 |
}; |
| 260 |
|
| 261 |
declare function local:generateDeploymentTool($project) |
| 262 |
{ |
| 263 |
local:indent(6),<DeploymentTool> |
| 264 |
{ if ($project/type eq "dll") then |
| 265 |
(attribute{"RemoteDirectory"}{"\windows"}) |
| 266 |
else ()} |
| 267 |
</DeploymentTool> |
| 268 |
}; |
| 269 |
|
| 270 |
(: |
| 271 |
static build of libraries; at this time it does *not* add additional |
| 272 |
dependent libraries. This means that applications need to include them |
| 273 |
for the time being. |
| 274 |
:) |
| 275 |
declare function local:generateConfigLibrarian($project, $platform, $config) |
| 276 |
{ |
| 277 |
local:indent(6),<Tool> |
| 278 |
{attribute{"Name"}{"VCLibrarianTool"}} |
| 279 |
{local:makeStaticOutputFile($project,$config)} |
| 280 |
{local:addLinkOptions($project, $platform, $config)} |
| 281 |
</Tool> |
| 282 |
}; |
| 283 |
|
| 284 |
declare function local:generateConfigLinkerAndMidl($project, $platform, $config) |
| 285 |
{ |
| 286 |
local:indent(6),<Tool> |
| 287 |
{attribute{"Name"}{"VCLinkerTool"}} |
| 288 |
{local:addLinkOptions($project, $platform, $config)} |
| 289 |
{local:addLibraryDependencies($project,$config)} |
| 290 |
{local:addLibraryDirectories($project,$platform,$config)} |
| 291 |
{local:makeOutputFile($project, $config)} |
| 292 |
{local:makeOutputPDBFile($project, $config)} |
| 293 |
{attribute{"LinkIncremental"}{"1"}} |
| 294 |
{attribute{"GenerateDebugInformation"}{"TRUE"}} |
| 295 |
{attribute{"SuppressStartupBanner"}{"TRUE"}} |
| 296 |
{attribute{"OptimizeReferences"}{"2"}} |
| 297 |
{local:makeImportLibrary($project,$config)} |
| 298 |
{local:makeModuleDefinition($project,$config)} |
| 299 |
{attribute{"TargetMachine"}{if (contains($platform, "(ARMV4)")) then "3" else "0"}} |
| 300 |
{if ($project/type eq "app" and $mobile) then |
| 301 |
(attribute{"SubSystem"}{"9"},attribute{"EntryPointSymbol"}{"WinMainCRTStartup"}) |
| 302 |
else ()} |
| 303 |
</Tool> |
| 304 |
}; |
| 305 |
|
| 306 |
declare function local:generateConfigCompiler($project, $platform, $config, $static as xs:boolean) |
| 307 |
{ |
| 308 |
local:indent(6),<Tool> |
| 309 |
{attribute{"Name"}{"VCCLCompilerTool"}} |
| 310 |
{if ($mobile) then attribute{"BufferSecurityCheck"}{"FALSE"} else ()} |
| 311 |
{attribute{"Optimization"}{local:optLevel($config)}} |
| 312 |
{attribute{"MinimalRebuild"}{"TRUE"}} |
| 313 |
{if (local:isRelease($config)) then attribute{"InlineFunctionExpansion"}{"1"} else ()} |
| 314 |
{if (contains($project/options/compile/@platform, $platform)) then attribute{"AdditionalOptions"}{$project/options/compile/text()} else ()} |
| 315 |
{local:addIncludeDirectories($project,$config)} |
| 316 |
{attribute{"PreprocessorDefinitions"}{local:generateCompilerPreprocessorDefs($project, $config)}} |
| 317 |
{attribute{"StringPooling"}{"TRUE"}} |
| 318 |
{if (not(empty($project/options/rtti))) then attribute{"RuntimeTypeInfo"}{"TRUE"} else ()} |
| 319 |
{attribute{"RuntimeLibrary"}{local:runtimeLibrary($config,$static)}} |
| 320 |
{if (local:isRelease($config)) then attribute{"EnableFunctionLevelLinking"}{"TRUE"} else ()} |
| 321 |
{attribute{"UsePrecompiledHeader"}{"0"}} |
| 322 |
{if ($project/@name eq "dbxml") then attribute{"PrecompiledHeaderThrough"}{"DbXmlInternal.hpp"} else ()} |
| 323 |
{attribute{"PrecompiledHeaderFile"}{concat("./$(OutDir)/",$project/@name,".pch")}} |
| 324 |
{attribute{"AssemblerListingLocation"}{local:makeOutputObjectFile($project, $config)}} |
| 325 |
{attribute{"ObjectFile"}{local:makeOutputObjectFile($project, $config)}} |
| 326 |
{attribute{"WarningLevel"}{$warnLevel}} |
| 327 |
{if (not($vsversion eq "8.00") and not($project/options/nowp64)) then attribute{"Detect64BitPortabilityProblems"}{"TRUE"} else ()} |
| 328 |
{attribute{"SuppressStartupBanner"}{"TRUE"}} |
| 329 |
{local:addDebugInformation($config)} |
| 330 |
{attribute{"CompileAs"}{"0"}} |
| 331 |
</Tool> |
| 332 |
}; |
| 333 |
|
| 334 |
declare function local:generateConfigBoilerplate($config) |
| 335 |
{ |
| 336 |
local:indent(6),<Tool Name="VCPreLinkEventTool"/>, |
| 337 |
local:indent(6),<Tool> |
| 338 |
{attribute{"Name"}{"VCResourceCompilerTool"}} |
| 339 |
{local:generateResourcePreprocessorDefs($config)} |
| 340 |
</Tool>, |
| 341 |
local:indent(6),<Tool Name="VCXMLDataGeneratorTool"/>, |
| 342 |
local:indent(6),<Tool Name="VCManagedWrapperGeneratorTool"/>, |
| 343 |
local:indent(6),<Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> |
| 344 |
}; |
| 345 |
|
| 346 |
(: use "platform/configuration" :) |
| 347 |
declare function local:generateOutputDirectory($platform,$config,$static) |
| 348 |
{ |
| 349 |
attribute{"OutputDirectory"}{local:windowsPath(concat($outputBase,"$(PlatformName)","/",string-join(tokenize($config," "),"_"),$static))} |
| 350 |
}; |
| 351 |
|
| 352 |
declare function local:generateConfig($project, $platform, $config) |
| 353 |
{ |
| 354 |
local:indent(4),<Configuration> |
| 355 |
{attribute{"Name"}{concat($config,"|",$platform)}} |
| 356 |
{local:generateOutputDirectory($platform,$config,"")} |
| 357 |
{attribute{"IntermediateDirectory"}{concat("./$(OutDir)/",$project/@name)}} |
| 358 |
{attribute{"ConfigurationType"}{local:configurationType($project/type,$config)}} |
| 359 |
{attribute{"UseOfMFC"}{"0"}} |
| 360 |
{attribute{"ATLMinimizesCRunTimeLibraryUsage"}{"FALSE"}} |
| 361 |
{attribute{"CharacterSet"}{local:characterSet()}} |
| 362 |
{local:generateConfigBoilerplate($config)} |
| 363 |
{local:generateConfigCompiler($project, $platform, $config,xs:boolean("false"))} |
| 364 |
{local:generateConfigLinkerAndMidl($project, $platform, $config)} |
| 365 |
{local:generatePreBuildEvent($project,if (local:isDebug($config)) then "Debug" else "Release")} |
| 366 |
{local:generatePostBuildEvent($project,if (local:isDebug($config)) then "Debug" else "Release")} |
| 367 |
{local:generateCustomBuildTool($project,if (local:isDebug($config)) then "Debug" else "Release")} |
| 368 |
{if ($mobile) then local:generateDeploymentTool($project) else()} |
| 369 |
</Configuration> |
| 370 |
}; |
| 371 |
|
| 372 |
declare function local:generateStaticConfig($project, $platform, $config) |
| 373 |
{ |
| 374 |
local:indent(4),<Configuration> |
| 375 |
{attribute{"Name"}{concat($config,"|",$platform)}} |
| 376 |
{local:generateOutputDirectory($platform,$config,"")} |
| 377 |
{attribute{"IntermediateDirectory"}{concat("./$(OutDir)/",$project/@name)}} |
| 378 |
{attribute{"ConfigurationType"}{local:configurationType($project/type,$config)}} |
| 379 |
{attribute{"UseOfMFC"}{"0"}} |
| 380 |
{attribute{"ATLMinimizesCRunTimeLibraryUsage"}{"FALSE"}} |
| 381 |
{attribute{"CharacterSet"}{local:characterSet()}} |
| 382 |
{local:generateConfigBoilerplate($config)} |
| 383 |
{local:generateConfigCompiler($project, $platform, $config,xs:boolean("true"))} |
| 384 |
{if (contains($project/type,"lib")) then |
| 385 |
local:generateConfigLibrarian($project, $platform, $config) |
| 386 |
else |
| 387 |
local:generateConfigLinkerAndMidl($project, $platform, $config) |
| 388 |
} |
| 389 |
</Configuration> |
| 390 |
}; |
| 391 |
|
| 392 |
declare function local:generateRcFile($file) |
| 393 |
{ |
| 394 |
local:indent(4),<File RelativePath="{local:windowsPath(concat($sourcePath,$file/@name))}"> |
| 395 |
{ for $platform in local:getPlatforms($vsversion) return |
| 396 |
for $config in ("Debug","Release") return |
| 397 |
(local:indent(6),<FileConfiguration Name="{concat($config,"|",$platform)}"> |
| 398 |
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="{concat(if ($config="Debug") then "_DEBUG" else "NDEBUG",";","$(NoInherit))")}"/> |
| 399 |
{local:indent(6)}</FileConfiguration>) |
| 400 |
} |
| 401 |
{local:indent(4)}</File> |
| 402 |
}; |
| 403 |
|
| 404 |
declare function local:generateFilesNoFilter($project) |
| 405 |
{ |
| 406 |
for $file in $project/files/file |
| 407 |
return if (ends-with($file/@name,".rc") and not($mobile)) then local:generateRcFile($file) |
| 408 |
else (local:indent(4),<File RelativePath="{local:windowsPath(concat($sourcePath,$file/@name))}"/>) |
| 409 |
}; |
| 410 |
|
| 411 |
declare function local:generateFilesWithFilter($project,$filter) |
| 412 |
{ |
| 413 |
for $file in $project/files/filter[@name=$filter]/file |
| 414 |
return if (ends-with($file/@name,".rc") and not($mobile)) then local:generateRcFile($file) |
| 415 |
else (local:indent(6),<File RelativePath="{local:windowsPath(concat($sourcePath,$file/@name))}"/>) |
| 416 |
}; |
| 417 |
|
| 418 |
declare function local:generateFiles($project) |
| 419 |
{ |
| 420 |
let $filters := $project/files/filter/@name |
| 421 |
return if (empty($filters)) then |
| 422 |
local:generateFilesNoFilter($project) |
| 423 |
else |
| 424 |
for $filter in $filters |
| 425 |
return (local:indent(4),<Filter Name="{$filter}" Filter=""> |
| 426 |
{local:generateFilesWithFilter($project,$filter)} |
| 427 |
{local:indent(4)}</Filter>) |
| 428 |
}; |
| 429 |
|
| 430 |
declare function local:generatePlatforms() |
| 431 |
{ |
| 432 |
if (not($mobile)) then |
| 433 |
(local:indent(4),<Platform Name="Win32"/>, |
| 434 |
local:indent(4),<Platform Name="x64"/>) |
| 435 |
else |
| 436 |
(local:indent(4),<Platform Name="Pocket PC 2003 (ARMV4)"/>, |
| 437 |
local:indent(4),<Platform Name="Smartphone 2003 (ARMV4)"/>, |
| 438 |
local:indent(4),<Platform Name="Windows Mobile 6.5.3 Professional DTK (ARMV4I)"/>) |
| 439 |
}; |
| 440 |
|
| 441 |
declare function local:getGuid($project) |
| 442 |
{ |
| 443 |
concat("{",$project/@guid,"}") |
| 444 |
}; |
| 445 |
|
| 446 |
declare function local:getPlatforms($version) |
| 447 |
{ |
| 448 |
if (not($mobile)) then |
| 449 |
(if ($version eq "7.10") then ("Win32") |
| 450 |
else ("Win32", "x64")) |
| 451 |
else |
| 452 |
("Pocket PC 2003 (ARMV4)", "Smartphone 2003 (ARMV4)", |
| 453 |
"Windows Mobile 6.5.3 Professional DTK (ARMV4I)") |
| 454 |
}; |
| 455 |
|
| 456 |
declare function local:getProjects() |
| 457 |
{ |
| 458 |
(: doc($projectList)/projects/project :) |
| 459 |
doc($projectList)/projects/project[@name="@PROJECT_NAME@"] |
| 460 |
}; |
| 461 |
|
| 462 |
for $project in local:getProjects() return |
| 463 |
<VisualStudioProject |
| 464 |
ProjectType="Visual C++" |
| 465 |
Version="{$vsversion}" |
| 466 |
Name="{string($project/@name)}" |
| 467 |
ProjectGUID="{local:getGuid($project)}"> |
| 468 |
{local:indent(2)}<Platforms> |
| 469 |
{local:generatePlatforms()} |
| 470 |
{local:indent(2)}</Platforms> |
| 471 |
{local:indent(2)}<Configurations> |
| 472 |
{ |
| 473 |
for $platform in local:getPlatforms($vsversion) return |
| 474 |
for $configuration in $project/configuration |
| 475 |
let $static := contains($configuration/text(),"Static") return |
| 476 |
for $config in ("Debug","Release") return if ($static) then let $config := concat("Static ",$config) return local:generateStaticConfig($project, $platform, $config) else local:generateConfig($project, $platform, $config) |
| 477 |
} |
| 478 |
{local:indent(2)}</Configurations> |
| 479 |
{local:indent(2)}<References/> |
| 480 |
{local:indent(2)}<Files> |
| 481 |
{local:generateFiles($project)} |
| 482 |
{local:indent(2)}</Files> |
| 483 |
{local:indent(2)}<Globals/> |
| 484 |
{"
"}</VisualStudioProject> |