build-scripts/winrtbuild.ps1
author Ryan C. Gordon <icculus@icculus.org>
Thu, 09 Apr 2015 22:33:39 -0400
branchiOS-improvements
changeset 9542 618662dc9e82
parent 9217 e15f7d963d98
child 9735 35d8f8976d32
permissions -rw-r--r--
Closing the iOS-improvements branch.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9216
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
     1
#
9217
e15f7d963d98 WinRT: removed '-' from build script file names
David Ludwig <dludwig@pobox.com>
parents: 9216
diff changeset
     2
# winrtbuild.ps1 -- A Powershell script to build all SDL/WinRT variants,
9216
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
     3
#    across all WinRT platforms, in all of their supported, CPU architectures.
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
     4
#
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
     5
# Initial version written by David Ludwig <dludwig@pobox.com>
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
     6
#
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
     7
# This script can be launched from Windows Explorer by double-clicking
9217
e15f7d963d98 WinRT: removed '-' from build script file names
David Ludwig <dludwig@pobox.com>
parents: 9216
diff changeset
     8
# on winrtbuild.bat
9216
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
     9
#
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    10
# Output will be placed in the following subdirectories of the SDL source
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    11
# tree:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    12
#   * VisualC-WinRT\lib\  -- final .dll, .lib, and .pdb files
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    13
#   * VisualC-WinRT\obj\  -- intermediate build files
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    14
#
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    15
# Recommended Dependencies:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    16
#   * Windows 8.1 or higher
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    17
#   * Powershell 4.0 or higher (included as part of Windows 8.1)
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    18
#   * Visual C++ 2012, for building Windows 8.0 and Windows Phone 8.0 binaries.
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    19
#   * Visual C++ 2013, for building Windows 8.1 and Windows Phone 8.1 binaries
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    20
#   * SDKs for Windows 8.0, Windows 8.1, Windows Phone 8.0, and
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    21
#     Windows Phone 8.1, as needed
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    22
#
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    23
# Commom parameters/variables may include, but aren't strictly limited to:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    24
#   * PlatformToolset: the name of one of Visual Studio's build platforms.
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    25
#     Different PlatformToolsets output different binaries.  One
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    26
#     PlatformToolset exists for each WinRT platform.  Possible values
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    27
#     may include:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    28
#       - "v110": Visual Studio 2012 build tools, plus the Windows 8.0 SDK
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    29
#       - "v110_wp80": Visual Studio 2012 build tools, plus the Windows Phone 8.0 SDK
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    30
#       - "v120": Visual Studio 2013 build tools, plus the Windows 8.1 SDK
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    31
#       - "v120_wp81": Visual Studio 2013 build tools, plus the Windows Phone 8.1 SDK
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    32
#   * VSProjectPath: the full path to a Visual Studio or Visual C++ project file
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    33
#   * VSProjectName: the internal name of a Visual Studio or Visual C++ project
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    34
#     file.  Some of Visual Studio's own build tools use this name when
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    35
#     calculating paths for build-output.
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    36
#   * Platform: a Visual Studio platform name, which often maps to a CPU
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    37
#     CPU architecture.  Possible values may include: "Win32" (for 32-bit x86),
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    38
#     "ARM", or "x64" (for 64-bit x86).
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    39
#
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    40
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    41
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    42
# Gets the .bat file that sets up an MSBuild environment, given one of
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    43
# Visual Studio's, "PlatformToolset"s.
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    44
function Get-MSBuild-Env-Launcher
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    45
{
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    46
    param(
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    47
        [Parameter(Mandatory=$true,Position=1)][string]$PlatformToolset
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    48
    )
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    49
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    50
    if ($PlatformToolset -eq "v110") {      # Windows 8.0 (not Windows Phone), via VS 2012
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    51
        return "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    52
    }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    53
    if ($PlatformToolset -eq "v110_wp80") { # Windows Phone 8.0, via VS 2012
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    54
        return "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\WPSDK\WP80\vcvarsphoneall.bat"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    55
    }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    56
    if ($PlatformToolset -eq "v120") {      # Windows 8.1 (not Windows Phone), via VS 2013
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    57
        return "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    58
    }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    59
    if ($PlatformToolset -eq "v120_wp81") { # Windows Phone 8.1, via VS 2013
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    60
        return "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    61
    }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    62
    return ""
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    63
}
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    64
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    65
# Gets a string that identifies the build-variant of SDL/WinRT that is specific
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    66
# to a particular Visual Studio PlatformToolset.
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    67
function Get-SDL-WinRT-Variant-Name
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    68
{
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    69
    param(
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    70
        [Parameter(Mandatory=$true,Position=1)][string]$PlatformToolset,
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    71
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    72
        # If true, append a string to this function's output, identifying the
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    73
        # build-variant's minimum-supported version of Visual Studio.
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    74
        [switch]$IncludeVSSuffix = $false
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    75
    )
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    76
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    77
    if ($PlatformToolset -eq "v110") {      # Windows 8.0 (not Windows Phone), via VS 2012 project files
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    78
        if ($IncludeVSSuffix) {
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    79
            return "WinRT80_VS2012"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    80
        } else {
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    81
            return "WinRT80"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    82
        }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    83
    }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    84
    if ($PlatformToolset -eq "v110_wp80") { # Windows Phone 8.0, via VS 2012 project files
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    85
        if ($IncludeVSSuffix) {
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    86
            return "WinPhone80_VS2012"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    87
        } else {
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    88
            return "WinPhone80"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    89
        }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    90
    }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    91
    if ($PlatformToolset -eq "v120") {      # Windows 8.1 (not Windows Phone), via VS 2013 project files
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    92
        if ($IncludeVSSuffix) {
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    93
            return "WinRT81_VS2013"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    94
        } else {
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    95
            return "WinRT81"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    96
        }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    97
    }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    98
    if ($PlatformToolset -eq "v120_wp81") { # Windows Phone 8.1, via VS 2013 project files
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
    99
        if ($IncludeVSSuffix) {
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   100
            return "WinPhone81_VS2013"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   101
        } else {
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   102
            return "WinPhone81"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   103
        }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   104
    }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   105
    return ""
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   106
}
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   107
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   108
# Returns the internal name of a Visual Studio Project.
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   109
#
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   110
# The internal name of a VS Project is encoded inside the project file
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   111
# itself, inside a set of <ProjectName></ProjectName> XML tags.
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   112
function Get-VS-ProjectName
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   113
{
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   114
    param(
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   115
        [Parameter(Mandatory=$true,Position=1)]$VSProjectPath
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   116
    )
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   117
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   118
    # For now, just do a regex for the project name:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   119
    $matches = (Get-Content $VSProjectPath | Select-String -Pattern ".*<ProjectName>([^<]+)<.*").Matches
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   120
    foreach ($match in $matches) {
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   121
        if ($match.Groups.Count -ge 1) {
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   122
            return $match.Groups[1].Value
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   123
        }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   124
    }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   125
    return $null
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   126
}
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   127
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   128
# Build a specific variant of SDL/WinRT
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   129
function Build-SDL-WinRT-Variant
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   130
{
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   131
    #
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   132
    # Read in arguments:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   133
    #
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   134
    param (
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   135
        # name of an SDL project file, minus extensions and
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   136
        # platform-identifying suffixes
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   137
        [Parameter(Mandatory=$true,Position=1)][string]$SDLProjectName,
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   138
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   139
        [Parameter(Mandatory=$true,Position=2)][string]$PlatformToolset,
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   140
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   141
        [Parameter(Mandatory=$true,Position=3)][string]$Platform
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   142
    )
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   143
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   144
    #
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   145
    # Derive other properties from read-in arguments:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   146
    #
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   147
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   148
    # The .bat file to setup a platform-appropriate MSBuild environment:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   149
    $BatchFileForMSBuildEnv = Get-MSBuild-Env-Launcher $PlatformToolset
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   150
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   151
    # The full path to the VS Project that'll be built:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   152
    $VSProjectPath = "$PSScriptRoot\..\VisualC-WinRT\$(Get-SDL-WinRT-Variant-Name $PlatformToolset -IncludeVSSuffix)\$SDLProjectName-$(Get-SDL-WinRT-Variant-Name $PlatformToolset).vcxproj"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   153
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   154
    # The internal name of the VS Project, used in some post-build steps:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   155
    $VSProjectName = Get-VS-ProjectName $VSProjectPath
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   156
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   157
    # Where to place output binaries (.dll, .lib, and .pdb files):
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   158
    $OutDir = "$PSScriptRoot\..\VisualC-WinRT\lib\$PlatformToolset\$Platform"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   159
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   160
    # Where to place intermediate build files:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   161
    $IntermediateDir = "$PSScriptRoot\..\VisualC-WinRT\obj\$SDLProjectName-$(Get-SDL-WinRT-Variant-Name $PlatformToolset)\$Platform"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   162
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   163
    #
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   164
    # Build the VS Project:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   165
    #
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   166
    cmd.exe /c " ""$BatchFileForMSBuildEnv"" x86 & msbuild ""$VSProjectPath"" /p:Platform=$Platform /p:OutDir=""$OutDir\\"" /p:IntDir=""$IntermediateDir\\""" | Out-Host
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   167
    $BuildResult = $?
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   168
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   169
    #
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   170
    # Move .dll files into place.  This fixes a problem whereby MSBuild may
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   171
    # put output files into a sub-directory of $OutDir, rather than $OutDir
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   172
    # itself.
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   173
    #
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   174
    if (Test-Path "$OutDir\$VSProjectName\") {
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   175
        Move-Item -Force "$OutDir\$VSProjectName\*" "$OutDir"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   176
    }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   177
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   178
    #
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   179
    # Clean up unneeded files in $OutDir:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   180
    #
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   181
    if (Test-Path "$OutDir\$VSProjectName\") {
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   182
        Remove-Item -Recurse "$OutDir\$VSProjectName"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   183
    }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   184
    Remove-Item "$OutDir\*.exp"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   185
    Remove-Item "$OutDir\*.ilk"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   186
    Remove-Item "$OutDir\*.pri"
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   187
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   188
    #
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   189
    # All done.  Indicate success, or failure, to the caller:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   190
    #
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   191
    #echo "RESULT: $BuildResult" | Out-Host
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   192
    return $BuildResult
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   193
}
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   194
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   195
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   196
#
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   197
# Build each variant, with corresponding .dll, .lib, and .pdb files:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   198
#
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   199
$DidAnyFail = $false
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   200
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   201
# Build for Windows Phone 8.0, via VC++ 2012:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   202
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "ARM"))   { $DidAnyFail = $true }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   203
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "Win32")) { $DidAnyFail = $true }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   204
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   205
# Build for Windows Phone 8.1, via VC++ 2013:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   206
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "ARM"))   { $DidAnyFail = $true }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   207
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "Win32")) { $DidAnyFail = $true }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   208
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   209
# Build for Windows 8.0 and Windows RT 8.0, via VC++ 2012:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   210
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "ARM"))        { $DidAnyFail = $true }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   211
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "Win32"))      { $DidAnyFail = $true }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   212
if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "x64"))        { $DidAnyFail = $true }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   213
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   214
# Build for Windows 8.1 and Windows RT 8.1, via VC++ 2013:
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   215
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "ARM"))        { $DidAnyFail = $true }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   216
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "Win32"))      { $DidAnyFail = $true }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   217
if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "x64"))        { $DidAnyFail = $true }
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   218
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   219
# Let the script's caller know whether or not any errors occurred.
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   220
# Exit codes compatible with Buildbot are used (1 for error, 0 for success).
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   221
if ($DidAnyFail -eq $true) {
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   222
    exit 1
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   223
} else {
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   224
    exit 0
61cf772a4ed3 WinRT: added scripts to build Release copies of SDL for all WinRT variants
David Ludwig <dludwig@pobox.com>
parents:
diff changeset
   225
}