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