Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 19e710d2 authored by g4m4's avatar g4m4
Browse files

[CODE] Protect non-windows builds

parent b6e4423f
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@ THIRD_PARTY_INCLUDES_END
}
#if PLATFORM_WINDOWS
namespace {
// These methods are implemented only here with internal linkage
// so they do not require exposing fixit internal library types
......@@ -41,7 +42,6 @@ namespace {
}
}
fixit::PlayerData UFixItPlayerDataBaseConvertTo(const UFixItPlayerDataBase* PlayerData)
{
fixit::PlayerData Out = fixit::PlayerData(FFixItTranslationLayer::ToStd(PlayerData->PrefilledStr));
......@@ -56,6 +56,7 @@ bool FFixItBugRequestData::IsValid() const
return !Title.IsEmpty()
&& !Content.IsEmpty();
}
} // namespace
fixit::BugRequestData FFixItBugRequestData::ConvertTo() const
{
......@@ -66,3 +67,4 @@ fixit::BugRequestData FFixItBugRequestData::ConvertTo() const
std::make_unique<fixit::PlayerData>(UFixItPlayerDataBaseConvertTo(PlayerData))
};
}
#endif // PLATFORM_WINDOWS
......@@ -25,15 +25,19 @@ namespace {
void FFixItCoreModule::StartupModule()
{
fixit::setAssertionHandler(&AssertToUnreal);
DataModule = MakeUnique<FFixItDataModule>();
HttpModule = MakeUnique<FFixItHttpModule>();
#if PLATFORM_WINDOWS
fixit::setAssertionHandler(&AssertToUnreal);
DataModule = MakeUnique<FFixItDataModule>();
HttpModule = MakeUnique<FFixItHttpModule>();
#endif // PLATFORM_WINDOWS
}
void FFixItCoreModule::ShutdownModule()
{
DataModule.Reset();
HttpModule.Reset();
#if PLATFORM_WINDOWS
DataModule.Reset();
HttpModule.Reset();
#endif // PLATFORM_WINDOWS
}
IMPLEMENT_MODULE(FFixItCoreModule, FixItCore)
......@@ -11,10 +11,12 @@
#include "FixItTranslationLayer.h"
#if PLATFORM_WINDOWS
std::unique_ptr<fixit::DataHostBase> FFixItDataModule::Collect()
{
return std::make_unique<FFixItDataHost>();
}
#endif // PLATFORM_WINDOWS
FFixItDataHost::FFixItDataHost() : PlatformData(FFixItPlatformData::Collect()) {
......
......@@ -17,6 +17,10 @@ THIRD_PARTY_INCLUDES_END
#include "FixItPlatformData.h"
// Non-trivial constructor/destructor for fixit::DataModuleBase
// implies restricting usage to some platforms only
#if PLATFORM_WINDOWS
// Interface for platform data implementations
class FFixItDataModule : public fixit::DataModuleBase
{
......@@ -24,6 +28,8 @@ public:
std::unique_ptr<fixit::DataHostBase> Collect() override;
};
#endif // PLATFORM_WINDOWS
// Data structure holding data specific to the platform it is running on
// It is considered unchanged throughout an entire session
// so it can be cached etc.
......
......@@ -125,7 +125,11 @@ std::string FFixItHttpResponse::GetContentAsString() const
return FFixItTranslationLayer::ToStd(Response->GetContentAsString());
}
#if PLATFORM_WINDOWS
std::shared_ptr<fixit::HttpRequestInterface> FFixItHttpModule::CreateRequest()
{
return std::make_shared<FFixItHttpRequest>(FHttpModule::Get().CreateRequest());
}
#endif // PLATFORM_WINDOWS
......@@ -21,6 +21,10 @@ THIRD_PARTY_INCLUDES_END
class IHttpRequest;
// Non-trivial constructor/destructor for fixit::HttpModuleBase
// implies restricting usage to some platforms only
#if PLATFORM_WINDOWS
class FFixItHttpModule : public fixit::HttpModuleBase
{
public:
......@@ -29,6 +33,8 @@ public:
std::string DumpRequests() const;
};
#endif // PLATFORM_WINDOWS
struct FFixItHttpRequest :
public fixit::HttpRequestInterface
{
......
......@@ -34,5 +34,7 @@ struct FIXITCORE_API FFixItBugRequestData
bool IsValid() const;
#if PLATFORM_WINDOWS
fixit::BugRequestData ConvertTo() const;
#endif // PLATFORM_WINDOWS
};
......@@ -29,7 +29,9 @@ public:
// End IModuleInterface interface
private:
#if PLATFORM_WINDOWS
// Fixit lib "modules"
TUniquePtr<FFixItDataModule> DataModule;
TUniquePtr<FFixItHttpModule> HttpModule;
#endif // PLATFORM_WINDOWS
};
......@@ -45,6 +45,8 @@ public class FixItLib : ModuleRules
string StaticLibName = "fixit_lib.lib";
PrivateDefinitions.Add("PLATFORM_DESKTOP=1");
PublicAdditionalLibraries.Add(
Path.Combine(LibDirectory, StaticLibName));
}
......@@ -59,7 +61,9 @@ public class FixItLib : ModuleRules
string StaticLibName = "libfixit_lib.a";
PublicAdditionalLibraries.Add(
PrivateDefinitions.Add("PLATFORM_DESKTOP=1");
PublicAdditionalLibraries.Add(
Path.Combine(LibDirectory, StaticLibName));
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment