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