mirror of https://github.com/FWGS/hlsdk-xash3d
check if cmath useful, remove posix defines when using owcc
This commit is contained in:
parent
8bf08e261c
commit
2ba9071798
|
@ -31,7 +31,8 @@
|
||||||
typedef unsigned char byte;
|
typedef unsigned char byte;
|
||||||
typedef unsigned short word;
|
typedef unsigned short word;
|
||||||
typedef float vec_t;
|
typedef float vec_t;
|
||||||
typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf );
|
// redefine
|
||||||
|
//typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf );
|
||||||
|
|
||||||
#include "util_vector.h"
|
#include "util_vector.h"
|
||||||
|
|
||||||
|
@ -43,7 +44,11 @@ typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf );
|
||||||
#endif
|
#endif
|
||||||
#include "exportdef.h"
|
#include "exportdef.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#if HAVE_CMATH
|
||||||
|
#include <cmath>
|
||||||
|
#else
|
||||||
|
#include <math.h>
|
||||||
|
#endif
|
||||||
#if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
|
#if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
|
||||||
#define XASH_64BIT
|
#define XASH_64BIT
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,8 +22,11 @@
|
||||||
// Misc C-runtime library headers
|
// Misc C-runtime library headers
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#if HAVE_CMATH
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#else
|
||||||
|
#include <math.h>
|
||||||
|
#endif
|
||||||
// Header file containing definition of globalvars_t and entvars_t
|
// Header file containing definition of globalvars_t and entvars_t
|
||||||
typedef unsigned int func_t; //
|
typedef unsigned int func_t; //
|
||||||
typedef int string_t; // from engine's pr_comp.h;
|
typedef int string_t; // from engine's pr_comp.h;
|
||||||
|
|
|
@ -22,7 +22,11 @@
|
||||||
#include <tgmath.h>
|
#include <tgmath.h>
|
||||||
#endif // HAVE_TGMATH_H
|
#endif // HAVE_TGMATH_H
|
||||||
#else // __cplusplus
|
#else // __cplusplus
|
||||||
|
#if HAVE_CMATH
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#else
|
||||||
|
#include <math.h>
|
||||||
|
#endif
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
typedef float vec_t;
|
typedef float vec_t;
|
||||||
|
|
|
@ -66,7 +66,11 @@ typedef int BOOL;
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#if HAVE_CMATH
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#else
|
||||||
|
#include <math.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef M_PI_F
|
#ifndef M_PI_F
|
||||||
#define M_PI_F (float)M_PI
|
#define M_PI_F (float)M_PI
|
||||||
|
|
6
wscript
6
wscript
|
@ -249,10 +249,16 @@ def configure(conf):
|
||||||
conf.define_cond('HAVE_TGMATH_H', tgmath_usable)
|
conf.define_cond('HAVE_TGMATH_H', tgmath_usable)
|
||||||
else:
|
else:
|
||||||
conf.undefine('HAVE_TGMATH_H')
|
conf.undefine('HAVE_TGMATH_H')
|
||||||
|
cmath_usable = conf.check_cxx(fragment='''#include<cmath>
|
||||||
|
int main(void){ return (int)sqrt(2.0f); }''',
|
||||||
|
msg='Checking if cmath is usable', mandatory = False)
|
||||||
|
conf.define_cond('HAVE_CMATH', cmath_usable)
|
||||||
|
|
||||||
if conf.env.COMPILER_CC == 'msvc':
|
if conf.env.COMPILER_CC == 'msvc':
|
||||||
conf.define('_CRT_SECURE_NO_WARNINGS', 1)
|
conf.define('_CRT_SECURE_NO_WARNINGS', 1)
|
||||||
conf.define('_CRT_NONSTDC_NO_DEPRECATE', 1)
|
conf.define('_CRT_NONSTDC_NO_DEPRECATE', 1)
|
||||||
|
elif conf.env.COMPILER_CC == 'owcc':
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
conf.env.append_unique('DEFINES', ['stricmp=strcasecmp', 'strnicmp=strncasecmp', '_snprintf=snprintf', '_vsnprintf=vsnprintf', '_LINUX', 'LINUX'])
|
conf.env.append_unique('DEFINES', ['stricmp=strcasecmp', 'strnicmp=strncasecmp', '_snprintf=snprintf', '_vsnprintf=vsnprintf', '_LINUX', 'LINUX'])
|
||||||
conf.env.append_unique('CXXFLAGS', ['-Wno-invalid-offsetof', '-fno-rtti', '-fno-exceptions'])
|
conf.env.append_unique('CXXFLAGS', ['-Wno-invalid-offsetof', '-fno-rtti', '-fno-exceptions'])
|
||||||
|
|
Loading…
Reference in New Issue