create_data_obj.ps1 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # -------------------------------------------------------------------------------------------------------
  2. # Copyright (C) Microsoft. All rights reserved.
  3. # Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. # -------------------------------------------------------------------------------------------------------
  5. # This file is called as a CustomBuild step from Chakra.ICU.Data.vcxproj.
  6. #
  7. # To generate the data file, we need to build GenCCode.exe for the host platform. We can then run
  8. # GenCCode.exe --object to produce a platform-agnostic object file, which the linking step of
  9. # Chakra.ICU.Data should be able to link into a DLL for the target platform.
  10. param(
  11. [parameter(Mandatory=$true)]
  12. [alias("d")]
  13. [string]$DataFile,
  14. [parameter(Mandatory=$true)]
  15. [alias("p")]
  16. [string]$TargetPlatform,
  17. [parameter(Mandatory=$true)]
  18. [alias("c")]
  19. [string]$TargetConfiguration,
  20. [parameter(Mandatory=$true)]
  21. [alias("m")]
  22. [string]$MSBuildPath,
  23. [parameter(Mandatory=$true)]
  24. [alias("i")]
  25. [string]$IntDir,
  26. [parameter(Mandatory=$true)]
  27. [alias("v")]
  28. [string]$IcuVersionMajor
  29. )
  30. $scriptRoot=Split-Path -Path $MyInvocation.MyCommand.Path
  31. # This gets the actual platform of the host, as opposed to the %PROCESSOR_ARCHITECTURE% environment variable which
  32. # changes depending on if 32 and 64 bit binaries are calling each other
  33. $hostPlatform=(Get-ItemProperty "HKLM:\System\CurrentControlSet\Control\Session Manager\Environment").PROCESSOR_ARCHITECTURE
  34. if ($hostPlatform -eq "AMD64") {
  35. $hostPlatform="x64"
  36. } elseif ($hostPlatform -eq "X86") {
  37. $hostPlatform="x86"
  38. }
  39. Write-Host DataFile: $DataFile
  40. Write-Host TargetPlatform: $TargetPlatform
  41. Write-Host MSBuildPath: $MSBuildPath
  42. Write-Host HostPlatform: $hostPlatform
  43. $sep="_"
  44. $genccode="$scriptRoot\..\..\Build\VcBuild\bin\$hostPlatform" + "_release\Chakra.ICU.GenCCode.exe"
  45. if (-not (Test-Path $genccode)) {
  46. Write-Host
  47. Write-Host Could not find $genccode, building from scratch
  48. cmd /c "$MSBuildPath" /nologo "$scriptRoot\..\..\deps\Chakra.ICU\Chakra.ICU.GenCCode.vcxproj" "/p:Platform=$hostPlatform;Configuration=Release;SolutionDir=$scriptRoot\..\..\Build\"
  49. }
  50. Write-Host
  51. Write-Host Building object file
  52. cmd /c "$genccode" --object --destdir $IntDir --entrypoint icudt$IcuVersionMajor $DataFile
  53. Write-Host "Object file created in $IntDir"