为MINGW32/64编译器添加支持
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#define HGL_COMPILER_Microsoft HGL_MERGE32('M','S','C',' ')
|
||||
#define HGL_COMPILER_GNU HGL_MERGE32('G','N','U',' ')
|
||||
#define HGL_COMPILER_MinGW32 HGL_MERGE32('M','G','3','2')
|
||||
#define HGL_COMPILER_MinGW64 HGL_MERGE32('M','G','6','4')
|
||||
#define HGL_COMPILER_Intel HGL_MERGE32('I','n','t','e')
|
||||
#define HGL_COMPILER_IBM HGL_MERGE32('I','B','M',' ')
|
||||
#define HGL_COMPILER_DigitalMars HGL_MERGE32('D','i','M','a')
|
||||
@@ -191,6 +192,8 @@
|
||||
#define HGL_COMPILER HGL_COMPILER_PGI
|
||||
#elif defined(__MINGW32__)
|
||||
#define HGL_COMPILER HGL_COMPILER_MinGW32
|
||||
#elif defined(__MINGW64__)
|
||||
#define HGL_COMPILER HGL_COMPILER_MinGW64
|
||||
#elif defined(__GNUC__)
|
||||
#define HGL_COMPILER HGL_COMPILER_GNU
|
||||
#else
|
||||
@@ -221,7 +224,9 @@
|
||||
#include<hgl/platform/compiler/Intel.h>
|
||||
#elif HGL_COMPILER == HGL_COMPILER_IBM
|
||||
#include<hgl/platform/compiler/IBM.h>
|
||||
#elif HGL_COMPILER == HGL_COMPILER_MINGW32
|
||||
#elif HGL_COMPILER == HGL_COMPILER_MinGW32
|
||||
#include<hgl/platform/compiler/GNU.h>
|
||||
#elif HGL_COMPILER == HGL_COMPILER_MinGW64
|
||||
#include<hgl/platform/compiler/GNU.h>
|
||||
#elif HGL_COMPILER == HGL_COMPILER_GNU
|
||||
#include<hgl/platform/compiler/GNU.h>
|
||||
|
@@ -72,6 +72,13 @@
|
||||
|
||||
#endif//__GNUC__
|
||||
|
||||
#ifdef char8_t
|
||||
using u8char =char8_t;
|
||||
#else
|
||||
using u8char =char;
|
||||
#endif
|
||||
|
||||
|
||||
#define HGL_THREAD_LOCAL_STORAGE __thread //线程本地储存
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
#define HGL_LIB_FRONT HGL_LIB_OS "_" HGL_LIB_COMPILER_NAME "_" HGL_LIB_DEBUG_NAME "_"
|
||||
|
@@ -51,33 +51,36 @@ using os_char =wchar_t;
|
||||
#define HGL_GL_WINDOW_INCLUDE_FILE <hgl/platform/WinOpenGL.h> //指定OpenGL窗口引用头文件
|
||||
#define HGL_GL_WINDOW_CLASS WinGLWindow //指定OpenGL窗口类名称
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
#if HGL_COMPILER == HGL_COMPILER_Microsoft
|
||||
#define hgl_malloc(size) _aligned_malloc(size,HGL_MEM_ALIGN)
|
||||
#define hgl_realloc(ptr,size) _aligned_realloc(ptr,size,HGL_MEM_ALIGN)
|
||||
#define hgl_free _aligned_free
|
||||
|
||||
template<typename T>
|
||||
inline T *hgl_aligned_malloc(size_t n)
|
||||
{
|
||||
return (T *)_aligned_malloc(n*sizeof(T),alignof(T));
|
||||
}
|
||||
#else
|
||||
#define hgl_malloc(size) memalign(HGL_MEM_ALIGN,size)
|
||||
#define hgl_realloc(ptr,size) realloc(ptr,size)
|
||||
#define hgl_free free
|
||||
#endif//
|
||||
// == 目前MINGW和MSVC在以下接口上应该能保持一致了
|
||||
|
||||
#define hgl_malloc(size) _aligned_malloc(size,HGL_MEM_ALIGN)
|
||||
#define hgl_realloc(ptr,size) _aligned_realloc(ptr,size,HGL_MEM_ALIGN)
|
||||
#define hgl_free _aligned_free
|
||||
|
||||
template<typename T>
|
||||
inline T *hgl_aligned_malloc(size_t n)
|
||||
{
|
||||
return (T *)_aligned_malloc(n*sizeof(T),alignof(T));
|
||||
}
|
||||
|
||||
#define OS_EXTERNAL_H <winbase.h>
|
||||
using ExternalModulePointer =HMODULE;
|
||||
#define pi_get GetProcAddress
|
||||
#define pi_close FreeLibrary
|
||||
|
||||
#define struct_stat64 struct _stat64
|
||||
#ifdef HGL_64_BITS
|
||||
#define struct_stat64 struct _stat64
|
||||
#define hgl_lstat64 _wstat64
|
||||
#endif
|
||||
#if HGL_32_BITS
|
||||
#define struct_stat64 struct _stati64
|
||||
#define hgl_lstat64 _wstat32i64
|
||||
#endif
|
||||
//#define hgl_stat64 _stat64
|
||||
#define hgl_lseek64 _lseeki64
|
||||
#define hgl_tell64(fp) _telli64(fp)
|
||||
#define hgl_fstat64 _fstati64
|
||||
#define hgl_lstat64 _wstat64
|
||||
#define hgl_read64 _read
|
||||
#define hgl_write64 _write
|
||||
|
||||
|
Reference in New Issue
Block a user