mirror of
https://github.com/FWGS/hlsdk-xash3d
synced 2024-11-22 01:47:45 +01:00
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 short word;
|
||||
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"
|
||||
|
||||
@ -43,7 +44,11 @@ typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf );
|
||||
#endif
|
||||
#include "exportdef.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__)
|
||||
#define XASH_64BIT
|
||||
#endif
|
||||
|
@ -22,8 +22,11 @@
|
||||
// Misc C-runtime library headers
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if HAVE_CMATH
|
||||
#include <cmath>
|
||||
|
||||
#else
|
||||
#include <math.h>
|
||||
#endif
|
||||
// Header file containing definition of globalvars_t and entvars_t
|
||||
typedef unsigned int func_t; //
|
||||
typedef int string_t; // from engine's pr_comp.h;
|
||||
|
@ -22,7 +22,11 @@
|
||||
#include <tgmath.h>
|
||||
#endif // HAVE_TGMATH_H
|
||||
#else // __cplusplus
|
||||
#if HAVE_CMATH
|
||||
#include <cmath>
|
||||
#else
|
||||
#include <math.h>
|
||||
#endif
|
||||
#endif // __cplusplus
|
||||
|
||||
typedef float vec_t;
|
||||
|
@ -66,7 +66,11 @@ typedef int BOOL;
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#if HAVE_CMATH
|
||||
#include <cmath>
|
||||
#else
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
#ifndef M_PI_F
|
||||
#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)
|
||||
else:
|
||||
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':
|
||||
conf.define('_CRT_SECURE_NO_WARNINGS', 1)
|
||||
conf.define('_CRT_NONSTDC_NO_DEPRECATE', 1)
|
||||
elif conf.env.COMPILER_CC == 'owcc':
|
||||
pass
|
||||
else:
|
||||
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'])
|
||||
|
Loading…
Reference in New Issue
Block a user