Parcourir la source

Merge pull request #20 from almightykiwi/linux

Linux
Marko Pintera il y a 9 ans
Parent
commit
66ea05a80e

+ 1 - 1
Source/BansheeGLRenderAPI/CMakeLists.txt

@@ -9,7 +9,7 @@ set(BansheeGLRenderAPI_INC
 	"Source/GLSL/include")
 	"Source/GLSL/include")
 
 
 if(WIN32)
 if(WIN32)
-	set(BansheeGLRenderAPI_INC ${BansheeGLRenderAPI_INC} "Source/win32")
+	set(BansheeGLRenderAPI_INC ${BansheeGLRenderAPI_INC} "Source/Win32")
 else()
 else()
 # TODO_OTHER_PLATFORMS_GO_HERE
 # TODO_OTHER_PLATFORMS_GO_HERE
 endif()
 endif()

+ 4 - 4
Source/BansheeGLRenderAPI/CMakeSources.cmake

@@ -33,10 +33,10 @@ set(BS_BANSHEEGLRENDERAPI_INC_NOFILTER
 )
 )
 
 
 set(BS_BANSHEEGLRENDERAPI_SRC_WIN32
 set(BS_BANSHEEGLRENDERAPI_SRC_WIN32
-	"Source/win32/BsWin32Context.cpp"
-	"Source/win32/BsWin32GLSupport.cpp"
-	"Source/win32/BsWin32RenderWindow.cpp"
-	"Source/win32/BsWin32VideoModeInfo.cpp"
+	"Source/Win32/BsWin32Context.cpp"
+	"Source/Win32/BsWin32GLSupport.cpp"
+	"Source/Win32/BsWin32RenderWindow.cpp"
+	"Source/Win32/BsWin32VideoModeInfo.cpp"
 )
 )
 
 
 set(BS_BANSHEEGLRENDERAPI_SRC_NOFILTER
 set(BS_BANSHEEGLRENDERAPI_SRC_NOFILTER

+ 0 - 0
Source/BansheeGLRenderAPI/Source/win32/BsWin32Context.cpp → Source/BansheeGLRenderAPI/Source/Win32/BsWin32Context.cpp


+ 0 - 0
Source/BansheeGLRenderAPI/Source/win32/BsWin32GLSupport.cpp → Source/BansheeGLRenderAPI/Source/Win32/BsWin32GLSupport.cpp


+ 0 - 0
Source/BansheeGLRenderAPI/Source/win32/BsWin32RenderWindow.cpp → Source/BansheeGLRenderAPI/Source/Win32/BsWin32RenderWindow.cpp


+ 0 - 0
Source/BansheeGLRenderAPI/Source/win32/BsWin32VideoModeInfo.cpp → Source/BansheeGLRenderAPI/Source/Win32/BsWin32VideoModeInfo.cpp


+ 5 - 2
Source/BansheeUtility/CMakeSources.cmake

@@ -273,7 +273,6 @@ set(BS_BANSHEEUTILITY_SRC
 	${BS_BANSHEEUTILITY_INC_THREADING}
 	${BS_BANSHEEUTILITY_INC_THREADING}
 	${BS_BANSHEEUTILITY_SRC_THIRDPARTY}
 	${BS_BANSHEEUTILITY_SRC_THIRDPARTY}
 	${BS_BANSHEEUTILITY_INC_PREREQUISITES}
 	${BS_BANSHEEUTILITY_INC_PREREQUISITES}
-	${BS_BANSHEEUTILITY_SRC_WIN32}
 	${BS_BANSHEEUTILITY_INC_IMAGE}
 	${BS_BANSHEEUTILITY_INC_IMAGE}
 	${BS_BANSHEEUTILITY_INC_STRING}
 	${BS_BANSHEEUTILITY_INC_STRING}
 	${BS_BANSHEEUTILITY_SRC_IMAGE}
 	${BS_BANSHEEUTILITY_SRC_IMAGE}
@@ -299,5 +298,9 @@ set(BS_BANSHEEUTILITY_SRC
 	${BS_BANSHEEUTILITY_INC_SERIALIZATION}
 	${BS_BANSHEEUTILITY_INC_SERIALIZATION}
 	${BS_BANSHEEUTILITY_SRC_STRING}
 	${BS_BANSHEEUTILITY_SRC_STRING}
 	${BS_BANSHEEUTILITY_INC_REFLECTION}
 	${BS_BANSHEEUTILITY_INC_REFLECTION}
-	${BS_BANSHEEUTILITY_INC_WIN32}
 )
 )
+
+if(WIN32)
+	list(APPEND BS_BANSHEEUTILITY_SRC ${BS_BANSHEEUTILITY_SRC_WIN32})
+	list(APPEND BS_BANSHEEUTILITY_SRC ${BS_BANSHEEUTILITY_INC_WIN32})
+endif()

+ 314 - 0
Source/BansheeUtility/CMakeSources.cmake.orig

@@ -0,0 +1,314 @@
+set(BS_BANSHEEUTILITY_INC_THREADING
+	"Include/BsThreadDefines.h"
+	"Include/BsAsyncOp.h"
+	"Include/BsSpinLock.h"
+	"Include/BsThreadPool.h"
+	"Include/BsTaskScheduler.h"
+)
+
+set(BS_BANSHEEUTILITY_SRC_THIRDPARTY
+	"Source/ThirdParty/md5.cpp"
+)
+
+set(BS_BANSHEEUTILITY_INC_PREREQUISITES
+	"Include/BsTypes.h"
+	"Include/BsStdHeaders.h"
+	"Include/BsPrerequisitesUtil.h"
+	"Include/BsPlatformDefines.h"
+	"Include/BsFwdDeclUtil.h"
+	"Include/BsRTTIPrerequisites.h"
+)
+
+set(BS_BANSHEEUTILITY_SRC_WIN32
+	"Source/Win32/BsWin32FileSystem.cpp"
+	"Source/Win32/BsWin32CrashHandler.cpp"
+	"Source/Win32/BsWin32PlatformUtility.cpp"
+	"Source/Win32/BsWin32Window.cpp"
+)
+
+set(BS_BANSHEEUTILITY_INC_IMAGE
+	"Include/BsColor.h"
+	"Include/BsTexAtlasGenerator.h"
+)
+
+set(BS_BANSHEEUTILITY_INC_STRING
+	"Include/BsString.h"
+	"Include/BsStringFormat.h"
+	"Include/BsStringID.h"
+)
+
+set(BS_BANSHEEUTILITY_SRC_IMAGE
+	"Source/BsColor.cpp"
+	"Source/BsTexAtlasGenerator.cpp"
+)
+
+set(BS_BANSHEEUTILITY_SRC_GENERAL
+	"Source/BsDynLib.cpp"
+	"Source/BsDynLibManager.cpp"
+	"Source/BsMessageHandler.cpp"
+	"Source/BsTimer.cpp"
+	"Source/BsTime.cpp"
+	"Source/BsUtil.cpp"
+)
+
+set(BS_BANSHEEUTILITY_INC_DEBUG
+	"Include/BsBitmapWriter.h"
+	"Include/BsDebug.h"
+	"Include/BsLog.h"
+)
+
+set(BS_BANSHEEUTILITY_INC_FILESYSTEM
+	"Include/BsFileSystem.h"
+	"Include/BsDataStream.h"
+	"Include/BsPath.h"
+)
+
+set(BS_BANSHEEUTILITY_SRC_FILESYSTEM
+	"Source/BsDataStream.cpp"
+	"Source/BsPath.cpp"
+)
+
+set(BS_BANSHEEUTILITY_SRC_THREADING
+	"Source/BsAsyncOp.cpp"
+	"Source/BsTaskScheduler.cpp"
+	"Source/BsThreadPool.cpp"
+)
+
+set(BS_BANSHEEUTILITY_INC_GENERAL
+	"Include/BsAny.h"
+	"Include/BsBitwise.h"
+	"Include/BsDynLib.h"
+	"Include/BsDynLibManager.h"
+	"Include/BsEvent.h"
+	"Include/BsMessageHandler.h"
+	"Include/BsMessageHandlerFwd.h"
+	"Include/BsModule.h"
+	"Include/BsPlatformUtility.h"
+	"Include/BsServiceLocator.h"
+	"Include/BsTime.h"
+	"Include/BsTimer.h"
+	"Include/BsUtil.h"
+	"Include/BsFlags.h"
+)
+
+set(BS_BANSHEEUTILITY_SRC_ALLOCATORS
+	"Source/BsFrameAlloc.cpp"
+	"Source/BsGlobalFrameAlloc.cpp"
+	"Source/BsMemStack.cpp"
+	"Source/BsMemoryAllocator.cpp"
+)
+
+set(BS_BANSHEEUTILITY_SRC_RTTI
+	"Source/BsIReflectable.cpp"
+	"Source/BsRTTIField.cpp"
+	"Source/BsRTTIType.cpp"
+)
+
+set(BS_BANSHEEUTILITY_SRC_DEBUG
+	"Source/BsBitmapWriter.cpp"
+	"Source/BsLog.cpp"
+	"Source/BsDebug.cpp"
+)
+
+set(BS_BANSHEEUTILITY_INC_RTTI
+	"Include/BsSerializedObjectRTTI.h"
+)
+
+set(BS_BANSHEEUTILITY_INC_ALLOCATORS
+	"Include/BsFrameAlloc.h"
+	"Include/BsGlobalFrameAlloc.h"
+	"Include/BsMemAllocProfiler.h"
+	"Include/BsMemoryAllocator.h"
+	"Include/BsMemStack.h"
+	"Include/BsStaticAlloc.h"
+)
+
+set(BS_BANSHEEUTILITY_INC_THIRDPARTY
+	"Include/ThirdParty/md5.h"
+)
+
+set(BS_BANSHEEUTILITY_INC_ERROR
+	"Include/BsException.h"
+	"Include/BsCrashHandler.h"
+)
+
+set(BS_BANSHEEUTILITY_SRC_MATH
+	"Source/BsAABox.cpp"
+	"Source/BsDegree.cpp"
+	"Source/BsMath.cpp"
+	"Source/BsMatrix3.cpp"
+	"Source/BsMatrix4.cpp"
+	"Source/BsPlane.cpp"
+	"Source/BsQuaternion.cpp"
+	"Source/BsRadian.cpp"
+	"Source/BsRay.cpp"
+	"Source/BsSphere.cpp"
+	"Source/BsVector2.cpp"
+	"Source/BsVector2I.cpp"
+	"Source/BsVector3.cpp"
+	"Source/BsVector4.cpp"
+	"Source/BsBounds.cpp"
+	"Source/BsConvexVolume.cpp"
+	"Source/BsTorus.cpp"
+	"Source/BsRect3.cpp"
+	"Source/BsRect2.cpp"
+	"Source/BsRect2I.cpp"
+	"Source/BsLineSegment3.cpp"
+	"Source/BsCapsule.cpp"
+)
+
+set(BS_BANSHEEUTILITY_INC_TESTING
+	"Include/BsTestSuite.h"
+	"Include/BsTestOutput.h"
+)
+
+set(BS_BANSHEEUTILITY_SRC_TESTING
+	"Source/BsTestSuite.cpp"
+	"Source/BsTestOutput.cpp"
+)
+
+set(BS_BANSHEEUTILITY_SRC_SERIALIZATION
+	"Source/BsMemorySerializer.cpp"
+	"Source/BsFileSerializer.cpp"
+	"Source/BsBinarySerializer.cpp"
+	"Source/BsBinaryDiff.cpp"
+	"Source/BsSerializedObject.cpp"
+	"Source/BsBinaryCloner.cpp"
+	"Source/BsManagedDataBlock.cpp"
+)
+
+set(BS_BANSHEEUTILITY_INC_MATH
+	"Include/BsAABox.h"
+	"Include/BsDegree.h"
+	"Include/BsMath.h"
+	"Include/BsMatrix3.h"
+	"Include/BsMatrix4.h"
+	"Include/BsPlane.h"
+	"Include/BsQuaternion.h"
+	"Include/BsRadian.h"
+	"Include/BsRay.h"
+	"Include/BsSphere.h"
+	"Include/BsVector2.h"
+	"Include/BsVector2I.h"
+	"Include/BsVector3.h"
+	"Include/BsVector4.h"
+	"Include/BsBounds.h"
+	"Include/BsConvexVolume.h"
+	"Include/BsTorus.h"
+	"Include/BsLineSegment3.h"
+	"Include/BsRect3.h"
+	"Include/BsRect2.h"
+	"Include/BsRect2I.h"
+	"Include/BsCapsule.h"
+	"Include/BsMatrixNxM.h"
+	"Include/BsVectorNI.h"
+)
+
+set(BS_BANSHEEUTILITY_SRC_ERROR
+	"Source/BsException.cpp"
+)
+
+set(BS_BANSHEEUTILITY_INC_SERIALIZATION
+	"Include/BsBinarySerializer.h"
+	"Include/BsFileSerializer.h"
+	"Include/BsMemorySerializer.h"
+	"Include/BsBinaryDiff.h"
+	"Include/BsSerializedObject.h"
+	"Include/BsBinaryCloner.h"
+	"Include/BsManagedDataBlock.h"
+)
+
+set(BS_BANSHEEUTILITY_SRC_STRING
+	"Source/BsStringID.cpp"
+	"Source/BsString.cpp"
+)
+
+set(BS_BANSHEEUTILITY_INC_REFLECTION
+	"Include/BsIReflectable.h"
+	"Include/BsRTTIField.h"
+	"Include/BsRTTIManagedDataBlockField.h"
+	"Include/BsRTTIPlainField.h"
+	"Include/BsRTTIReflectableField.h"
+	"Include/BsRTTIReflectablePtrField.h"
+	"Include/BsRTTIType.h"
+)
+
+set(BS_BANSHEEUTILITY_INC_WIN32
+	"Include/Win32/BsWin32PlatformUtility.h"
+	"Include/Win32/BsWin32Window.h"
+)
+
+source_group("Header Files\\Threading" FILES ${BS_BANSHEEUTILITY_INC_THREADING})
+source_group("Source Files\\ThirdParty" FILES ${BS_BANSHEEUTILITY_SRC_THIRDPARTY})
+source_group("Header Files\\Prerequisites" FILES ${BS_BANSHEEUTILITY_INC_PREREQUISITES})
+source_group("Source Files\\Win32" FILES ${BS_BANSHEEUTILITY_SRC_WIN32})
+source_group("Header Files\\Image" FILES ${BS_BANSHEEUTILITY_INC_IMAGE})
+source_group("Header Files\\String" FILES ${BS_BANSHEEUTILITY_INC_STRING})
+source_group("Source Files\\Image" FILES ${BS_BANSHEEUTILITY_SRC_IMAGE})
+source_group("Source Files\\General" FILES ${BS_BANSHEEUTILITY_SRC_GENERAL})
+source_group("Header Files\\Debug" FILES ${BS_BANSHEEUTILITY_INC_DEBUG})
+source_group("Header Files\\Filesystem" FILES ${BS_BANSHEEUTILITY_INC_FILESYSTEM})
+source_group("Source Files\\Filesystem" FILES ${BS_BANSHEEUTILITY_SRC_FILESYSTEM})
+source_group("Source Files\\Threading" FILES ${BS_BANSHEEUTILITY_SRC_THREADING})
+source_group("Header Files\\General" FILES ${BS_BANSHEEUTILITY_INC_GENERAL})
+source_group("Source Files\\Allocators" FILES ${BS_BANSHEEUTILITY_SRC_ALLOCATORS})
+source_group("Source Files\\RTTI" FILES ${BS_BANSHEEUTILITY_SRC_RTTI})
+source_group("Source Files\\Debug" FILES ${BS_BANSHEEUTILITY_SRC_DEBUG})
+source_group("Header Files\\RTTI" FILES ${BS_BANSHEEUTILITY_INC_RTTI})
+source_group("Header Files\\Allocators" FILES ${BS_BANSHEEUTILITY_INC_ALLOCATORS})
+source_group("Header Files\\ThirdParty" FILES ${BS_BANSHEEUTILITY_INC_THIRDPARTY})
+source_group("Header Files\\Error" FILES ${BS_BANSHEEUTILITY_INC_ERROR})
+source_group("Source Files\\Math" FILES ${BS_BANSHEEUTILITY_SRC_MATH})
+source_group("Header Files\\Testing" FILES ${BS_BANSHEEUTILITY_INC_TESTING})
+source_group("Source Files\\Testing" FILES ${BS_BANSHEEUTILITY_SRC_TESTING})
+source_group("Source Files\\Serialization" FILES ${BS_BANSHEEUTILITY_SRC_SERIALIZATION})
+source_group("Header Files\\Math" FILES ${BS_BANSHEEUTILITY_INC_MATH})
+source_group("Source Files\\Error" FILES ${BS_BANSHEEUTILITY_SRC_ERROR})
+source_group("Header Files\\Serialization" FILES ${BS_BANSHEEUTILITY_INC_SERIALIZATION})
+source_group("Source Files\\String" FILES ${BS_BANSHEEUTILITY_SRC_STRING})
+source_group("Header Files\\Reflection" FILES ${BS_BANSHEEUTILITY_INC_REFLECTION})
+source_group("Header Files\\Win32" FILES ${BS_BANSHEEUTILITY_INC_WIN32})
+
+set(BS_BANSHEEUTILITY_SRC
+	${BS_BANSHEEUTILITY_INC_THREADING}
+	${BS_BANSHEEUTILITY_SRC_THIRDPARTY}
+	${BS_BANSHEEUTILITY_INC_PREREQUISITES}
+	${BS_BANSHEEUTILITY_INC_IMAGE}
+	${BS_BANSHEEUTILITY_INC_STRING}
+	${BS_BANSHEEUTILITY_SRC_IMAGE}
+	${BS_BANSHEEUTILITY_SRC_GENERAL}
+	${BS_BANSHEEUTILITY_INC_DEBUG}
+	${BS_BANSHEEUTILITY_INC_FILESYSTEM}
+	${BS_BANSHEEUTILITY_SRC_FILESYSTEM}
+	${BS_BANSHEEUTILITY_SRC_THREADING}
+	${BS_BANSHEEUTILITY_INC_GENERAL}
+	${BS_BANSHEEUTILITY_SRC_ALLOCATORS}
+	${BS_BANSHEEUTILITY_SRC_RTTI}
+	${BS_BANSHEEUTILITY_SRC_DEBUG}
+	${BS_BANSHEEUTILITY_INC_RTTI}
+	${BS_BANSHEEUTILITY_INC_ALLOCATORS}
+	${BS_BANSHEEUTILITY_INC_THIRDPARTY}
+	${BS_BANSHEEUTILITY_INC_ERROR}
+	${BS_BANSHEEUTILITY_SRC_MATH}
+	${BS_BANSHEEUTILITY_INC_TESTING}
+	${BS_BANSHEEUTILITY_SRC_TESTING}
+	${BS_BANSHEEUTILITY_SRC_SERIALIZATION}
+	${BS_BANSHEEUTILITY_INC_MATH}
+	${BS_BANSHEEUTILITY_SRC_ERROR}
+	${BS_BANSHEEUTILITY_INC_SERIALIZATION}
+	${BS_BANSHEEUTILITY_SRC_STRING}
+	${BS_BANSHEEUTILITY_INC_REFLECTION}
+<<<<<<< HEAD
+	${BS_BANSHEEUTILITY_INC_WIN32}
+)
+||||||| merged common ancestors
+	${BS_BANSHEEUTILITY_INC_WIN32}
+)
+=======
+)
+
+if(WIN32)
+	list(APPEND BS_BANSHEEUTILITY_SRC ${BS_BANSHEEUTILITY_SRC_WIN32})
+	list(APPEND BS_BANSHEEUTILITY_SRC ${BS_BANSHEEUTILITY_INC_WIN32})
+endif()
+>>>>>>> cmake: Append Windows-specific source files only on Windows

