source: SConstruct @ 3354

Last change on this file since 3354 was 3353, checked in by jack, 19 years ago

Fixed building under win32 with scons to default to gcc.

File size: 1.5 KB
Line 
1import os
2import sys
3
4# Read in build options
5opts = Options('build_options.py')
6opts.Add('GCCFLAGS', 'Flags passed to GCC')
7opts.Add('MSVCFLAGS', 'Flags passed to the MSVC compiler')
8
9env = Environment(options = opts)
10
11Help(opts.GenerateHelpText(env))
12
13# Find the path for Python.h and then share it to other SConscripts later on
14# Where to find the Python.h
15if sys.platform == 'win32':
16    # Prefer MinGW over MSVC
17    Tool('mingw')(env)
18
19    python_include = os.path.join(sys.exec_prefix, 'include')
20    # Windows installs need to be told the lib path and the python library name
21    # else it won't work right.
22    python_libdir = os.path.join(sys.exec_prefix, 'libs')
23    env.Append(LIBPATH=[python_libdir])
24    python_libname = 'python%d%d' % (sys.version_info[0:2])
25    env.Append(LIBS=[python_libname])
26else:
27    python_include = os.path.join(os.path.join(sys.exec_prefix, 'include'),
28                                  'python' + sys.version[:3])
29   
30# Check existence of Python.h
31headerfile = python_include + os.sep + 'Python.h'
32try:
33    open(headerfile, 'r')
34except:
35    raise """Did not find Python header file %s.
36    Make sure files for Python C-extensions are installed.
37    In debian linux, for example, you need to install a
38    package called something like python2.3-dev""" %headerfile
39
40env.Append(CPPPATH=[python_include])
41
42# Set appropriate CCFLAGS for the compiler.
43if env['CC'] == 'gcc':
44    env.Append(CCFLAGS=['${GCCFLAGS}'])
45elif env['CC'] == 'cl':
46    env.Append(CCFLAGS=['${MSVCFLAGS}'])
47
48Export('env')
49
50SConscript(['inundation/SConscript'])
Note: See TracBrowser for help on using the repository browser.