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