50-win-onecore.conf 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. lflags => add("/NODEFAULTLIB:kernel32.lib"),
  38. defines => add("OPENSSL_SYS_WIN_CORE"),
  39. ex_libs => "onecore.lib",
  40. },
  41. "VC-WIN64A-ONECORE" => {
  42. inherit_from => [ "VC-WIN64A" ],
  43. lflags => add("/NODEFAULTLIB:kernel32.lib"),
  44. defines => add("OPENSSL_SYS_WIN_CORE"),
  45. ex_libs => "onecore.lib",
  46. },
  47. # Windows on ARM targets. ARM compilers are additional components in
  48. # VS2017, i.e. they are not installed by default. And when installed,
  49. # there are no "ARM Tool Command Prompt"s on Start menu, you have
  50. # to locate vcvarsall.bat and act accordingly. VC-WIN32-ARM has
  51. # received limited testing with evp_test.exe on Windows 10 IoT Core,
  52. # but not VC-WIN64-ARM, no hardware... In other words they are not
  53. # actually supported...
  54. #
  55. # Another thing to keep in mind [in cross-compilation scenario such
  56. # as this one] is that target's file system has nothing to do with
  57. # compilation system's one. This means that you're are likely to use
  58. # --prefix and --openssldir with target-specific values. 'nmake install'
  59. # step is effectively meaningless in cross-compilation case, though
  60. # it might be useful to 'nmake install DESTDIR=S:\ome\where' where you
  61. # can point Visual Studio to when compiling custom application code.
  62. "VC-WIN32-ARM" => {
  63. inherit_from => [ "VC-noCE-common" ],
  64. defines => add("_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE",
  65. "OPENSSL_SYS_WIN_CORE"),
  66. bn_ops => "BN_LLONG RC4_CHAR",
  67. lflags => add("/NODEFAULTLIB:kernel32.lib"),
  68. ex_libs => "onecore.lib",
  69. multilib => "-arm",
  70. },
  71. "VC-WIN64-ARM" => {
  72. inherit_from => [ "VC-noCE-common" ],
  73. defines => add("_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE",
  74. "OPENSSL_SYS_WIN_CORE"),
  75. bn_ops => "SIXTY_FOUR_BIT RC4_CHAR",
  76. lflags => add("/NODEFAULTLIB:kernel32.lib"),
  77. ex_libs => "onecore.lib",
  78. multilib => "-arm64",
  79. },
  80. # Universal Windows Platform (UWP) App Support
  81. # TODO
  82. #
  83. # The 'disable' attribute should have 'uplink'.
  84. # however, these are checked in some 'inherit_from', which is processed
  85. # very early, before the 'disable' attributes are seen.
  86. # This is a problem that needs to be resolved in Configure first.
  87. #
  88. # But if you want to build library with Windows 10 Version 1809 SDK or
  89. # earlier, the 'disable' attribute should also have 'asm'.
  90. "VC-WIN32-UWP" => {
  91. inherit_from => [ "VC-WIN32-ONECORE" ],
  92. lflags => add("/APPCONTAINER"),
  93. defines => add("WINAPI_FAMILY=WINAPI_FAMILY_APP",
  94. "_WIN32_WINNT=0x0A00"),
  95. dso_scheme => "",
  96. disable => sub { [ 'ui-console', 'stdio', 'async', 'uplink',
  97. @{ UWP_info()->{disable} } ] },
  98. ex_libs => "WindowsApp.lib",
  99. },
  100. "VC-WIN64A-UWP" => {
  101. inherit_from => [ "VC-WIN64A-ONECORE" ],
  102. lflags => add("/APPCONTAINER"),
  103. defines => add("WINAPI_FAMILY=WINAPI_FAMILY_APP",
  104. "_WIN32_WINNT=0x0A00"),
  105. dso_scheme => "",
  106. disable => sub { [ 'ui-console', 'stdio', 'async', 'uplink',
  107. @{ UWP_info()->{disable} } ] },
  108. ex_libs => "WindowsApp.lib",
  109. },
  110. "VC-WIN32-ARM-UWP" => {
  111. inherit_from => [ "VC-WIN32-ARM" ],
  112. lflags => add("/APPCONTAINER"),
  113. defines => add("WINAPI_FAMILY=WINAPI_FAMILY_APP",
  114. "_WIN32_WINNT=0x0A00"),
  115. dso_scheme => "",
  116. disable => sub { [ 'ui-console', 'stdio', 'async', 'uplink',
  117. @{ UWP_info()->{disable} } ] },
  118. ex_libs => "WindowsApp.lib",
  119. },
  120. "VC-WIN64-ARM-UWP" => {
  121. inherit_from => [ "VC-WIN64-ARM" ],
  122. lflags => add("/APPCONTAINER"),
  123. defines => add("WINAPI_FAMILY=WINAPI_FAMILY_APP",
  124. "_WIN32_WINNT=0x0A00"),
  125. dso_scheme => "",
  126. disable => sub { [ 'ui-console', 'stdio', 'async', 'uplink',
  127. @{ UWP_info()->{disable} } ] },
  128. ex_libs => "WindowsApp.lib",
  129. },
  130. );