summaryrefslogtreecommitdiffstats
path: root/Platforms
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2017-12-20 05:41:39 +0000
committerEgor Yusov <egor.yusov@gmail.com>2017-12-20 05:41:39 +0000
commit45ca3b1c4cfcf791c5884697f18ff96da77a2cdc (patch)
tree9143b7e6945d5fbfa5039bd8d09770c156339e4f /Platforms
parentFixed file paths ('\' -> '/') to fix Android build on linux (diff)
downloadDiligentCore-45ca3b1c4cfcf791c5884697f18ff96da77a2cdc.tar.gz
DiligentCore-45ca3b1c4cfcf791c5884697f18ff96da77a2cdc.zip
Enabling linux build (in progress)
Diffstat (limited to 'Platforms')
-rw-r--r--Platforms/CMakeLists.txt3
-rw-r--r--Platforms/Linux/CMakeLists.txt39
-rw-r--r--Platforms/Linux/include/LinuxDebug.h32
-rw-r--r--Platforms/Linux/include/LinuxFileSystem.h66
-rw-r--r--Platforms/Linux/include/LinuxPlatformDefinitions.h30
-rw-r--r--Platforms/Linux/include/LinuxPlatformMisc.h43
-rw-r--r--Platforms/Linux/src/LinuxDebug.cpp50
-rw-r--r--Platforms/Linux/src/LinuxFileSystem.cpp190
-rw-r--r--Platforms/interface/FileSystem.h9
-rw-r--r--Platforms/interface/PlatformDebug.h7
-rw-r--r--Platforms/interface/PlatformDefinitions.h33
-rw-r--r--Platforms/interface/PlatformMisc.h6
12 files changed, 503 insertions, 5 deletions
diff --git a/Platforms/CMakeLists.txt b/Platforms/CMakeLists.txt
index 77fa5ce6..d51bdb08 100644
--- a/Platforms/CMakeLists.txt
+++ b/Platforms/CMakeLists.txt
@@ -15,6 +15,9 @@ elseif(PLATFORM_UNIVERSAL_WINDOWS)
elseif(PLATFORM_ANDROID)
add_subdirectory(Android)
add_library(TargetPlatform ALIAS AndroidPlatform)
+elseif(PLATFORM_LINUX)
+ add_subdirectory(Linux)
+ add_library(TargetPlatform ALIAS LinuxPlatform)
else()
message(FATAL_ERROR "No PLATFORM_XXX variable defined. Make sure that 'DiligentCore' folder is processed first")
endif()
diff --git a/Platforms/Linux/CMakeLists.txt b/Platforms/Linux/CMakeLists.txt
new file mode 100644
index 00000000..220160af
--- /dev/null
+++ b/Platforms/Linux/CMakeLists.txt
@@ -0,0 +1,39 @@
+cmake_minimum_required (VERSION 3.6)
+
+project(LinuxPlatform CXX)
+
+set(INCLUDE
+ include/LinuxDebug.h
+ include/LinuxFileSystem.h
+ include/LinuxPlatformDefinitions.h
+ include/LinuxPlatformMisc.h
+)
+
+set(SOURCE
+ src/LinuxDebug.cpp
+ src/LinuxFileSystem.cpp
+)
+
+add_library(LinuxPlatform ${SOURCE} ${INCLUDE})
+set_common_target_properties(LinuxPlatform)
+
+target_include_directories(LinuxPlatform
+PUBLIC
+ include
+)
+
+target_link_libraries(LinuxPlatform
+PRIVATE
+ BuildSettings
+ Common
+PUBLIC
+ PlatformInterface
+ BasicPlatform
+)
+
+source_group("src" FILES ${SOURCE})
+source_group("include" FILES ${INCLUDE})
+
+set_target_properties(LinuxPlatform PROPERTIES
+ FOLDER Core/Platforms
+)
diff --git a/Platforms/Linux/include/LinuxDebug.h b/Platforms/Linux/include/LinuxDebug.h
new file mode 100644
index 00000000..1c24f6d1
--- /dev/null
+++ b/Platforms/Linux/include/LinuxDebug.h
@@ -0,0 +1,32 @@
+/* Copyright 2015-2017 Egor Yusov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
+ *
+ * In no event and under no legal theory, whether in tort (including negligence),
+ * contract, or otherwise, unless required by applicable law (such as deliberate
+ * and grossly negligent acts) or agreed to in writing, shall any Contributor be
+ * liable for any damages, including any direct, indirect, special, incidental,
+ * or consequential damages of any character arising as a result of this License or
+ * out of the use or inability to use the software (including but not limited to damages
+ * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
+ * all other commercial damages or losses), even if such Contributor has been advised
+ * of the possibility of such damages.
+ */
+
+#pragma once
+
+#include "../Basic/include/BasicPlatformDebug.h"
+
+struct LinuxDebug : public BasicPlatformDebug
+{
+ static void AssertionFailed( const Diligent::Char *Message, const char *Function, const char *File, int Line );
+ static void OutputDebugMessage( DebugMessageSeverity Severity, const Diligent::Char *Message );
+};
diff --git a/Platforms/Linux/include/LinuxFileSystem.h b/Platforms/Linux/include/LinuxFileSystem.h
new file mode 100644
index 00000000..0fa33a54
--- /dev/null
+++ b/Platforms/Linux/include/LinuxFileSystem.h
@@ -0,0 +1,66 @@
+/* Copyright 2015-2017 Egor Yusov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
+ *
+ * In no event and under no legal theory, whether in tort (including negligence),
+ * contract, or otherwise, unless required by applicable law (such as deliberate
+ * and grossly negligent acts) or agreed to in writing, shall any Contributor be
+ * liable for any damages, including any direct, indirect, special, incidental,
+ * or consequential damages of any character arising as a result of this License or
+ * out of the use or inability to use the software (including but not limited to damages
+ * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
+ * all other commercial damages or losses), even if such Contributor has been advised
+ * of the possibility of such damages.
+ */
+
+#pragma once
+
+#include "../Basic/include/BasicFileSystem.h"
+
+#include <memory>
+#include <vector>
+
+class LinuxFile : public BasicFile
+{
+public:
+ LinuxFile( const FileOpenAttribs &OpenAttribs );
+ ~LinuxFile();
+
+ void Read( Diligent::IDataBlob *pData );
+
+ bool Read( void* Data, size_t BufferSize );
+
+ bool Write( const void *Data, size_t BufferSize );
+
+ size_t GetSize();
+
+ size_t GetPos();
+
+ void SetPos(size_t Offset, FilePosOrigin Origin);
+
+private:
+ //FILE *m_pFile;
+};
+
+struct LinuxFileSystem : public BasicFileSystem
+{
+public:
+ static LinuxFile* OpenFile( const FileOpenAttribs &OpenAttribs );
+ static inline Diligent::Char GetSlashSymbol(){ return '/'; }
+
+ static bool FileExists( const Diligent::Char *strFilePath );
+ static bool PathExists( const Diligent::Char *strPath );
+
+ static bool CreateDirectory( const Diligent::Char *strPath );
+ static void ClearDirectory( const Diligent::Char *strPath );
+ static void DeleteFile( const Diligent::Char *strPath );
+ static std::vector<std::unique_ptr<FindFileData>> Search(const Diligent::Char *SearchPattern);
+};
diff --git a/Platforms/Linux/include/LinuxPlatformDefinitions.h b/Platforms/Linux/include/LinuxPlatformDefinitions.h
new file mode 100644
index 00000000..454c7446
--- /dev/null
+++ b/Platforms/Linux/include/LinuxPlatformDefinitions.h
@@ -0,0 +1,30 @@
+/* Copyright 2015-2017 Egor Yusov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
+ *
+ * In no event and under no legal theory, whether in tort (including negligence),
+ * contract, or otherwise, unless required by applicable law (such as deliberate
+ * and grossly negligent acts) or agreed to in writing, shall any Contributor be
+ * liable for any damages, including any direct, indirect, special, incidental,
+ * or consequential damages of any character arising as a result of this License or
+ * out of the use or inability to use the software (including but not limited to damages
+ * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
+ * all other commercial damages or losses), even if such Contributor has been advised
+ * of the possibility of such damages.
+ */
+
+#pragma once
+
+#include <cstddef>
+
+template <typename _CountofType, std::size_t _SizeOfArray>
+char (*__countof_helper(_CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray];
+#define _countof(_Array) (sizeof(*__countof_helper(_Array)) + 0)
diff --git a/Platforms/Linux/include/LinuxPlatformMisc.h b/Platforms/Linux/include/LinuxPlatformMisc.h
new file mode 100644
index 00000000..a961f468
--- /dev/null
+++ b/Platforms/Linux/include/LinuxPlatformMisc.h
@@ -0,0 +1,43 @@
+/* Copyright 2015-2017 Egor Yusov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
+ *
+ * In no event and under no legal theory, whether in tort (including negligence),
+ * contract, or otherwise, unless required by applicable law (such as deliberate
+ * and grossly negligent acts) or agreed to in writing, shall any Contributor be
+ * liable for any damages, including any direct, indirect, special, incidental,
+ * or consequential damages of any character arising as a result of this License or
+ * out of the use or inability to use the software (including but not limited to damages
+ * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
+ * all other commercial damages or losses), even if such Contributor has been advised
+ * of the possibility of such damages.
+ */
+
+#pragma once
+
+#include "../Basic/include/BasicPlatformMisc.h"
+#include "DebugUtilities.h"
+
+struct LinuxMisc : public BasicPlatformMisc
+{
+ static Diligent::Uint32 GetMSB(Diligent::Uint32 Val)
+ {
+ if( Val == 0 )return 32;
+
+ // Returns the number of leading 0-bits in x, starting at the
+ // most significant bit position. If x is 0, the result is undefined.
+ auto LeadingZeros = __builtin_clz(Val);
+ auto MSB = 31 - LeadingZeros;
+ VERIFY_EXPR(MSB == BasicPlatformMisc::GetMSB(Val));
+
+ return MSB;
+ }
+};
diff --git a/Platforms/Linux/src/LinuxDebug.cpp b/Platforms/Linux/src/LinuxDebug.cpp
new file mode 100644
index 00000000..2ffb7a12
--- /dev/null
+++ b/Platforms/Linux/src/LinuxDebug.cpp
@@ -0,0 +1,50 @@
+/* Copyright 2015-2017 Egor Yusov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
+ *
+ * In no event and under no legal theory, whether in tort (including negligence),
+ * contract, or otherwise, unless required by applicable law (such as deliberate
+ * and grossly negligent acts) or agreed to in writing, shall any Contributor be
+ * liable for any damages, including any direct, indirect, special, incidental,
+ * or consequential damages of any character arising as a result of this License or
+ * out of the use or inability to use the software (including but not limited to damages
+ * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
+ * all other commercial damages or losses), even if such Contributor has been advised
+ * of the possibility of such damages.
+ */
+
+#include "LinuxDebug.h"
+#include "FormatMessage.h"
+#include "FileSystem.h"
+//#include <Linux/log.h>
+#include <csignal>
+#include <cassert>
+
+void LinuxDebug :: AssertionFailed( const Diligent::Char *Message, const char *Function, const char *File, int Line )
+{
+ assert(false);
+ //std::string FileName;
+ //FileSystem::SplitFilePath( File, nullptr, &FileName );
+ //std::stringstream msgss;
+ //Diligent::FormatMsg( msgss, "\nDebug assertion failed in ", Function, "(), file ", FileName, ", line ", Line, ":\n", Message);
+ //auto FullMsg = msgss.str();
+ //OutputDebugMessage( DebugMessageSeverity::Error, FullMsg.c_str() );
+
+ //raise( SIGTRAP );
+};
+
+
+void LinuxDebug::OutputDebugMessage( DebugMessageSeverity Severity, const Diligent::Char *Message )
+{
+ assert(false);
+ //static const Linux_LogPriority Priorities[] = { Linux_LOG_INFO, Linux_LOG_WARN, Linux_LOG_ERROR, Linux_LOG_FATAL };
+ //__Linux_log_print( Priorities[static_cast<int>(Severity)], "Graphics Engine", "%s", Message );
+}
diff --git a/Platforms/Linux/src/LinuxFileSystem.cpp b/Platforms/Linux/src/LinuxFileSystem.cpp
new file mode 100644
index 00000000..2ac59630
--- /dev/null
+++ b/Platforms/Linux/src/LinuxFileSystem.cpp
@@ -0,0 +1,190 @@
+/* Copyright 2015-2017 Egor Yusov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
+ *
+ * In no event and under no legal theory, whether in tort (including negligence),
+ * contract, or otherwise, unless required by applicable law (such as deliberate
+ * and grossly negligent acts) or agreed to in writing, shall any Contributor be
+ * liable for any damages, including any direct, indirect, special, incidental,
+ * or consequential damages of any character arising as a result of this License or
+ * out of the use or inability to use the software (including but not limited to damages
+ * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
+ * all other commercial damages or losses), even if such Contributor has been advised
+ * of the possibility of such damages.
+ */
+
+#include "LinuxFileSystem.h"
+#include "Errors.h"
+#include "DebugUtilities.h"
+
+LinuxFile::LinuxFile( const FileOpenAttribs &OpenAttribs ) :
+ BasicFile(OpenAttribs, LinuxFileSystem::GetSlashSymbol())/*,
+ m_pFile(nullptr)*/
+{
+ //auto OpenModeStr = GetOpenModeStr();
+
+ //for (;; )
+ //{
+ // errno_t err = fopen_s(&m_pFile, m_OpenAttribs.strFilePath, OpenModeStr.c_str());
+ // if (err == 0)
+ // {
+ // break;
+ // }
+ // else if (err == ENFILE || // Too many files open in system
+ // err == EMFILE) // Too many open files
+ // {
+ // // No more file descriptors are available: we have to wait
+ // //g_SystemMetricsStream << "Failed to open file " << FileName;
+ // //g_SystemMetricsStream << "\nWaiting 50 ms...\n";
+ // //Sleep(50);
+ // continue;
+ // }
+ // else
+ // {
+ // char errstr[128];
+ // strerror_s(errstr, _countof(errstr), err);
+ // LOG_ERROR_AND_THROW("Failed to open file ", m_OpenAttribs.strFilePath,
+ // "\nThe following error occured: ", errstr);
+ // }
+ //}
+}
+
+LinuxFile::~LinuxFile()
+{
+ //if( m_pFile )
+ //{
+ // fclose( m_pFile );
+ // m_pFile = nullptr;
+ //}
+}
+
+void LinuxFile::Read( Diligent::IDataBlob *pData )
+{
+#if 0
+ auto FullPath = m_OpenAttribs.strFilePath;
+ std::vector<Diligent::Uint8> Data;
+ bool b = JNIHelper::GetInstance()->ReadFile( FullPath, &Data );
+ if( b )
+ {
+ pData->Resize( Data.size() );
+ memcpy( pData->GetDataPtr(), Data.data(), Data.size() );
+ }
+ else
+ {
+ LOG_ERROR_MESSAGE( "Unable to open file ", m_OpenAttribs.strFilePath, "\nFull path: ", FullPath );
+ }
+#endif
+ UNSUPPORTED("Not implemented")
+}
+
+size_t LinuxFile::GetSize()
+{
+ UNSUPPORTED( "Not implemented" );
+
+ return 0;
+}
+
+bool LinuxFile::Read( void *Data, size_t BufferSize )
+{
+ UNSUPPORTED( "Not implemented" );
+
+ //VERIFY( m_pFile, "File not opened" );
+ //auto OrigPos = ftell( m_pFile );
+ //fseek( m_pFile, 0, SEEK_END );
+ //auto FileSize = ftell( m_pFile );
+ //fseek( m_pFile, 0, SEEK_SET );
+ //Data.resize( FileSize );
+ //auto ItemsRead = fread( Data.data(), FileSize, 1, m_pFile );
+ //fseek( m_pFile, OrigPos, SEEK_SET );
+ //return ItemsRead == 1;
+ return false;
+}
+
+bool LinuxFile::Write( const void *Data, size_t BufferSize )
+{
+ UNSUPPORTED( "Not implemented" );
+
+ return false;
+}
+
+size_t LinuxFile::GetPos()
+{
+ UNSUPPORTED( "Not implemented" );
+
+ return 0;
+}
+
+void LinuxFile::SetPos(size_t Offset, FilePosOrigin Origin)
+{
+ UNSUPPORTED( "Not implemented" );
+}
+
+
+LinuxFile* LinuxFileSystem::OpenFile( const FileOpenAttribs &OpenAttribs )
+{
+ LinuxFile *pFile = nullptr;
+#if 0
+ try
+ {
+ pFile = new LinuxFile( OpenAttribs );
+ }
+ catch( const std::runtime_error &err )
+ {
+
+ }
+#endif
+ UNSUPPORTED("Not implemented")
+ return pFile;
+}
+
+
+bool LinuxFileSystem::FileExists( const Diligent::Char *strFilePath )
+{
+#if 0
+ FileOpenAttribs OpenAttribs;
+ OpenAttribs.strFilePath = strFilePath;
+ BasicFile DummyFile( OpenAttribs, LinuxFileSystem::GetSlashSymbol() );
+ const auto& Path = DummyFile.GetPath();
+ std::vector<Diligent::Uint8> Data;
+ bool b = JNIHelper::GetInstance()->ReadFile( Path.c_str(), &Data );
+ return b;
+#endif
+ UNSUPPORTED("Not implemented")
+ return false;
+}
+
+bool LinuxFileSystem::PathExists( const Diligent::Char *strPath )
+{
+ UNSUPPORTED( "Not implemented" );
+ return false;
+}
+
+bool LinuxFileSystem::CreateDirectory( const Diligent::Char *strPath )
+{
+ UNSUPPORTED( "Not implemented" );
+ return false;
+}
+
+void LinuxFileSystem::ClearDirectory( const Diligent::Char *strPath )
+{
+ UNSUPPORTED( "Not implemented" );
+}
+
+void LinuxFileSystem::DeleteFile( const Diligent::Char *strPath )
+{
+ UNSUPPORTED( "Not implemented" );
+}
+
+std::vector<std::unique_ptr<FindFileData>> LinuxFileSystem::Search(const Diligent::Char *SearchPattern)
+{
+ UNSUPPORTED( "Not implemented" );
+ return std::vector<std::unique_ptr<FindFileData>>();
+}
diff --git a/Platforms/interface/FileSystem.h b/Platforms/interface/FileSystem.h
index 91f20e58..f9ce26f3 100644
--- a/Platforms/interface/FileSystem.h
+++ b/Platforms/interface/FileSystem.h
@@ -42,4 +42,13 @@
#include "../Android/include/AndroidFileSystem.h"
typedef AndroidFileSystem FileSystem;
typedef AndroidFile CFile;
+
+#elif defined ( PLATFORM_LINUX )
+
+ #include "../Linux/include/LinuxFileSystem.h"
+ typedef LinuxFileSystem FileSystem;
+ typedef LinuxFile CFile;
+
+#elif
+ #error Unsupported platform
#endif
diff --git a/Platforms/interface/PlatformDebug.h b/Platforms/interface/PlatformDebug.h
index 994f6849..0e00e76c 100644
--- a/Platforms/interface/PlatformDebug.h
+++ b/Platforms/interface/PlatformDebug.h
@@ -36,4 +36,11 @@
#elif defined ( PLATFORM_ANDROID )
#include "../Android/include/AndroidDebug.h"
typedef AndroidDebug PlatformDebug;
+
+#elif defined ( PLATFORM_LINUX )
+ #include "../Linux/include/LinuxDebug.h"
+ typedef LinuxDebug PlatformDebug;
+
+#else
+ #error Unsupported platform
#endif
diff --git a/Platforms/interface/PlatformDefinitions.h b/Platforms/interface/PlatformDefinitions.h
index 6d1adcec..3f8638e2 100644
--- a/Platforms/interface/PlatformDefinitions.h
+++ b/Platforms/interface/PlatformDefinitions.h
@@ -24,18 +24,21 @@
#pragma once
#if defined(ANDROID)
-# if defined (PLATFORM_UNIVERSAL_WINDOWS) || defined (PLATFORM_WIN32)
-# error Conflicting platform macros
-# endif
# ifndef PLATFORM_ANDROID
# define PLATFORM_ANDROID
# endif
-#elif !defined (PLATFORM_UNIVERSAL_WINDOWS) && !defined (PLATFORM_WIN32)
+#endif
+
+#if !defined(PLATFORM_WIN32) && !defined(PLATFORM_UNIVERSAL_WINDOWS) && !defined(PLATFORM_ANDROID) && !defined(PLATFORM_LINUX)
#error Platform is not defined
#endif
#if defined( PLATFORM_WIN32 )
+# if defined(PLATFORM_UNIVERSAL_WINDOWS) || defined(PLATFORM_ANDROID) || defined(PLATFORM_LINUX)
+# error Conflicting platform macros
+# endif
+
# include "..\Win32\include\Win32PlatformDefinitions.h"
# define OPENGL_SUPPORTED 1
@@ -44,13 +47,21 @@
#elif defined( PLATFORM_UNIVERSAL_WINDOWS )
+# if defined(PLATFORM_WIN32) || defined(PLATFORM_ANDROID) || defined(PLATFORM_LINUX)
+# error Conflicting platform macros
+# endif
+
# include "..\UWP\include\UWPDefinitions.h"
# define OPENGL_SUPPORTED 0
# define D3D11_SUPPORTED 1
# define D3D12_SUPPORTED 1
-#elif defined ( PLATFORM_ANDROID )
+#elif defined( PLATFORM_ANDROID )
+
+# if defined (PLATFORM_WIN32) || defined(PLATFORM_UNIVERSAL_WINDOWS) || defined (PLATFORM_LINUX)
+# error Conflicting platform macros
+# endif
# include "../Android/include/AndroidPlatformDefinitions.h"
@@ -58,4 +69,16 @@
# define D3D11_SUPPORTED 0
# define D3D12_SUPPORTED 0
+#elif defined( PLATFORM_LINUX )
+
+# if defined(PLATFORM_WIN32) || defined(PLATFORM_UNIVERSAL_WINDOWS) || defined(PLATFORM_ANDROID)
+# error Conflicting platform macros
+# endif
+
+# include "../Linux/include/LinuxPlatformDefinitions.h"
+
+# define OPENGL_SUPPORTED 1
+# define D3D11_SUPPORTED 0
+# define D3D12_SUPPORTED 0
+
#endif
diff --git a/Platforms/interface/PlatformMisc.h b/Platforms/interface/PlatformMisc.h
index fbcbcff6..b4d10aaa 100644
--- a/Platforms/interface/PlatformMisc.h
+++ b/Platforms/interface/PlatformMisc.h
@@ -32,4 +32,10 @@
#elif defined ( PLATFORM_ANDROID )
#include "../Android/include/AndroidPlatformMisc.h"
typedef AndroidMisc PlatformMisc;
+
+#elif defined ( PLATFORM_LINUX )
+ #include "../Linux/include/LinuxPlatformMisc.h"
+ typedef LinuxMisc PlatformMisc;
+#else
+ #error Unsupported platform
#endif