Add CMake project, GCC support (#540)

This is extract from #211 that enables compilation with GCC. With #211
now in the state of bitrot, I would rather try approaching it in smaller
steps that can be hopefully merged quicker, even if it does not provide
full support for all the features #211 provided.

This will _compile_ correctly with my (@janisozaur) GCC, but clang is
more picky about flexible array members and refuses to compile it yet.
I will extract remaining parts of #211 in future PRs.

I marked @fwcd as author, as he did most of the work in #211.
This commit is contained in:
Michał Janiszewski
2019-06-06 23:08:31 +02:00
committed by Matt Cooley
parent 98f1da2e9d
commit fe30c7cabc
19 changed files with 151 additions and 50 deletions

View File

@@ -5,8 +5,8 @@
#include <vector>
#include <unordered_map>
#include <ppltasks.h>
#include <sal.h> // for SAL
#include <future>
#include "sal_cross_platform.h" // for SAL
#include <memory> // for std::shared_ptr
namespace UnitConversionManager
@@ -211,9 +211,9 @@ namespace UnitConversionManager
GetCurrencyRatioEquality(_In_ const UnitConversionManager::Unit& unit1, _In_ const UnitConversionManager::Unit& unit2) = 0;
virtual std::wstring GetCurrencyTimestamp() = 0;
virtual concurrency::task<bool> TryLoadDataFromCacheAsync() = 0;
virtual concurrency::task<bool> TryLoadDataFromWebAsync() = 0;
virtual concurrency::task<bool> TryLoadDataFromWebOverrideAsync() = 0;
virtual std::future<bool> TryLoadDataFromCacheAsync() = 0;
virtual std::future<bool> TryLoadDataFromWebAsync() = 0;
virtual std::future<bool> TryLoadDataFromWebOverrideAsync() = 0;
};
class IUnitConverterVMCallback
@@ -242,7 +242,7 @@ namespace UnitConversionManager
virtual void SendCommand(Command command) = 0;
virtual void SetViewModelCallback(_In_ const std::shared_ptr<IUnitConverterVMCallback>& newCallback) = 0;
virtual void SetViewModelCurrencyCallback(_In_ const std::shared_ptr<IViewModelCurrencyCallback>& newCallback) = 0;
virtual concurrency::task<std::pair<bool, std::wstring>> RefreshCurrencyRatios() = 0;
virtual std::future<std::pair<bool, std::wstring>> RefreshCurrencyRatios() = 0;
virtual void Calculate() = 0;
virtual void ResetCategoriesAndRatios() = 0;
};
@@ -265,7 +265,7 @@ namespace UnitConversionManager
void SendCommand(Command command) override;
void SetViewModelCallback(_In_ const std::shared_ptr<IUnitConverterVMCallback>& newCallback) override;
void SetViewModelCurrencyCallback(_In_ const std::shared_ptr<IViewModelCurrencyCallback>& newCallback) override;
concurrency::task<std::pair<bool, std::wstring>> RefreshCurrencyRatios() override;
std::future<std::pair<bool, std::wstring>> RefreshCurrencyRatios() override;
void Calculate() override;
void ResetCategoriesAndRatios() override;
// IUnitConverter