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