diff options
| author | yurybura <yurybura@gmail.com> | 2018-05-11 13:34:43 +0300 |
|---|---|---|
| committer | yurybura <yurybura@gmail.com> | 2018-05-11 13:34:43 +0300 |
| commit | 7d261fbbc39a1d36027299190920e0a7e222ebd7 (patch) | |
| tree | d9b6745f2e6c670836cbbf61dbd2c4eb9ef857fe /ports/aws-sdk-cpp/generateFeatures.ps1 | |
| parent | 50e5ee1e40380cf543ae804775462181984a86dc (diff) | |
| parent | 9535a5631ac212b1c657a02be3ed9398df30c96c (diff) | |
| download | vcpkg-7d261fbbc39a1d36027299190920e0a7e222ebd7.tar.gz vcpkg-7d261fbbc39a1d36027299190920e0a7e222ebd7.zip | |
Merge branch 'master' of https://github.com/yurybura/vcpkg
Diffstat (limited to 'ports/aws-sdk-cpp/generateFeatures.ps1')
| -rw-r--r-- | ports/aws-sdk-cpp/generateFeatures.ps1 | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/ports/aws-sdk-cpp/generateFeatures.ps1 b/ports/aws-sdk-cpp/generateFeatures.ps1 new file mode 100644 index 000000000..8c8b1a342 --- /dev/null +++ b/ports/aws-sdk-cpp/generateFeatures.ps1 @@ -0,0 +1,51 @@ +[CmdletBinding()]
+param(
+ [Parameter(Mandatory=$true)][string]$ExtractedSources,
+ [Parameter(Mandatory=$true)][string]$ControlFileIn,
+ [Parameter(Mandatory=$true)][string]$ControlFile,
+ [Parameter(Mandatory=$true)][string]$CMakeFragmentFile
+)
+
+$subfolders = Get-Item $ExtractedSources\aws-cpp-sdk-*
+
+$controltext = gc $ControlFileIn
+$controltext += @("# Automatically generated by generateFeatures.ps1")
+
+$cmakefragmenttext = @("# Automatically generated by generateFeatures.ps1")
+
+function GetDescription($dir, $modulename)
+{
+ if (Test-Path "$dir\CMakeLists.txt")
+ {
+ $descs = @(Select-String -Path "$dir\CMakeLists.txt" -Pattern "`"C\+\+ SDK for the AWS [^`"]*`"")
+ if ($descs.count -eq 1) {
+ $desc = $descs[0].Matches.Value -replace "`"",""
+ "Description: $desc"
+ }
+ else { "Description: C++ SDK for the AWS $modulename service" }
+ }
+ else { "Description: C++ SDK for the AWS $modulename service" }
+}
+
+$subfolders | % {
+ $modulename = $_.name -replace "^aws-cpp-sdk-",""
+ if ($modulename -match "-tests`$") { return }
+ if ($modulename -match "-sample`$") { return }
+ if ($modulename -eq "core") { return }
+
+ $controltext += @("")
+ $controltext += @("Feature: $modulename")
+ $controltext += @(GetDescription $_ $modulename)
+
+ $cmakefragmenttext += @(
+ "if(`"$modulename`" IN_LIST FEATURES)",
+ " list(APPEND BUILD_ONLY $modulename)",
+ "endif()"
+ )
+}
+
+Write-Verbose ($controltext -join "`n")
+[IO.File]::WriteAllText($ControlFile, ($controltext -join "`n")+"`n")
+
+Write-Verbose ($cmakefragmenttext -join "`n")
+[IO.File]::WriteAllText($CMakeFragmentFile, ($cmakefragmenttext -join "`n") +"`n")
|
