50-win-onecore.conf 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. ## -*- mode: perl; -*-
  2. # Windows OneCore targets.
  3. #
  4. # OneCore is new API stability "contract" that transcends Desktop, IoT and
  5. # Mobile[?] Windows editions. It's a set up "umbrella" libraries that
  6. # export subset of Win32 API that are common to all Windows 10 devices.
  7. #
  8. # OneCore Configuration temporarily dedicated for console applications
  9. # due to disabled event logging, which is incompatible with one core.
  10. # Error messages are provided via standard error only.
  11. # TODO: extend error handling to use ETW based eventing
  12. # (Or rework whole error messaging)
  13. my $UWP_info = {};
  14. sub UWP_info {
  15. unless (%$UWP_info) {
  16. my $SDKver = `powershell -Command \"& {\$(Get-Item \\\"hklm:\\SOFTWARE\\WOW6432Node\\Microsoft\\Microsoft SDKs\\Windows\\\").GetValue(\\\"CurrentVersion\\\")}\"`;
  17. $SDKver =~ s|\R$||;
  18. my @SDKver_split = split(/\./, $SDKver);
  19. # SDK version older than 10.0.17763 don't support our ASM builds
  20. if ($SDKver_split[0] < 10
  21. || ($SDKver_split[0] == 10
  22. && $SDKver_split[1] == 0
  23. && $SDKver_split[2] < 17763)) {
  24. $UWP_info->{disable} = [ 'asm' ];
  25. } else {
  26. $UWP_info->{disable} = [ ];
  27. }
  28. }
  29. return $UWP_info;
  30. }
  31. my %targets = (
  32. "VC-WIN32-ONECORE" => {
  33. inherit_from => [ "VC-WIN32" ],
  34. # /NODEFAULTLIB:kernel32.lib is needed, because MSVCRT.LIB has
  35. # hidden reference to kernel32.lib, but we don't actually want
  36. # it in "onecore" build.
  37. # /APPCONTAINER is needed for Universal Windows Platform compat
  38. lflags => add("/NODEFAULTLIB:kernel32.lib /APPCONTAINER"),
  39. defines => add("OPENSSL_SYS_WIN_CORE"),
  40. ex_libs => "onecore.lib",
  41. },
  42. "VC-WIN64A-ONECORE" => {
  43. inherit_from => [ "VC-WIN64A" ],
  44. lflags => add("/NODEFAULTLIB:kernel32.lib /APPCONTAINER"),
  45. defines => add("OPENSSL_SYS_WIN_CORE"),
  46. ex_libs => "onecore.lib",
  47. },
  48. # Windows on ARM targets. ARM compilers are additional components in
  49. # VS2017, i.e. they are not installed by default. And when installed,
  50. # there are no "ARM Tool Command Prompt"s on Start menu, you have
  51. # to locate vcvarsall.bat and act accordingly. VC-WIN32-ARM has
  52. # received limited testing with evp_test.exe on Windows 10 IoT Core,
  53. # but not VC-WIN64-ARM, no hardware... In other words they are not
  54. # actually supported...
  55. #
  56. # Another thing to keep in mind [in cross-compilation scenario such
  57. # as this one] is that target's file system has nothing to do with
  58. # compilation system's one. This means that you're are likely to use
  59. # --prefix and --openssldir with target-specific values. 'nmake install'
  60. # step is effectively meaningless in cross-compilation case, though
  61. # it might be useful to 'nmake install DESTDIR=S:\ome\where' where you
  62. # can point Visual Studio to when compiling custom application code.
  63. "VC-WIN32-ARM" => {
  64. inherit_from => [ "VC-noCE-common" ],
  65. defines => add("_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE",
  66. "OPENSSL_SYS_WIN_CORE"),
  67. bn_ops => "BN_LLONG RC4_CHAR",
  68. lflags => add("/NODEFAULTLIB:kernel32.lib /APPCONTAINER"),
  69. ex_libs => "onecore.lib",
  70. multilib => "-arm",
  71. },
  72. "VC-WIN64-ARM" => {
  73. inherit_from => [ "VC-noCE-common" ],
  74. defines => add("_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE",
  75. "OPENSSL_SYS_WIN_CORE"),
  76. bn_ops => "SIXTY_FOUR_BIT RC4_CHAR",
  77. lflags => add("/NODEFAULTLIB:kernel32.lib /APPCONTAINER"),
  78. ex_libs => "onecore.lib",
  79. multilib => "-arm64",
  80. },
  81. # Universal Windows Platform (UWP) App Support
  82. # TODO
  83. #
  84. # The 'disable' attribute should have 'uplink'.
  85. # however, these are checked in some 'inherit_from', which is processed
  86. # very early, before the 'disable' attributes are seen.
  87. # This is a problem that needs to be resolved in Configure first.
  88. #
  89. # But if you want to build library with Windows 10 Version 1809 SDK or
  90. # earlier, the 'disable' attribute should also have 'asm'.
  91. "VC-WIN32-UWP" => {
  92. inherit_from => [ "VC-WIN32-ONECORE" ],
  93. lflags => add("/APPCONTAINER"),
  94. defines => add("WINAPI_FAMILY=WINAPI_FAMILY_APP",
  95. "_WIN32_WINNT=0x0A00"),
  96. dso_scheme => "",
  97. disable => sub { [ 'ui-console', 'stdio', 'async', 'uplink',
  98. @{ UWP_info()->{disable} } ] },
  99. ex_libs => "WindowsApp.lib",
  100. },
  101. "VC-WIN64A-UWP" => {
  102. inherit_from => [ "VC-WIN64A-ONECORE" ],
  103. lflags => add("/APPCONTAINER"),
  104. defines => add("WINAPI_FAMILY=WINAPI_FAMILY_APP",
  105. "_WIN32_WINNT=0x0A00"),
  106. dso_scheme => "",
  107. disable => sub { [ 'ui-console', 'stdio', 'async', 'uplink',
  108. @{ UWP_info()->{disable} } ] },
  109. ex_libs => "WindowsApp.lib",
  110. },
  111. "VC-WIN32-ARM-UWP" => {
  112. inherit_from => [ "VC-WIN32-ARM" ],
  113. lflags => add("/APPCONTAINER"),
  114. defines => add("WINAPI_FAMILY=WINAPI_FAMILY_APP",
  115. "_WIN32_WINNT=0x0A00"),
  116. dso_scheme => "",
  117. disable => sub { [ 'ui-console', 'stdio', 'async', 'uplink',
  118. @{ UWP_info()->{disable} } ] },
  119. ex_libs => "WindowsApp.lib",
  120. },
  121. "VC-WIN64-ARM-UWP" => {
  122. inherit_from => [ "VC-WIN64-ARM" ],
  123. lflags => add("/APPCONTAINER"),
  124. defines => add("WINAPI_FAMILY=WINAPI_FAMILY_APP",
  125. "_WIN32_WINNT=0x0A00"),
  126. dso_scheme => "",
  127. disable => sub { [ 'ui-console', 'stdio', 'async', 'uplink',
  128. @{ UWP_info()->{disable} } ] },
  129. ex_libs => "WindowsApp.lib",
  130. },
  131. );