Skip to content

Commit

Permalink
More VS2015 compile fixes and fixes related to sparsehash update
Browse files Browse the repository at this point in the history
  • Loading branch information
jushar committed Aug 1, 2016
1 parent 7829794 commit 2423115
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 26 deletions.
3 changes: 2 additions & 1 deletion Shared/sdk/SharedUtil.FastHashMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/
#pragma once

#if WITH_ALLOC_TRACKING
#define CFastHashMap std::CMap
Expand All @@ -19,7 +20,7 @@
#endif

#include <google/dense_hash_map>
using namespace google;
#undef BASE_TEMPLATE_UTIL_H_ // HACK: Sparsehash and CEF share the same include guard name (NEVER USE MACROS AS INCLUDE GUARDS)

#ifdef WIN32
#pragma pop_macro("assert")
Expand Down
1 change: 0 additions & 1 deletion Shared/sdk/SharedUtil.FastHashSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#endif

#include <google/dense_hash_set>
using namespace google;

#ifdef WIN32
#pragma pop_macro("assert")
Expand Down
38 changes: 14 additions & 24 deletions Shared/sdk/SharedUtil.HashMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,13 @@
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/
#pragma once

#if WITH_ALLOC_TRACKING
#define CHashMap CMap
#else

#if defined(WIN32)
#include <hash_map>
#define HASH_MAP_TYPE stdext::hash_map
#elif defined(__GNUC__) && (__GNUC__ >= 3)
#include <ext/hash_map>
#define HASH_MAP_TYPE __gnu_cxx::hash_map
#endif

#include <unordered_map>
#include <functional>

namespace SharedUtil
Expand All @@ -32,7 +26,7 @@ namespace SharedUtil
// Using hash_map
//
template < class K, class V >
class CHashMap : public HASH_MAP_TYPE < K, V >
class CHashMap : public std::unordered_map < K, V >
{
public:
};
Expand Down Expand Up @@ -110,23 +104,19 @@ namespace SharedUtil


// Calculate a hash value for SString
#if defined(WIN32)
inline size_t hash_value ( const SString& strString )
template<>
struct std::hash<SString>
{
size_t operator()(const SString& str) const
{
return std::hash<std::string>()(str);
}
};

inline size_t hash_value ( const SString& strString ) // Required for sparsehash
{
std::hash<std::string> hashFunction;
return hashFunction ( strString );
}
#elif defined(__GNUC__) && (__GNUC__ >= 3)
namespace __gnu_cxx
{
template<>
struct hash < SString >
{
size_t operator () ( const SString& strString ) const
{
return __stl_hash_string ( strString );
}
};
}
#endif

#endif // WITH_ALLOC_TRACKING
4 changes: 4 additions & 0 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ workspace "MTASA"
libdirs {
dxdir.."Lib/x86"
}

if _ACTION == "vs2015" then
defines { "_TIMESPEC_DEFINED" } -- fix pthread redefinition error, TODO: Remove when we fully moved to vs2015
end

-- Only build the client on Windows
if os.get() == "windows" then
Expand Down

0 comments on commit 2423115

Please sign in to comment.