+ 5 - 2
Source/BansheeUtility/Include/BsColor.h

@@ -266,9 +266,11 @@ namespace BansheeEngine
 
 
 /** @cond SPECIALIZATIONS */
 /** @cond SPECIALIZATIONS */
 
 
+namespace std
+{
 /** Hash value generator for Color. */
 /** Hash value generator for Color. */
 template<> 
 template<> 
-struct std::hash<BansheeEngine::Color>
+struct hash<BansheeEngine::Color>
 {
 {
 	size_t operator()(const BansheeEngine::Color& color) const
 	size_t operator()(const BansheeEngine::Color& color) const
 	{
 	{
@@ -281,5 +283,6 @@ struct std::hash<BansheeEngine::Color>
 		return hash;
 		return hash;
 	}
 	}
 };
 };
+}
 
 
-/** @endcond */
+/** @endcond */

+ 4 - 1
Source/BansheeUtility/Include/BsDynLib.h

@@ -39,6 +39,9 @@ namespace BansheeEngine
 	class BS_UTILITY_EXPORT DynLib
 	class BS_UTILITY_EXPORT DynLib
     {
     {
     public:
     public:
+		/** System-specific file extension for a dynamic library (e.g. "dll"). */
+		static const String extension;
+
 		/** Constructs the dynamic library object and loads the library with the specified name. */
 		/** Constructs the dynamic library object and loads the library with the specified name. */
 		DynLib(const String& name);
 		DynLib(const String& name);
         ~DynLib();
         ~DynLib();
@@ -72,4 +75,4 @@ namespace BansheeEngine
     };
     };
 
 
 	/** @} */
 	/** @} */
