mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -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/trans.cpp" />
|
||||
<ClCompile Include="../CalcManager/Ratpack/transh.cpp" />
|
||||
<ClCompile Include="strto_workaround.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="../CalcManager/CalculatorHistory.h" />
|
||||
|
@ -105,49 +106,49 @@
|
|||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>Clang_5_0</PlatformToolset>
|
||||
<AndroidAPILevel>android-27</AndroidAPILevel>
|
||||
<AndroidAPILevel>android-21</AndroidAPILevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>Clang_5_0</PlatformToolset>
|
||||
<AndroidAPILevel>android-27</AndroidAPILevel>
|
||||
<AndroidAPILevel>android-21</AndroidAPILevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>Clang_5_0</PlatformToolset>
|
||||
<AndroidAPILevel>android-27</AndroidAPILevel>
|
||||
<AndroidAPILevel>android-21</AndroidAPILevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>Clang_5_0</PlatformToolset>
|
||||
<AndroidAPILevel>android-27</AndroidAPILevel>
|
||||
<AndroidAPILevel>android-21</AndroidAPILevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>Clang_5_0</PlatformToolset>
|
||||
<AndroidAPILevel>android-27</AndroidAPILevel>
|
||||
<AndroidAPILevel>android-21</AndroidAPILevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>Clang_5_0</PlatformToolset>
|
||||
<AndroidAPILevel>android-27</AndroidAPILevel>
|
||||
<AndroidAPILevel>android-21</AndroidAPILevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>Clang_5_0</PlatformToolset>
|
||||
<AndroidAPILevel>android-27</AndroidAPILevel>
|
||||
<AndroidAPILevel>android-21</AndroidAPILevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>Clang_5_0</PlatformToolset>
|
||||
<AndroidAPILevel>android-27</AndroidAPILevel>
|
||||
<AndroidAPILevel>android-21</AndroidAPILevel>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)/Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings" />
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
<ClCompile Include="../CalcManager/Ratpack/support.cpp" />
|
||||
<ClCompile Include="../CalcManager/Ratpack/trans.cpp" />
|
||||
<ClCompile Include="../CalcManager/Ratpack/transh.cpp" />
|
||||
<ClCompile Include="strto_workaround.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<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>
|
||||
<ResourcesDirectory>..\Calculator.Shared\Strings</ResourcesDirectory>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<AndroidKeyStore>true</AndroidKeyStore>
|
||||
<AndroidKeyStore>false</AndroidKeyStore>
|
||||
<AndroidSigningKeyStore>calc-prod.keystore</AndroidSigningKeyStore>
|
||||
<AndroidSigningKeyAlias>calc-prod</AndroidSigningKeyAlias>
|
||||
</PropertyGroup>
|
||||
|
@ -65,7 +65,9 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Uno.UI" Version="1.45.0-dev.1550" />
|
||||
<PackageReference Include="Uno.UniversalImageLoader" Version="1.9.32" />
|
||||
</ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\AssemblyVersion.Android.cs">
|
||||
<Link>Properties\AssemblyVersion.Android.cs</Link>
|
||||
|
@ -114,4 +116,4 @@
|
|||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -19,6 +19,10 @@ using Windows.UI.Xaml.Input;
|
|||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
#if HAS_UNO
|
||||
using Microsoft.Extensions.Logging;
|
||||
#endif
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -34,6 +38,10 @@ namespace CalculatorApp
|
|||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
#if HAS_UNO
|
||||
ConfigureFilters(Uno.Extensions.LogExtensionPoint.AmbientLoggerFactory);
|
||||
#endif
|
||||
|
||||
this.InitializeComponent();
|
||||
this.Suspending += OnSuspending;
|
||||
}
|
||||
|
@ -91,10 +99,52 @@ namespace CalculatorApp
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return True if animation is enabled by user setting.
|
||||
/// </summary>
|
||||
public static bool IsAnimationEnabled()
|
||||
#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>
|
||||
/// Return True if animation is enabled by user setting.
|
||||
/// </summary>
|
||||
public static bool IsAnimationEnabled()
|
||||
{
|
||||
return m_isAnimationEnabled;
|
||||
}
|
||||
|
|
|
@ -33,11 +33,18 @@
|
|||
<Compile Include="Program.cs" />
|
||||
<Content Include="LinkerConfig.xml" />
|
||||
</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>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" 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.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" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -14,45 +14,7 @@ namespace WindowsCalculator.Wasm
|
|||
{
|
||||
Console.WriteLine("Program.Main");
|
||||
|
||||
ConfigureFilters(LogExtensionPoint.AmbientLoggerFactory);
|
||||
|
||||
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,7 +191,9 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Uno.UI" Version="1.45.0-dev.1550" />
|
||||
</ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Platform)' == 'iPhoneSimulator' ">
|
||||
<NativeReference Include="NativeReferences/x86_64/libCalcManager.a">
|
||||
<Kind>Static</Kind>
|
||||
|
@ -204,4 +206,4 @@
|
|||
</ItemGroup>
|
||||
<Import Project="..\Calculator.Shared\Calculator.Shared.projitems" Label="Shared" Condition="Exists('..\Calculator.Shared\Calculator.Shared.projitems')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue