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