-}
+}

+ 1 - 1
Source/BansheeUtility/Include/BsException.h

@@ -88,7 +88,7 @@ namespace BansheeEngine
 		virtual const String& getDescription(void) const { return mDescription; }
 		virtual const String& getDescription(void) const { return mDescription; }
 
 
 		/** Overriden std::exception::what. Returns the same value as getFullDescription(). */
 		/** Overriden std::exception::what. Returns the same value as getFullDescription(). */
-		const char* what() const override { return getFullDescription().c_str(); }
+		const char* what() const noexcept override { return getFullDescription().c_str(); }
 
 
 	protected:
 	protected:
 		long mLine;
 		long mLine;

+ 2 - 2
Source/BansheeUtility/Include/BsFlags.h

@@ -162,7 +162,7 @@ namespace BansheeEngine
 
 
 		Flags<Enum, Storage>& operator^= (const Flags<Enum, Storage>& rhs)
 		Flags<Enum, Storage>& operator^= (const Flags<Enum, Storage>& rhs)
 		{
 		{
-			mBits ^= f.mBits;
+			mBits ^= rhs.mBits;
 
 
 			return *this;
 			return *this;
 		}
 		}
@@ -232,4 +232,4 @@ namespace BansheeEngine
 		inline Flags<Enum, Storage> operator~(Enum a) { return ~Flags<Enum, Storage>(a); }
 		inline Flags<Enum, Storage> operator~(Enum a) { return ~Flags<Enum, Storage>(a); }
 
 
 	 /** @} */
 	 /** @} */
-}
+}

+ 9 - 3
Source/BansheeUtility/Include/BsMemStack.h

@@ -262,7 +262,10 @@ namespace BansheeEngine
 	 */
 	 */
 
 
 	/** @copydoc MemStackInternal::alloc() */
 	/** @copydoc MemStackInternal::alloc() */
-	BS_UTILITY_EXPORT inline void* bs_stack_alloc(UINT32 amount);
+	BS_UTILITY_EXPORT inline void* bs_stack_alloc(UINT32 amount)
+	{
+		return (void*)MemStack::alloc(amount);
+	}
 
 
 	/**
 	/**
 	 * Allocates enough memory to hold the specified type, on the stack, but does not initialize the object. 
 	 * Allocates enough memory to hold the specified type, on the stack, but does not initialize the object. 
@@ -348,7 +351,10 @@ namespace BansheeEngine
 	}
 	}
 
 
 	/** @copydoc MemStackInternal::dealloc() */
 	/** @copydoc MemStackInternal::dealloc() */
-	BS_UTILITY_EXPORT inline void bs_stack_free(void* data);
+	BS_UTILITY_EXPORT inline void bs_stack_free(void* data)
+	{
+		return MemStack::deallocLast((UINT8*)data);
+	}
 
 
 	/** @} */
 	/** @} */
 	/** @addtogroup Internal-Utility
 	/** @addtogroup Internal-Utility
@@ -390,4 +396,4 @@ namespace BansheeEngine
 
 
 	/** @} */
 	/** @} */
 	/** @} */
 	/** @} */
-}
+}

+ 6 - 1
Source/BansheeUtility/Include/BsMemoryAllocator.h

@@ -6,6 +6,11 @@
 #undef max
 #undef max
 
 
 #include <atomic>
 #include <atomic>
+#include <utility>
+
+#if BS_PLATFORM == BS_PLATFORM_LINUX
+#  include <malloc.h>
+#endif
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
@@ -412,4 +417,4 @@ namespace BansheeEngine
 
 
 #include "BsMemStack.h"
 #include "BsMemStack.h"
 #include "BsGlobalFrameAlloc.h"
 #include "BsGlobalFrameAlloc.h"
-#include "BsMemAllocProfiler.h"
+#include "BsMemAllocProfiler.h"

+ 5 - 2
Source/BansheeUtility/Include/BsPath.h

@@ -617,9 +617,11 @@ namespace BansheeEngine
 
 
 /** @cond STDLIB */
 /** @cond STDLIB */
 
 
+namespace std
+{
 /** Hash value generator for Path. */
 /** Hash value generator for Path. */
 template<>
 template<>
-struct std::hash<BansheeEngine::Path>
+struct hash<BansheeEngine::Path>
 {
 {
 	size_t operator()(const BansheeEngine::Path& path) const
 	size_t operator()(const BansheeEngine::Path& path) const
 	{
 	{
@@ -634,5 +636,6 @@ struct std::hash<BansheeEngine::Path>
 		return hash;
 		return hash;
 	}
 	}
 };
 };
+}
 
 
-/** @endcond */
+/** @endcond */

