Fixed several platform-dependent preprocessor defines to work with Windows

This commit is contained in:
Ray Speth 2011-12-14 19:33:53 +00:00
parent 6c3e29bac1
commit 098501cbe4
4 changed files with 22 additions and 2 deletions

View file

@ -11,6 +11,8 @@
// Copyright 2001 California Institute of Technology
//@{
#include "ct_defs.h"
#ifdef WIN32
#pragma warning(disable:4786)
#pragma warning(disable:4503)
@ -20,7 +22,7 @@
#define SNPRINTF snprintf
#endif
//@}
#include "ct_defs.h"
#include "stringUtils.h"
#include "ctexceptions.h"
#include "global.h"

View file

@ -439,10 +439,18 @@ elif env['F90'] == 'ifort':
env['FORTRANMODDIR'] = '${TARGET.dir}'
if env['CC'] == 'gcc':
env['WIN32'] = False
elif env['CC'] == 'cl':
env['WIN32'] = True
else:
assert False
conf = Configure(env)
env['HAS_SSTREAM'] = conf.CheckCXXHeader('sstream', '<>')
env['HAS_TIMES_H'] = conf.CheckCHeader('sys/times.h', '""')
env['HAS_UNISTD_H'] = conf.CheckCHeader('unistd.h', '""')
env = conf.Finish()
if env['cantera_python_home'] == '' and env['prefix'] != defaults.prefix:
@ -496,6 +504,7 @@ def cdefine(definevar, configvar, comp=True, value=1):
configh[definevar] = None
cdefine('DEBUG_MODE', 'debug')
cdefine('WIN32', 'WIN32')
# Need to test all of these to see what platform.system() returns
configh['SOLARIS'] = 1 if env['OS'] == 'Solaris' else None

View file

@ -77,6 +77,10 @@ typedef int ftnlen; // Fortran hidden string length type
// microsoft vc++ being used as the compiler
%(WINMSVC)s
// Despite the name, this variable is expected to be defined
// on both 32 and 64 bit Windows
%(WIN32)s
// Identify whether the operating system is solaris
// with a native compiler
%(SOLARIS)s

View file

@ -9,6 +9,11 @@ libs = [('tpx','tpx',['cpp'])]
if env['build_with_f2c']:
libs.append(('f2c_math', 'ctmath', ['cpp','c']))
if not localenv['HAS_TIMES_H']:
localenv.Append(CPPDEFINES=['USE_CLOCK'])
if not localenv['HAS_UNISTD_H']:
localenv.Append(CPPDEFINES=['MSDOS'])
# Create arith.h using the arithchk program
if not os.path.exists('arith.h'):
arithenv = env.Clone()