def __AutoConf(self): """This does the equivalent of GNU autoconf - it tries to make the build platform independent. Note that I've only done the minimum amount necessary to get things to compile on Ubuntu and CentOS (and specific versions of those to boot). If you want to compile on anything else you will likely need to update this.""" context = scons.Configure(self.env) self.__lib_names = {} # Check for boost libraries with various names boost_libs = [ 'boost_thread', 'boost_regex', 'boost_unit_test_framework' ] for lib in boost_libs: # Prefer the multi-threaded versions (ending in -mt) if available if context.CheckLib(lib + '-mt', language='C++'): self.__lib_names[lib] = lib + '-mt' elif context.CheckLib(lib, language='C++'): self.__lib_names[lib] = lib else: print 'Error. Library %s not available' % lib scons.Exit(1) self.env = context.Finish()
def check_C_libraries(env, build): print 'Checking for C libraries' # Check for availability of C libraries conf = Script.Configure(env) print 'IMPLICIT', build.implicit_C_libs for c_lib in build.implicit_C_libs: if not conf.CheckLib(c_lib): Script.Exit(1) env = conf.Finish() print 'EXPLICIT' for c_lib in build.explicit_C_libs: print 'Checking for C library %s... ' % c_lib, if path.exists(c_lib): print 'yes' else: print 'no' Script.Exit(1)
def setup(): scons.SetOption('duplicate', 'soft-hard-copy') env = _build_environment() Environment.env = env TestEnvironment.env = env.Clone() if 'AV_DEBUGGER' in os.environ: TestEnvironment.env['ENV']['AV_DEBUGGER'] = os.environ['AV_DEBUGGER'] PythonEnvironment.env = _build_python_environment(env) scons.Help(options.GenerateHelpText(env)) def CheckBoost(context): context.Message('Checking for boost library ... ') ret = context.TryRun( """ #include <iostream> #include <boost/version.hpp> int main(int argc, char **argv) { std::cout << BOOST_LIB_VERSION; return 0; } """, ".cpp") context.Result(ret[0]) return ret[1] def CheckToolset(context): context.Message('Checking for toolset ... ') ret = context.TryRun( """ #include <iostream> int main(int argc, char **argv) { #ifdef __GNUC__ std::cout << "gcc" << __GNUC__ << __GNUC_MINOR__; #else #ifdef _MSC_VER std::cout << "VC++ " << _MSC_VER/100-6 << ".0"; #else std::cout << "unknown"; #endif #endif return 0; } """, ".cpp") context.Result(ret[1]) return ret[1] custom_tests = {'CheckBoost': CheckBoost, 'CheckToolset': CheckToolset} conf_env = env.Clone() if os.path.abspath(env['BUILD']) != os.path.abspath('.'): scons.BuildDir(env['BUILD'], '.', not oshelper.os_is_windows()) env.SConsignFile("${BUILD}/sconsign") conf = scons.Configure(conf_env, custom_tests=custom_tests, conf_dir="${BUILD}/.sconf_temp", log_file="${BUILD}/config.log", help=False) else: conf = scons.Configure(conf_env, custom_tests=custom_tests, help=False) env['BOOST_LIB_VERSION'] = conf.CheckBoost() env['BOOST_TOOLSET'] = conf.CheckToolset() conf.Finish()