+ 50 - 50
Source/BansheeUtility/Include/BsRTTIPrerequisites.h

@@ -12,6 +12,55 @@ namespace BansheeEngine
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
+	/**
+	 * Template that you may specialize with a class if you want to provide simple serialization for it.
+	 *
+	 * Any type that uses the "plain" field in the RTTI system must specialize this class.
+	 *
+	 * @note
+	 * Normally you will want to implement IReflectable interface if you want to provide serialization
+	 * as that interface properly handles versioning, nested objects, pointer handling and more.
+	 *
+	 * @note
+	 * This class is useful for types you can easily serialize using a memcpy (built-in types like int/float/etc), or
+	 * types you cannot modify so they implement IReflectable interface (like std::string or std::vector).
+	 *
+	 * @see		RTTITypeBase
+	 * @see		RTTIField
+	 */
+	template<class T>
+	struct RTTIPlainType
+	{
+		static_assert(std::is_pod<T>::value,
+			"Provided type isn't plain-old-data. You need to specialize RTTIPlainType template in order to serialize this type. "\
+			" (Or call BS_ALLOW_MEMCPY_SERIALIZATION(type) macro if you are sure the type can be properly serialized using just memcpy.)");
+
+		enum { id = 0 /**< Unique id for the serializable type. */ };
+		enum { hasDynamicSize = 0 /**< 0 (Object has static size less than 255 bytes, for example int) or 1 (Dynamic size with no size restriction, for example string) */ };
+
+		/** Serializes the provided object into the provided pre-allocated memory buffer. */
+		static void toMemory(const T& data, char* memory)
+		{
+			memcpy(memory, &data, sizeof(T));
+		}
+
+		/**
+		 *  Deserializes a previously allocated object from the provided memory buffer. Return the number of bytes read
+		 *  from the memory buffer.
+		 */
+		static UINT32 fromMemory(T& data, char* memory)
+		{
+			memcpy(&data, memory, sizeof(T));
+			return sizeof(T);
+		}
+
+		/** Returns the size of the provided object. (Works for both static and dynamic size types) */
+		static UINT32 getDynamicSize(const T& data)
+		{
+			return sizeof(T);
+		}
+	};
+
 	/**
 	/**
 	 * Helper method when serializing known data types that have valid
 	 * Helper method when serializing known data types that have valid
 	 * RTTIPlainType specialization.
 	 * RTTIPlainType specialization.
@@ -97,55 +146,6 @@ namespace BansheeEngine
 		return memory + elemSize;
 		return memory + elemSize;
 	}
 	}
 
 
-	/**
-	 * Template that you may specialize with a class if you want to provide simple serialization for it. 
-	 * 			
-	 * Any type that uses the "plain" field in the RTTI system must specialize this class.
-	 * 			
-	 * @note	
-	 * Normally you will want to implement IReflectable interface if you want to provide serialization
-	 * as that interface properly handles versioning, nested objects, pointer handling and more.
-	 *
-	 * @note			
-	 * This class is useful for types you can easily serialize using a memcpy (built-in types like int/float/etc), or
-	 * types you cannot modify so they implement IReflectable interface (like std::string or std::vector).
-	 *			
-	 * @see		RTTITypeBase
-	 * @see		RTTIField
-	 */
-	template<class T>
-	struct RTTIPlainType 
-	{ 
-		static_assert(std::is_pod<T>::value, 
-			"Provided type isn't plain-old-data. You need to specialize RTTIPlainType template in order to serialize this type. "\
-			" (Or call BS_ALLOW_MEMCPY_SERIALIZATION(type) macro if you are sure the type can be properly serialized using just memcpy.)");
-
-		enum { id = 0 /**< Unique id for the serializable type. */ }; 
-		enum { hasDynamicSize = 0 /**< 0 (Object has static size less than 255 bytes, for example int) or 1 (Dynamic size with no size restriction, for example string) */ };
-
-		/** Serializes the provided object into the provided pre-allocated memory buffer. */
-		static void toMemory(const T& data, char* memory)	
-		{ 
-			memcpy(memory, &data, sizeof(T)); 
-		}
-
-		/** 
-		 *  Deserializes a previously allocated object from the provided memory buffer. Return the number of bytes read 
-		 *  from the memory buffer.
-		 */
-		static UINT32 fromMemory(T& data, char* memory)
-		{
-			memcpy(&data, memory, sizeof(T)); 
-			return sizeof(T);
-		}
-
-		/** Returns the size of the provided object. (Works for both static and dynamic size types) */
-		static UINT32 getDynamicSize(const T& data)
-		{ 
-			return sizeof(T);
-		}
-	};
-
 	/**
 	/**
 	 * Notify the RTTI system that the specified type may be serialized just by using a memcpy.
 	 * Notify the RTTI system that the specified type may be serialized just by using a memcpy.
 	 *
 	 *
@@ -614,4 +614,4 @@ namespace BansheeEngine
 
 
 	/** @} */
 	/** @} */
 	/** @} */
 	/** @} */
-}
+}

+ 11 - 11
Source/BansheeUtility/Include/BsStdHeaders.h

