source: SConstruct @ 3311

Last change on this file since 3311 was 3283, checked in by jack, 18 years ago

Fixed the build process on Windows to prefer MinGW.

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