From e1d6dc27ec013dfecde942c7690432925ce3e23a Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Thu, 13 Dec 2018 23:28:05 -0800 Subject: Fixed MinGW build --- .../GhostCubePlugin/PluginSource/CMakeLists.txt | 21 +++++++++++---------- .../GhostCubePlugin/PluginSource/src/PlatformBase.h | 8 ++++---- .../PluginSource/src/RenderingPlugin.cpp | 4 ++++ 3 files changed, 19 insertions(+), 14 deletions(-) (limited to 'unityplugin/GhostCubePlugin/PluginSource') diff --git a/unityplugin/GhostCubePlugin/PluginSource/CMakeLists.txt b/unityplugin/GhostCubePlugin/PluginSource/CMakeLists.txt index d7388ad..8737991 100644 --- a/unityplugin/GhostCubePlugin/PluginSource/CMakeLists.txt +++ b/unityplugin/GhostCubePlugin/PluginSource/CMakeLists.txt @@ -51,7 +51,7 @@ else() ) endif() -if(PLATFORM_WIN32 OR PLATFORM_UNIVERSAL_WINDOWS) +if(MSVC) target_sources(GhostCubePlugin-shared PRIVATE src/RenderingPlugin.def @@ -82,19 +82,20 @@ endif() set_common_target_properties(GhostCubePlugin-shared) +if(PLATFORM_WIN32) + target_compile_definitions(GhostCubePlugin-shared PRIVATE UNITY_WIN=1) +elseif(PLATFORM_UNIVERSAL_WINDOWS) + target_compile_definitions(GhostCubePlugin-shared PRIVATE WINDOWS_UWP=1 UNITY_METRO=1) +elseif(PLATFORM_ANDROID) + target_compile_definitions(GhostCubePlugin-shared PRIVATE UNITY_ANDROID=1) +elseif(PLATFORM_LINUX) + target_compile_definitions(GhostCubePlugin-shared PRIVATE UNITY_LINUX=1) +endif() + if(MSVC) # Disable MSVC-specific warnings # - w4201: nonstandard extension used: nameless struct/unio target_compile_options(GhostCubePlugin-shared PRIVATE /wd4201) - if(PLATFORM_UNIVERSAL_WINDOWS) - target_compile_definitions(GhostCubePlugin-shared PRIVATE WINDOWS_UWP UNITY_METRO) - endif() -endif() - -if(PLATFORM_ANDROID) - target_compile_definitions(GhostCubePlugin-shared PRIVATE UNITY_ANDROID) -elseif(PLATFORM_LINUX) - target_compile_definitions(GhostCubePlugin-shared PRIVATE UNITY_LINUX) endif() if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/PlatformBase.h b/unityplugin/GhostCubePlugin/PluginSource/src/PlatformBase.h index fc407b0..bc4c6e0 100644 --- a/unityplugin/GhostCubePlugin/PluginSource/src/PlatformBase.h +++ b/unityplugin/GhostCubePlugin/PluginSource/src/PlatformBase.h @@ -13,16 +13,16 @@ // UNITY_ANDROID - Android // UNITY_METRO - WSA or UWP // UNITY_WEBGL - WebGL -#if _MSC_VER - #define UNITY_WIN 1 +#if defined(UNITY_WIN) || defined(UNITY_METRO) || defined(UNITY_ANDROID) || defined(UNITY_LINUX) || defined(UNITY_WEBGL) + // these are defined externally +#elif _MSC_VER + #define UNITY_WIN 1 #elif defined(__APPLE__) #if defined(__arm__) || defined(__arm64__) #define UNITY_IPHONE 1 #else #define UNITY_OSX 1 #endif -#elif defined(UNITY_METRO) || defined(UNITY_ANDROID) || defined(UNITY_LINUX) || defined(UNITY_WEBGL) - // these are defined externally #elif defined(__EMSCRIPTEN__) // this is already defined in Unity 5.6 #define UNITY_WEBGL 1 diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/RenderingPlugin.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/RenderingPlugin.cpp index 7b71f16..7ff8fc7 100644 --- a/unityplugin/GhostCubePlugin/PluginSource/src/RenderingPlugin.cpp +++ b/unityplugin/GhostCubePlugin/PluginSource/src/RenderingPlugin.cpp @@ -5,6 +5,10 @@ #include "RenderAPI.h" #include "SamplePlugin.h" +#if PLATFORM_WIN32 || PLATFORM_UNIVERSAL_WINDOWS + #include +#endif + #include using namespace Diligent; -- cgit v1.2.3