mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-23 06:25:19 -07:00
Merge pull request #42 from nventive/dev/jela/android-arch
Wasm Bootstrapper, Android NDK
This commit is contained in:
commit
9285eb03a2
9 changed files with 125 additions and 56 deletions
|
@ -64,6 +64,7 @@
|
||||||
<ClCompile Include="../CalcManager/Ratpack/support.cpp" />
|
<ClCompile Include="../CalcManager/Ratpack/support.cpp" />
|
||||||
<ClCompile Include="../CalcManager/Ratpack/trans.cpp" />
|
<ClCompile Include="../CalcManager/Ratpack/trans.cpp" />
|
||||||
<ClCompile Include="../CalcManager/Ratpack/transh.cpp" />
|
<ClCompile Include="../CalcManager/Ratpack/transh.cpp" />
|
||||||
|
<ClCompile Include="strto_workaround.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="../CalcManager/CalculatorHistory.h" />
|
<ClInclude Include="../CalcManager/CalculatorHistory.h" />
|
||||||
|
@ -105,49 +106,49 @@
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>Clang_5_0</PlatformToolset>
|
<PlatformToolset>Clang_5_0</PlatformToolset>
|
||||||
<AndroidAPILevel>android-27</AndroidAPILevel>
|
<AndroidAPILevel>android-21</AndroidAPILevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>Clang_5_0</PlatformToolset>
|
<PlatformToolset>Clang_5_0</PlatformToolset>
|
||||||
<AndroidAPILevel>android-27</AndroidAPILevel>
|
<AndroidAPILevel>android-21</AndroidAPILevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>Clang_5_0</PlatformToolset>
|
<PlatformToolset>Clang_5_0</PlatformToolset>
|
||||||
<AndroidAPILevel>android-27</AndroidAPILevel>
|
<AndroidAPILevel>android-21</AndroidAPILevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>Clang_5_0</PlatformToolset>
|
<PlatformToolset>Clang_5_0</PlatformToolset>
|
||||||
<AndroidAPILevel>android-27</AndroidAPILevel>
|
<AndroidAPILevel>android-21</AndroidAPILevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>Clang_5_0</PlatformToolset>
|
<PlatformToolset>Clang_5_0</PlatformToolset>
|
||||||
<AndroidAPILevel>android-27</AndroidAPILevel>
|
<AndroidAPILevel>android-21</AndroidAPILevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>Clang_5_0</PlatformToolset>
|
<PlatformToolset>Clang_5_0</PlatformToolset>
|
||||||
<AndroidAPILevel>android-27</AndroidAPILevel>
|
<AndroidAPILevel>android-21</AndroidAPILevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>Clang_5_0</PlatformToolset>
|
<PlatformToolset>Clang_5_0</PlatformToolset>
|
||||||
<AndroidAPILevel>android-27</AndroidAPILevel>
|
<AndroidAPILevel>android-21</AndroidAPILevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>Clang_5_0</PlatformToolset>
|
<PlatformToolset>Clang_5_0</PlatformToolset>
|
||||||
<AndroidAPILevel>android-27</AndroidAPILevel>
|
<AndroidAPILevel>android-21</AndroidAPILevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)/Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)/Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings" />
|
<ImportGroup Label="ExtensionSettings" />
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
<ClCompile Include="../CalcManager/Ratpack/support.cpp" />
|
<ClCompile Include="../CalcManager/Ratpack/support.cpp" />
|
||||||
<ClCompile Include="../CalcManager/Ratpack/trans.cpp" />
|
<ClCompile Include="../CalcManager/Ratpack/trans.cpp" />
|
||||||
<ClCompile Include="../CalcManager/Ratpack/transh.cpp" />
|
<ClCompile Include="../CalcManager/Ratpack/transh.cpp" />
|
||||||
|
<ClCompile Include="strto_workaround.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="../CalcManager/CalculatorHistory.h" />
|
<ClInclude Include="../CalcManager/CalculatorHistory.h" />
|
||||||
|
|
23
src/CalcManager.Android/Source.cpp
Normal file
23
src/CalcManager.Android/Source.cpp
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
// see https://github.com/aosp-mirror/platform_bionic/commit/3103f6d39e4ae309a9374ee38f414400c889c558#diff-71865bddb52592934317bb2340a94b0cR199
|
||||||
|
|
||||||
|
double strtod_l(const char* s, char** end_ptr, locale_t)
|
||||||
|
{
|
||||||
|
return strtod(s, end_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
float strtof_l(const char* s, char** end_ptr, locale_t)
|
||||||
|
{
|
||||||
|
return strtof(s, end_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
long strtol_l(const char* s, char** end_ptr, int base, locale_t)
|
||||||
|
{
|
||||||
|
return strtol(s, end_ptr, base);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long strtoul_l(const char* s, char** end_ptr, int base, locale_t)
|
||||||
|
{
|
||||||
|
return strtoul(s, end_ptr, base);
|
||||||
|
}
|
21
src/CalcManager.Android/strto_workaround.cpp
Normal file
21
src/CalcManager.Android/strto_workaround.cpp
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
double strtod_l(const char* s, char** end_ptr, locale_t)
|
||||||
|
{
|
||||||
|
return strtod(s, end_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
float strtof_l(const char* s, char** end_ptr, locale_t)
|
||||||
|
{
|
||||||
|
return strtof(s, end_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
long strtol_l(const char* s, char** end_ptr, int base, locale_t)
|
||||||
|
{
|
||||||
|
return strtol(s, end_ptr, base);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long strtoul_l(const char* s, char** end_ptr, int base, locale_t)
|
||||||
|
{
|
||||||
|
return strtoul(s, end_ptr, base);
|
||||||
|
}
|
|
@ -21,7 +21,7 @@
|
||||||
<AndroidUseIntermediateDesignerFile>True</AndroidUseIntermediateDesignerFile>
|
<AndroidUseIntermediateDesignerFile>True</AndroidUseIntermediateDesignerFile>
|
||||||
<ResourcesDirectory>..\Calculator.Shared\Strings</ResourcesDirectory>
|
<ResourcesDirectory>..\Calculator.Shared\Strings</ResourcesDirectory>
|
||||||
<LangVersion>7.3</LangVersion>
|
<LangVersion>7.3</LangVersion>
|
||||||
<AndroidKeyStore>true</AndroidKeyStore>
|
<AndroidKeyStore>false</AndroidKeyStore>
|
||||||
<AndroidSigningKeyStore>calc-prod.keystore</AndroidSigningKeyStore>
|
<AndroidSigningKeyStore>calc-prod.keystore</AndroidSigningKeyStore>
|
||||||
<AndroidSigningKeyAlias>calc-prod</AndroidSigningKeyAlias>
|
<AndroidSigningKeyAlias>calc-prod</AndroidSigningKeyAlias>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -65,6 +65,8 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Uno.UI" Version="1.45.0-dev.1550" />
|
<PackageReference Include="Uno.UI" Version="1.45.0-dev.1550" />
|
||||||
<PackageReference Include="Uno.UniversalImageLoader" Version="1.9.32" />
|
<PackageReference Include="Uno.UniversalImageLoader" Version="1.9.32" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="..\AssemblyVersion.Android.cs">
|
<Compile Include="..\AssemblyVersion.Android.cs">
|
||||||
|
|
|
@ -19,6 +19,10 @@ using Windows.UI.Xaml.Input;
|
||||||
using Windows.UI.Xaml.Media;
|
using Windows.UI.Xaml.Media;
|
||||||
using Windows.UI.Xaml.Navigation;
|
using Windows.UI.Xaml.Navigation;
|
||||||
|
|
||||||
|
#if HAS_UNO
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace CalculatorApp
|
namespace CalculatorApp
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -34,6 +38,10 @@ namespace CalculatorApp
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
|
#if HAS_UNO
|
||||||
|
ConfigureFilters(Uno.Extensions.LogExtensionPoint.AmbientLoggerFactory);
|
||||||
|
#endif
|
||||||
|
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
this.Suspending += OnSuspending;
|
this.Suspending += OnSuspending;
|
||||||
}
|
}
|
||||||
|
@ -91,6 +99,48 @@ namespace CalculatorApp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HAS_UNO
|
||||||
|
static void ConfigureFilters(ILoggerFactory factory)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
factory
|
||||||
|
.WithFilter(new FilterLoggerSettings
|
||||||
|
{
|
||||||
|
{ "Uno", LogLevel.Warning },
|
||||||
|
{ "Windows", LogLevel.Warning },
|
||||||
|
|
||||||
|
// Generic Xaml events
|
||||||
|
//{ "Windows.UI.Xaml", LogLevel.Debug },
|
||||||
|
// { "Windows.UI.Xaml.Shapes", LogLevel.Debug },
|
||||||
|
//{ "Windows.UI.Xaml.VisualStateGroup", LogLevel.Debug },
|
||||||
|
//{ "Windows.UI.Xaml.StateTriggerBase", LogLevel.Debug },
|
||||||
|
// { "Windows.UI.Xaml.UIElement", LogLevel.Debug },
|
||||||
|
// { "Windows.UI.Xaml.Setter", LogLevel.Debug },
|
||||||
|
|
||||||
|
// Layouter specific messages
|
||||||
|
// { "Windows.UI.Xaml.Controls", LogLevel.Debug },
|
||||||
|
//{ "Windows.UI.Xaml.Controls.Layouter", LogLevel.Debug },
|
||||||
|
//{ "Windows.UI.Xaml.Controls.Panel", LogLevel.Debug },
|
||||||
|
|
||||||
|
// Binding related messages
|
||||||
|
// { "Windows.UI.Xaml.Data", LogLevel.Debug },
|
||||||
|
// { "Windows.UI.Xamll.Data", LogLevel.Debug },
|
||||||
|
|
||||||
|
// Binder memory references tracking
|
||||||
|
// { "ReferenceHolder", LogLevel.Debug },
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.AddConsole(LogLevel.Trace);
|
||||||
|
#else
|
||||||
|
#if !__WASM__
|
||||||
|
factory
|
||||||
|
.AddConsole(LogLevel.Error);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return True if animation is enabled by user setting.
|
/// Return True if animation is enabled by user setting.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -33,11 +33,18 @@
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Content Include="LinkerConfig.xml" />
|
<Content Include="LinkerConfig.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<WasmShellMonoEnvironment Include="MONO_GC_PARAMS" Value="soft-heap-limit=512m,nursery-size=64m,evacuation-threshold=66,major=marksweep" />
|
||||||
|
<WasmShellMonoEnvironment Include="MONO_LOG_LEVEL" Value="debug" />
|
||||||
|
<WasmShellMonoEnvironment Include="MONO_LOG_MASK" Value="gc" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
|
||||||
<PackageReference Include="Uno.UI" Version="1.45.0-dev.1550" />
|
<PackageReference Include="Uno.UI" Version="1.45.0-dev.1550" />
|
||||||
<PackageReference Include="Uno.Wasm.Bootstrap" Version="1.0.0-dev.278" />
|
<PackageReference Include="Uno.Wasm.Bootstrap" Version="1.0.0-dev.281" />
|
||||||
<DotNetCliToolReference Include="Uno.Wasm.Bootstrap.Cli" Version="1.0.0-dev.276" />
|
<DotNetCliToolReference Include="Uno.Wasm.Bootstrap.Cli" Version="1.0.0-dev.276" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -14,45 +14,7 @@ namespace WindowsCalculator.Wasm
|
||||||
{
|
{
|
||||||
Console.WriteLine("Program.Main");
|
Console.WriteLine("Program.Main");
|
||||||
|
|
||||||
ConfigureFilters(LogExtensionPoint.AmbientLoggerFactory);
|
|
||||||
|
|
||||||
Windows.UI.Xaml.Application.Start(_ => _app = new App());
|
Windows.UI.Xaml.Application.Start(_ => _app = new App());
|
||||||
}
|
}
|
||||||
static void ConfigureFilters(ILoggerFactory factory)
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
factory
|
|
||||||
.WithFilter(new FilterLoggerSettings
|
|
||||||
{
|
|
||||||
{ "Uno", LogLevel.Warning },
|
|
||||||
{ "Windows", LogLevel.Warning },
|
|
||||||
|
|
||||||
// Generic Xaml events
|
|
||||||
//{ "Windows.UI.Xaml", LogLevel.Debug },
|
|
||||||
// { "Windows.UI.Xaml.Shapes", LogLevel.Debug },
|
|
||||||
//{ "Windows.UI.Xaml.VisualStateGroup", LogLevel.Debug },
|
|
||||||
//{ "Windows.UI.Xaml.StateTriggerBase", LogLevel.Debug },
|
|
||||||
// { "Windows.UI.Xaml.UIElement", LogLevel.Debug },
|
|
||||||
// { "Windows.UI.Xaml.Setter", LogLevel.Debug },
|
|
||||||
|
|
||||||
// Layouter specific messages
|
|
||||||
// { "Windows.UI.Xaml.Controls", LogLevel.Debug },
|
|
||||||
//{ "Windows.UI.Xaml.Controls.Layouter", LogLevel.Debug },
|
|
||||||
//{ "Windows.UI.Xaml.Controls.Panel", LogLevel.Debug },
|
|
||||||
|
|
||||||
// Binding related messages
|
|
||||||
// { "Windows.UI.Xaml.Data", LogLevel.Debug },
|
|
||||||
// { "Windows.UI.Xamll.Data", LogLevel.Debug },
|
|
||||||
|
|
||||||
// Binder memory references tracking
|
|
||||||
// { "ReferenceHolder", LogLevel.Debug },
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.AddConsole(LogLevel.Trace);
|
|
||||||
#else
|
|
||||||
factory
|
|
||||||
.AddConsole(LogLevel.Error);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,6 +191,8 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Uno.UI" Version="1.45.0-dev.1550" />
|
<PackageReference Include="Uno.UI" Version="1.45.0-dev.1550" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition=" '$(Platform)' == 'iPhoneSimulator' ">
|
<ItemGroup Condition=" '$(Platform)' == 'iPhoneSimulator' ">
|
||||||
<NativeReference Include="NativeReferences/x86_64/libCalcManager.a">
|
<NativeReference Include="NativeReferences/x86_64/libCalcManager.a">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue