Browse Source

check if cmath useful, remove posix defines when using owcc

pull/118/head
mittorn 2 years ago
parent
commit
2ba9071798
  1. 9
      cl_dll/cl_dll.h
  2. 5
      cl_dll/util_vector.h
  3. 4
      common/mathlib.h
  4. 4
      dlls/extdll.h
  5. 6
      wscript

9
cl_dll/cl_dll.h

@ -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

5
cl_dll/util_vector.h

@ -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;

4
common/mathlib.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;

4
dlls/extdll.h

@ -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

@ -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…
Cancel
Save