Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | #SConstruct |
2 | |||
3 | # needed imports |
||
4 | import sys |
||
5 | import os |
||
6 | import SCons.Util |
||
7 | |||
8 | PROGRAM_NAME = 'MacD1Extract' |
||
9 | |||
10 | print '\n===== ' + PROGRAM_NAME + ' =====\n' |
||
11 | |||
12 | # source files |
||
13 | sources = [ |
||
14 | 'extractD1Data.cpp' |
||
15 | ] |
||
16 | |||
17 | # Acquire environment object... |
||
18 | env = Environment(ENV = os.environ) |
||
19 | |||
20 | # Prettier build messages...... |
||
21 | env["CCCOMSTR"] = "Compiling $SOURCE ..." |
||
22 | env["CXXCOMSTR"] = "Compiling $SOURCE ..." |
||
23 | env["LINKCOMSTR"] = "Linking $TARGET ..." |
||
24 | env["ARCOMSTR"] = "Archiving $TARGET ..." |
||
25 | env["RANLIBCOMSTR"] = "Indexing $TARGET ..." |
||
26 | |||
27 | # Get traditional compiler environment variables |
||
28 | if os.environ.has_key('CC'): |
||
29 | env['CC'] = os.environ['CC'] |
||
30 | if os.environ.has_key('CFLAGS'): |
||
31 | env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS']) |
||
32 | if os.environ.has_key('CXX'): |
||
33 | env['CXX'] = os.environ['CXX'] |
||
34 | if os.environ.has_key('CXXFLAGS'): |
||
35 | env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS']) |
||
36 | if os.environ.has_key('LDFLAGS'): |
||
37 | env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS']) |
||
38 | |||
39 | # windows or *nix? |
||
40 | if sys.platform == 'win32': |
||
41 | print "compiling on Windows" |
||
42 | winlibs = ['winmm', 'mingw32'] # are these even needed? |
||
43 | libs = winlibs |
||
44 | lflags = '-mwindows' |
||
45 | elif sys.platform == 'darwin': |
||
46 | print "compiling on Mac OS X" |
||
47 | libs = '' |
||
48 | lflags = '' |
||
49 | else: |
||
50 | print "compiling on *NIX" |
||
51 | libs = '' |
||
52 | lflags = '' |
||
53 | |||
54 | target = 'macd1extract' |
||
55 | print '\n' |
||
56 | |||
57 | # building program... |
||
58 | env.Program(target=str(target), source = sources, LIBS = libs, LINKFLAGS = str(lflags)) |
||
59 | |||
60 | # show some help when running scons -h |
||
61 | Help(PROGRAM_NAME + ', SConstruct file help:' + |
||
62 | """ |
||
63 | |||
64 | Type 'scons' to build the binary. |
||
65 | Type 'scons install' to build (if it hasn't been done) and install. |
||
66 | Type 'scons -c' to clean up. |
||
67 | |||
68 | """) |
||
69 | |||
70 | #EOF |