Mercurial > hg > aimc
comparison trunk/SConstruct @ 289:6cf55200a199
-Added basic support for unit tests using gtest
-Updated lint scripts to exclude header guard problems
-Made everything lint-friendly
-Added a trivial script to build the Doxygen documentation
author | tomwalters |
---|---|
date | Sat, 20 Feb 2010 21:03:57 +0000 |
parents | fb52ca0e6339 |
children | 10d0803e37ec |
comparison
equal
deleted
inserted
replaced
288:34993448961f | 289:6cf55200a199 |
---|---|
27 """ | 27 """ |
28 | 28 |
29 import os | 29 import os |
30 import shutil | 30 import shutil |
31 | 31 |
32 # Sources common to every version | |
33 common_sources = ['Support/Common.cc', | |
34 'Support/SignalBank.cc', | |
35 'Support/Parameters.cc', | |
36 'Support/Module.cc', | |
37 'Modules/Input/ModuleFileInput.cc', | |
38 'Modules/BMM/ModuleGammatone.cc', | |
39 'Modules/BMM/ModulePZFC.cc', | |
40 'Modules/NAP/ModuleHCL.cc', | |
41 'Modules/Strobes/ModuleParabola.cc', | |
42 'Modules/SAI/ModuleSAI.cc', | |
43 'Modules/SSI/ModuleSSI.cc', | |
44 'Modules/Profile/ModuleSlice.cc', | |
45 'Modules/Features/ModuleGaussians.cc', | |
46 'Modules/Output/FileOutputHTK.cc'] | |
47 | |
48 # File which contains main() | |
49 sources = common_sources + ['Main/aimc.cc'] | |
50 | |
51 # Test sources | |
52 test_sources = ['Modules/Profile/ModuleSlice_unittest.cc'] | |
53 test_sources += common_sources | |
54 | |
32 # Define the command-line options for running scons | 55 # Define the command-line options for running scons |
33 options = Variables() | 56 options = Variables() |
34 options.Add(BoolVariable('mingw', | 57 options.Add(BoolVariable('mingw', |
35 'Compile on Windows using mingw rather than msvc', | 58 'Compile on Windows using mingw rather than msvc', |
36 False)) | 59 False)) |
46 target_platform = build_platform | 69 target_platform = build_platform |
47 | 70 |
48 # Build products location and executable name | 71 # Build products location and executable name |
49 build_dir = os.path.join('build', target_platform + '-release') | 72 build_dir = os.path.join('build', target_platform + '-release') |
50 target_executable = 'aimc' | 73 target_executable = 'aimc' |
74 test_executable = 'aimc_tests' | |
51 | 75 |
52 # Create build products directory if necessary | 76 # Create build products directory if necessary |
53 if not os.path.exists(build_dir): | 77 if not os.path.exists(build_dir): |
54 os.makedirs(build_dir) | 78 os.makedirs(build_dir) |
55 env.SConsignFile(os.path.join(build_dir,'.sconsign')) | 79 env.SConsignFile(os.path.join(build_dir,'.sconsign')) |
88 print('Cross-compilation for Windows is not supported') | 112 print('Cross-compilation for Windows is not supported') |
89 Exit(1) | 113 Exit(1) |
90 else: | 114 else: |
91 print('Unsupported compiler: ' + compiler) | 115 print('Unsupported compiler: ' + compiler) |
92 Exit(1) | 116 Exit(1) |
93 | |
94 # Sources common to every version | |
95 common_sources = ['Support/Common.cc', | |
96 'Support/SignalBank.cc', | |
97 'Support/Parameters.cc', | |
98 'Support/Module.cc', | |
99 'Modules/Input/ModuleFileInput.cc', | |
100 'Modules/BMM/ModuleGammatone.cc', | |
101 'Modules/BMM/ModulePZFC.cc', | |
102 'Modules/NAP/ModuleHCL.cc', | |
103 'Modules/Strobes/ModuleParabola.cc', | |
104 'Modules/SAI/ModuleSAI.cc', | |
105 'Modules/SSI/ModuleSSI.cc', | |
106 'Modules/Profile/ModuleSlice.cc', | |
107 'Modules/Features/ModuleGaussians.cc', | |
108 'Modules/Output/FileOutputHTK.cc'] | |
109 | 117 |
110 if not target_platform == 'win32': | 118 if not target_platform == 'win32': |
111 # On windows, utf support is builtin for SimpleIni | 119 # On windows, utf support is builtin for SimpleIni |
112 # but not on other platforms | 120 # but not on other platforms |
113 common_sources += ['Support/ConvertUTF.c'] | 121 sources += ['Support/ConvertUTF.c'] |
114 | |
115 # Choose file which contains main() | |
116 sources = common_sources + ['Main/aimc.cc'] | |
117 | 122 |
118 # Place the build products in the corect place | 123 # Place the build products in the corect place |
119 env.BuildDir('#' + build_dir, '#', duplicate = 0) | 124 env.VariantDir('#' + build_dir, '#', duplicate = 0) |
120 | 125 |
121 # Look for the sources in the correct place | 126 # Look for the sources in the correct place |
122 env.Append(CPPPATH = '#src') | 127 env.Append(CPPPATH = '#src') |
123 | 128 |
124 # Dependencies | 129 # Dependencies |
127 for depname in deplibs: | 132 for depname in deplibs: |
128 env.ParseConfig('pkg-config --cflags --libs ' + depname) | 133 env.ParseConfig('pkg-config --cflags --libs ' + depname) |
129 | 134 |
130 env.AppendUnique(LIBS = deplibs) | 135 env.AppendUnique(LIBS = deplibs) |
131 | 136 |
132 # Set up the builder to build the program | 137 test_env = env |
138 test_libs = ['gtest', 'gtest_main'] | |
139 #for depname in test_libs: | |
140 # test_env.ParseConfig('pkg-config --cflags --libs ' + depname) | |
141 test_env.AppendUnique(LIBPATH = '/usr/local/lib', | |
142 CPPPATH = '/usr/local/lib', | |
143 LIBS = test_libs) | |
144 | |
145 # Builder for the main program | |
133 program = env.Program(target = os.path.join(build_dir, target_executable), | 146 program = env.Program(target = os.path.join(build_dir, target_executable), |
134 source = map(lambda x: '#' + build_dir + '/src/' + x, | 147 source = map(lambda x: '#' + build_dir + '/src/' + x, |
135 sources)) | 148 sources)) |
149 env.Alias(target_executable, os.path.join(build_dir, target_executable)) | |
136 env.Default(program) | 150 env.Default(program) |
151 | |
152 test = test_env.Program(target = os.path.join(build_dir, test_executable), | |
153 source = map(lambda x: '#' + build_dir + '/src/' + x, | |
154 test_sources)) | |
155 env.Alias('test', os.path.join(build_dir, test_executable)) |