@@ -174,6 +174,16 @@ namespace BansheeEngine
 		return SPtr<Type>(data, &bs_delete<Type, MainAlloc>, StdAlloc<Type, PtrDataAlloc>());
 		return SPtr<Type>(data, &bs_delete<Type, MainAlloc>, StdAlloc<Type, PtrDataAlloc>());
 	}
 	}
 
 
+	/**
+	* Create a new unique pointer from a previously constructed object.
+	* Pointer specific data will be allocated using the provided allocator category.
+	*/
+	template<class Type, class Alloc = GenAlloc>
+	UPtr<Type, Alloc> bs_unique_ptr(Type* data)
+	{
+		return std::unique_ptr<Type, decltype(&bs_delete<Type, Alloc>)>(data, bs_delete<Type, Alloc>);
+	}
+
 	/** Create a new unique pointer using a custom allocator category. */
 	/** Create a new unique pointer using a custom allocator category. */
 	template<class Type, class Alloc, class... Args>
 	template<class Type, class Alloc, class... Args>
 	UPtr<Type> bs_unique_ptr_new(Args &&... args)
 	UPtr<Type> bs_unique_ptr_new(Args &&... args)
@@ -192,15 +202,5 @@ namespace BansheeEngine
 		return bs_unique_ptr<Type, GenAlloc>(rawPtr);
 		return bs_unique_ptr<Type, GenAlloc>(rawPtr);
 	}
 	}
 
 
-	/**
-	* Create a new unique pointer from a previously constructed object.
-	* Pointer specific data will be allocated using the provided allocator category.
-	*/
-	template<class Type, class Alloc = GenAlloc>
-	UPtr<Type, Alloc> bs_unique_ptr(Type* data)
-	{
-		return std::unique_ptr<Type, decltype(&bs_delete<Type, Alloc>)>(data, bs_delete<Type, Alloc>);
-	}
-
 	/** @} */
 	/** @} */
-}
+}

+ 6 - 3
Source/BansheeUtility/Include/BsString.h

@@ -876,9 +876,11 @@ namespace BansheeEngine
 
 
 /** @cond STDLIB */
 /** @cond STDLIB */
 
 
+namespace std
+{
 /** Hash value generator for String. */
 /** Hash value generator for String. */
 template<> 
 template<> 
-struct std::hash<BansheeEngine::String>
+struct hash<BansheeEngine::String>
 {
 {
 	size_t operator()(const BansheeEngine::String& string) const
 	size_t operator()(const BansheeEngine::String& string) const
 	{
 	{
@@ -891,7 +893,7 @@ struct std::hash<BansheeEngine::String>
 
 
 /**	Hash value generator for WString. */
 /**	Hash value generator for WString. */
 template<> 
 template<> 
-struct std::hash<BansheeEngine::WString>
+struct hash<BansheeEngine::WString>
 {
 {
 	size_t operator()(const BansheeEngine::WString& string) const
 	size_t operator()(const BansheeEngine::WString& string) const
 	{
 	{
@@ -901,5 +903,6 @@ struct std::hash<BansheeEngine::WString>
 		return hash ^ (hash >> 16);
 		return hash ^ (hash >> 16);
 	}
 	}
 };
 };
+}
 
 
-/** @endcond */
+/** @endcond */

+ 21 - 2
Source/BansheeUtility/Include/BsVector3.h

@@ -2,6 +2,8 @@
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #pragma once
 #pragma once
 
 
+#include <cmath>
+
 #include "BsPrerequisitesUtil.h"
 #include "BsPrerequisitesUtil.h"
 #include "BsRadian.h"
 #include "BsRadian.h"
 
 
@@ -240,7 +242,10 @@ namespace BansheeEngine
         }
         }
 
 
         /** Returns the length (magnitude) of the vector. */
         /** Returns the length (magnitude) of the vector. */
-		inline float length() const;
+		inline float length() const
+		{
+			return std::sqrt(x * x + y * y + z * z);
+		}
 
 
         /** Returns the square of the length(magnitude) of the vector. */
         /** Returns the square of the length(magnitude) of the vector. */
         float squaredLength() const
         float squaredLength() const
@@ -267,7 +272,21 @@ namespace BansheeEngine
         }
         }
 
 
         /** Normalizes the vector. */
         /** Normalizes the vector. */
-		inline float normalize();
+		inline float normalize()
+		{
+			float len = length();
+
+			// Will also work for zero-sized vectors, but will change nothing
+			if (len > 1e-08)
+			{
+				float invLen = 1.0f / len;
+				x *= invLen;
+				y *= invLen;
+				z *= invLen;
+			}
+			return len;
+		}
+
 
 
         /** Calculates the cross-product of 2 vectors, that is, the vector that lies perpendicular to them both. */
         /** Calculates the cross-product of 2 vectors, that is, the vector that lies perpendicular to them both. */
         Vector3 cross(const Vector3& other) const
         Vector3 cross(const Vector3& other) const

+ 12 - 16
Source/BansheeUtility/Source/BsDynLib.cpp

@@ -18,6 +18,17 @@
 
 
 namespace BansheeEngine 
 namespace BansheeEngine 
 {
 {
+
+#if BS_PLATFORM == BS_PLATFORM_LINUX
+	const String DynLib::extension = "so";
+#elif BS_PLATFORM == BS_PLATFORM_OSX
+	const String DynLib::extension = "dylib";
+#elif BS_PLATFORM == BS_PLATFORM_WIN32
+	const String DynLib::extension = "dll";
+#else
+#  error Unhandled platform
+#endif
+
     DynLib::DynLib(const String& name)
     DynLib::DynLib(const String& name)
     {
     {
         mName = name;
         mName = name;
@@ -35,22 +46,7 @@ namespace BansheeEngine
 		if(m_hInst)
 		if(m_hInst)
 			return;
 			return;
 
 
-		String name = mName;
-#if BS_PLATFORM == BS_PLATFORM_LINUX
-        // dlopen() does not add .so to the filename, like windows does for .dll
-        if (name.substr(name.length() - 3, 3) != ".so")
-           name += ".so";
-#elif BS_PLATFORM == BS_PLATFORM_OSX
-        // dlopen() does not add .dylib to the filename, like windows does for .dll
-        if (name.substr(name.length() - 6, 6) != ".dylib")
-			name += ".dylib";
-#elif BS_PLATFORM == BS_PLATFORM_WIN32
-		// Although LoadLibraryEx will add .dll itself when you only specify the library name,
-		// if you include a relative path then it does not. So, add it to be sure.
-		if (name.substr(name.length() - 4, 4) != ".dll")
-			name += ".dll";
-#endif
-        m_hInst = (DYNLIB_HANDLE)DYNLIB_LOAD(name.c_str());
+        m_hInst = (DYNLIB_HANDLE)DYNLIB_LOAD(mName.c_str());
 
 
         if(!m_hInst)
         if(!m_hInst)
 		{
 		{

+ 6 - 12
Source/BansheeUtility/Source/BsDynLibManager.cpp

@@ -11,19 +11,13 @@ namespace BansheeEngine
 
 
     DynLib* DynLibManager::load(const String& name)
     DynLib* DynLibManager::load(const String& name)
     {
     {
+		// Add the extension (.dll, .so, ...) if necessary.
 		String filename = name;
 		String filename = name;
-#if BS_PLATFORM == BS_PLATFORM_LINUX
-		if (name.substr(name.length() - 3, 3) != ".so")
-			name += ".so";
-#elif BS_PLATFORM == BS_PLATFORM_OSX
-		if (name.substr(name.length() - 6, 6) != ".dylib")
-			name += ".dylib";
-#elif BS_PLATFORM == BS_PLATFORM_WIN32
-		// Although LoadLibraryEx will add .dll itself when you only specify the library name,
-		// if you include a relative path then it does not. So, add it to be sure.
-		if (filename.substr(filename.length() - 4, 4) != ".dll")
-			filename += ".dll";
-#endif
+		const int length = filename.length();
+		const String extension = "." + DynLib::extension;
+		const int ext_length = extension.length();
+		if (length <= ext_length || filename.substr(length - ext_length) != extension)
+			filename += extension;
 
 
 		auto iterFind = mLoadedLibraries.find(filename);
 		auto iterFind = mLoadedLibraries.find(filename);
 		if (iterFind != mLoadedLibraries.end())
 		if (iterFind != mLoadedLibraries.end())

+ 1 - 11
Source/BansheeUtility/Source/BsMemStack.cpp

@@ -37,14 +37,4 @@ namespace BansheeEngine
 
 
 		ThreadMemStack->dealloc(data);
 		ThreadMemStack->dealloc(data);
 	}
 	}
-
-	void* bs_stack_alloc(UINT32 numBytes)
-	{
-		return (void*)MemStack::alloc(numBytes);
-	}
-
-	void bs_stack_free(void* data)
-	{
-		return MemStack::deallocLast((UINT8*)data);
-	}
-}
+}

+ 0 - 21
Source/BansheeUtility/Source/BsVector3.cpp

@@ -12,27 +12,6 @@ namespace BansheeEngine
 
 
 	}
 	}
 
 
-	float Vector3::length() const
-	{
-		return Math::sqrt(x * x + y * y + z * z);
-	}
-
-	float Vector3::normalize()
-	{
-		float len = Math::sqrt(x * x + y * y + z * z);
-
-		// Will also work for zero-sized vectors, but will change nothing
-		if (len > 1e-08)
-		{
-			float invLen = 1.0f / len;
-			x *= invLen;
-			y *= invLen;
-			z *= invLen;
-		}
-
-		return len;
-	}
-
 	Radian Vector3::angleBetween(const Vector3& dest) const
 	Radian Vector3::angleBetween(const Vector3& dest) const
 	{
 	{
 		float lenProduct = length() * dest.length();
 		float lenProduct = length() * dest.length();

+ 4 - 0
Source/CMakeLists.txt

@@ -23,6 +23,10 @@ if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
 endif()
 endif()
 
 
 # Global compile & linker flags
 # Global compile & linker flags
+## Compiler-agnostic settings
+### Target at least C++11
+set(CMAKE_CXX_STANDARD 11)
+## Compiler-specific settings
 if(MSVC)
 if(MSVC)
 	# Linker
 	# Linker
 	set(BS_LINKER_FLAGS_COMMON "/DLL /DYNAMICBASE /NOLOGO")
 	set(BS_LINKER_FLAGS_COMMON "/DLL /DYNAMICBASE /NOLOGO")