Exemplo n.º 1
0
def check_luajit(conf):
    opt = conf.options
    conf.env['LUAJIT_FOUND'] = False

    if conf.options.luaJitIncDir:
        conf.env.INCLUDES_LUAJIT = conf.options.luaJitIncDir
    else:
        conf.env.INCLUDES_LUAJIT = [
            conf.options.gkylDepsDir + '/luajit/include/luajit-2.1'
        ]

    if conf.options.luaJitLibDir:
        conf.env.LIBPATH_LUAJIT = conf.options.luaJitLibDir
    else:
        conf.env.LIBPATH_LUAJIT = [conf.options.gkylDepsDir + '/luajit/lib']

    if conf.options.luaJitShrDir:
        conf.env.SHARE_LUAJIT = conf.options.luaJitShrDir
    else:
        conf.env.SHARE_LUAJIT = conf.options.gkylDepsDir + '/luajit/share/luajit'

    conf.env.LIB_LUAJIT = ["luajit-5.1"]

    conf.start_msg('Checking for LUAJIT')
    conf.check(header_name='lua.hpp',
               features='cxx cxxprogram',
               use="LUAJIT",
               mandatory=True)
    conf.end_msg("Found LuaJIT")
    conf.env['LUAJIT_FOUND'] = True

    return 1
Exemplo n.º 2
0
def check_eigen(conf):
    if conf.options.eigen:
        includes_check = [conf.options.eigen]
    else:
        includes_check = [
            '/usr/include/eigen3', '/usr/local/include/eigen3', '/usr/include',
            '/usr/local/include'
        ]

    conf.start_msg('Checking for Eigen')
    try:
        res = conf.find_file('Eigen/Core', includes_check)
    except:
        res = False

    if res:
        conf.env.INCLUDES_EIGEN = includes_check
        conf.end_msg('ok')
    else:
        if conf.options.eigen:
            msg = 'Not found in %s' % conf.options.eigen
        else:
            msg = 'Not found, use --eigen=/path/to/eigen'
        conf.end_msg(msg, 'RED')
        return 1
Exemplo n.º 3
0
def check_gkyl(conf):
    conf.start_msg("Setting dependency path:")
    conf.end_msg(conf.options.gkylDepsDir)

    conf.start_msg("Setting prefix:")
    conf.end_msg(conf.options.prefix)
    conf.env.PREFIX = conf.options.prefix

    conf.env.append_value('CXXFLAGS', conf.options.gkcxxflags.split(','))
    conf.env.append_value('CFLAGS', conf.options.gkcflags.split(','))
    conf.env.append_value('LDFLAGS', conf.options.gkcflags.split(','))
    if conf.options.gkdebug:
      conf.env.append_value('CXXFLAGS', '-g')
      conf.env.append_value('CFLAGS', '-g')

    conf.env.EXTRALIBS = ' '.join(conf.options.extralibs.split(','))
      
    #conf.start_msg("Checking if CXXFLAGS work")
    #conf.check_cxx(fragment="""#include<stdio.h>\nint main(){return 0;}\n""", execute=True)
    #conf.end_msg("Flags work (%s)" % conf.options.gkcxxflags)

    #conf.start_msg("Checking if CFLAGS work")
    #conf.check_cxx(fragment="""#include<stdio.h>\nint main(){return 0;}\n""", execute=True)
    #conf.end_msg("Flags work (%s)" % conf.options.gkcflags)
    
    return 1
Exemplo n.º 4
0
def check_eigen(conf):
    conf.env['EIGEN_FOUND'] = False
    conf.start_msg('Checking for Eigen')
    includes_check = [
        '/usr/include/eigen3', '/usr/local/include/eigen3', '/usr/include',
        '/usr/local/include'
    ]
    if conf.options.eigen:
        includes_check = [conf.options.eigen]
        conf.env.INCLUDES_EIGEN = [conf.options.eigen]
    else:
        if 'CPPFLAGS' in os.environ:
            includes_check += [
                path[2:] for path in os.environ['CPPFLAGS'].split()
                if path[0:2] == '-I'
            ]

    try:
        res = conf.find_file('Eigen/Core', includes_check)
        index = includes_check.index(res[:-len('Eigen/Core') - 1])
        conf.env.INCLUDES_EIGEN = [includes_check[index]]
        conf.end_msg('ok')
        if Logs.verbose:
            Logs.pprint('CYAN', '	path : %s' % includes_check[index])
        conf.env['EIGEN_FOUND'] = True
    except:
        conf.end_msg('Not found', 'RED')
    return 1
Exemplo n.º 5
0
def check_cython_version(conf, minver):
    conf.start_msg("Checking cython version")
    minver = tuple(minver)
    import re
    version_re = re.compile(r'cython\s*version\s*(?P<major>\d*)\.(?P<minor>\d*)(?:\.(?P<micro>\d*))?', re.I).search
    cmd = conf.cmd_to_list(conf.env['CYTHON'])
    cmd = cmd + ['--version']
    from waflib.Tools import fc_config
    stdout, stderr = fc_config.getoutput(conf, cmd)
    if stdout:
        match = version_re(stdout)
    else:
        match = version_re(stderr)
    if not match:
        conf.fatal("cannot determine the Cython version")
    cy_ver = [match.group('major'), match.group('minor')]
    if match.group('micro'):
        cy_ver.append(match.group('micro'))
    else:
        cy_ver.append('0')
    cy_ver = tuple([int(x) for x in cy_ver])
    if cy_ver < minver:
        conf.end_msg(False)
        conf.fatal("cython version %s < %s" % (cy_ver, minver))
    conf.end_msg(str(cy_ver))
Exemplo n.º 6
0
def check_zmq(conf):
    opt = conf.options
    conf.env['ZMQ_FOUND'] = False
    if not conf.options.enable_zmq:
        return
    # include directory
    if conf.options.zmqIncDir:
        conf.env.INCLUDES_ZMQ = conf.options.zmqIncDir
    else:
        conf.env.INCLUDES_ZMQ = [conf.options.gkylDepsDir + '/zeromq/include/']

    # lib directory
    if conf.options.zmqLibDir:
        conf.env.LIBPATH_ZMQ = conf.options.zmqLibDir
        conf.env.LIB_ZMQ = ["zmq"]
    else:
        conf.env.LIBPATH_ZMQ = [conf.options.gkylDepsDir + '/zeromq/lib']
        conf.env.LIB_ZMQ = ["zmq"]

    conf.start_msg('Checking for ZMQ')
    try:
        conf.check(header_name='zmq.h',
                   features='cxx cxxprogram',
                   use='ZMQ',
                   mandatory=True)
        conf.end_msg("Found ZMQ")
        conf.env['ZMQ_FOUND'] = True
    except:
        conf.env['ZMQ_FOUND'] = False
        conf.end_msg("ZMQ not found", "YELLOW")

    return 1
Exemplo n.º 7
0
def mkspec_try_flags(conf, flagtype, flaglist):
    """
    Check support of the given list of compiler/linker flags.

    :param flagtype: The flag type, cflags, cxxflags or linkflags
    :param flaglist: The list of flags to be checked

    :return: The list of supported flags
    """
    ret = []

    for flag in flaglist:
        conf.start_msg("Checking for %s: %s" % (flagtype, flag))
        try:
            if flagtype == "cflags":
                conf.check_cc(cflags=flag)
            elif flagtype == "cxxflags":
                conf.check_cxx(cxxflags=flag)
            elif flagtype == "linkflags":
                conf.check_cxx(linkflags=flag)
        except conf.errors.ConfigurationError:
            conf.end_msg("no", color="YELLOW")
        else:
            conf.end_msg("yes")
            ret.append(flag)

    return ret
Exemplo n.º 8
0
def check_eigen(conf, **kw):
    required = 'required' in kw and kw.get('required', False)
    includes_check = ['/usr/include/eigen3', '/usr/local/include/eigen3', '/usr/include', '/usr/local/include']
    resibots_dir = conf.options.resibots if hasattr(conf.options, 'resibots') and conf.options.resibots else None

    if resibots_dir:
        includes_check = [resibots_dir + '/include'] + includes_check

    if conf.options.eigen:
        includes_check = [conf.options.eigen + '/include'] + includes_check

    conf.start_msg('Checking for Eigen includes')
    try:
        res = conf.find_file('Eigen/Core', includes_check)
    except:
        res = False

    if res:
        conf.env.INCLUDES_EIGEN = [os.path.expanduser(include) for include in includes_check]
        conf.env.DEFINES_EIGEN = ['USE_EIGEN']
        conf.end_msg('ok')
    else:
        if conf.options.eigen and resibots_dir:
            msg = 'not found in %s nor in %s' % (conf.options.eigen, resibots_dir)
        elif conf.options.eigen or resibots_dir:
            msg = 'not found in %s' % (conf.options.eigen if conf.options.eigen else resibots_dir)
        else:
            msg = 'not found, use --eigen=/path/to/eigen or --resibots=/path/to/resibots'

        if required:
            conf.fatal(msg)
        else:
            conf.end_msg(msg, 'YELLOW')
Exemplo n.º 9
0
def configure(conf):
    conf.load('wurf_dependency_resolve')
    bundle_path = expand_path(conf.options.bundle_path)
    bundle_list = expand_bundle(conf, conf.options.bundle)
    explicit_list = explicit_dependencies(conf.options)
    overlap = set(bundle_list).intersection(set(explicit_list))
    if len(overlap) > 0:
        conf.fatal("Overlapping dependencies %r" % overlap)
    conf.env['BUNDLE_DEPENDENCIES'] = dict()
    for name in bundle_list:
        Utils.check_dir(bundle_path)
        conf.start_msg('Resolve dependency %s' % name)
        key = DEPENDENCY_CHECKOUT_KEY % name
        dependency_checkout = getattr(conf.options, key, None)
        dependency_path = dependencies[name].resolve(
            ctx=conf, path=bundle_path, use_checkout=dependency_checkout)
        conf.end_msg(dependency_path)
        conf.env['BUNDLE_DEPENDENCIES'][name] = dependency_path
    for name in explicit_list:
        key = DEPENDENCY_PATH_KEY % name
        dependency_path = getattr(conf.options, key)
        dependency_path = expand_path(dependency_path)
        conf.start_msg('User resolve dependency %s' % name)
        conf.env['BUNDLE_DEPENDENCIES'][name] = dependency_path
        conf.end_msg(dependency_path)
Exemplo n.º 10
0
def check_avx(conf, lib, required=[], lib_type='shared'):
    paths = conf.env['LIBPATH_' + lib.upper()]
    libs = conf.env['LIB_' + lib.upper()]
    if sys.platform == 'darwin':
        ext = '.dylib'
    else:
        ext = '.so'
    if lib_type == 'static':
        libs = conf.env['STLIB_' + lib.upper()]
        ext = '.a'
    if not isinstance(libs, list):
        libs = [libs]
    if not isinstance(paths, list):
        paths = [paths]
    failed = False
    for l in libs:
        if l in required or len(required) == 0:
            res = test_avx('lib' + l + ext, paths)
            conf.start_msg('AVX compilation of ' + l)
            if not res:
                conf.end_msg('no', 'YELLOW')
                failed = True
            else:
                conf.end_msg('yes', 'GREEN')
    return not failed
Exemplo n.º 11
0
def find_at(conf, check, what, where, **kwargs):
    if not exists(where):
        return False
        
    pkgp = os.getenv("PKG_CONFIG_PATH", "")
    try:
        conf.env.stash()
        conf.env[what + "_HOME"] = where
        conf.env.append_value('PATH',  pjoin(where, "bin"))
        conf.env.append_value('RPATH', pjoin(where, "lib"))
        pkgconf_path = pjoin(where, "lib/pkgconfig")
        conf.env.append_value('PKG_CONFIG_PATH', pkgconf_path)
        conf.to_log("Pkg config path: %s" % conf.env.PKG_CONFIG_PATH)
        
        if pkgp: pkgp = pkgp + ":"
        os.environ["PKG_CONFIG_PATH"] = pkgconf_path + pkgp
        
        conf.parse_flags("-I{0}/include -L{0}/lib".format(where),
                         uselib=kwargs["uselib_store"])
        check(**kwargs)
        return True
    except conf.errors.ConfigurationError:
        os.environ["PKG_CONFIG_PATH"] = pkgp
        conf.end_msg("failed", color="YELLOW")
        conf.env.revert()
        return False
Exemplo n.º 12
0
def check_omni_vrep(conf, **kw):
    required = 'required' in kw and kw.get('required', False)
    includes_check = ['/usr/include', '/usr/local/include']
    resibots_dir = conf.options.resibots if hasattr(conf.options, 'resibots') and conf.options.resibots else None

    if resibots_dir:
        includes_check = [resibots_dir + '/include'] + includes_check

    if conf.options.omni_vrep:
        includes_check = [conf.options.omni_vrep + '/include'] + includes_check

    conf.start_msg('Checking for omni_vrep includes')
    try:
        res = conf.find_file('omni_vrep/omnipointer.hpp', includes_check)
    except:
        res = False

    if res:
        conf.env.INCLUDES_OMNI_VREP = [os.path.expanduser(include) for include in includes_check]
        conf.env.DEFINES_OMNI_VREP = ['USE_OMNI_VREP']
        conf.end_msg('ok')
    else:
        if conf.options.omni_vrep and resibots_dir:
            msg = 'not found in %s nor in %s' % (conf.options.omni_vrep, resibots_dir)
        elif conf.options.omni_vrep or resibots_dir:
            msg = 'not found in %s' % (conf.options.omni_vrep if conf.options.omni_vrep else resibots_dir)
        else:
            msg = 'not found, use --omni_vrep=/path/to/omni_vrep or --resibots=/path/to/resibots'

        if required:
            conf.fatal(msg)
        else:
            conf.end_msg(msg, 'YELLOW')
Exemplo n.º 13
0
def check_mpi(conf):
    opt = conf.options
    conf.env['MPI_FOUND'] = False

    if not conf.options.enable_mpi:
        return
    if conf.options.mpiIncDir:
        conf.env.INCLUDES_MPI = conf.options.mpiIncDir
    else:
        conf.env.INCLUDES_MPI = conf.options.gkylDepsDir + "/openmpi-3.1.2/include"

    if conf.options.mpiLibDir:
        conf.env.LIBPATH_MPI = conf.options.mpiLibDir
    else:
        conf.env.LIBPATH_MPI = conf.options.gkylDepsDir + "/openmpi-3.1.2/lib"

    libList = conf.options.mpiLinkLibs
    conf.env.LIB_MPI = libList.split(',')

    conf.start_msg('Checking for MPI')
    conf.check(header_name='mpi.h',
               features='cxx cxxprogram',
               use="MPI",
               mandatory=True)
    conf.end_msg("Found MPI")

    conf.env['MPI_FOUND'] = True
    return 1
Exemplo n.º 14
0
def check_robot_dart(conf):
    conf.load('boost')
    conf.load('eigen')
    conf.load('dart')
    # In boost you can use the uselib_store option to change the variable the libs will be loaded
    boost_var = 'BOOST_DART'
    conf.check_boost(lib='regex system', min_version='1.46', uselib_store=boost_var)
    conf.check_eigen()
    conf.check_dart()
    includes_check = ['/usr/local/include', '/usr/include']
    libs_check = ['/usr/local/lib', '/usr/lib']
    # You can customize where you want to check
    # e.g. here we search also in a folder defined by an environmental variable
    if 'RESIBOTS_DIR' in os.environ:
    	includes_check = [os.environ['RESIBOTS_DIR'] + '/include'] + includes_check
    	libs_check = [os.environ['RESIBOTS_DIR'] + '/lib'] + libs_check
    if conf.options.robot_dart:
    	includes_check = [conf.options.robot_dart + '/include']
    	libs_check = [conf.options.robot_dart + '/lib']
    try:
    	conf.start_msg('Checking for robot_dart includes')
    	res = conf.find_file('robot_dart/robot.hpp', includes_check)
    	res = res and conf.find_file('robot_dart/robot_control.hpp', includes_check)
    	res = res and conf.find_file('robot_dart/robot_dart_simu.hpp', includes_check)
    	res = res and conf.find_file('robot_dart/descriptors.hpp', includes_check)
    	conf.end_msg('ok')
    	conf.env.INCLUDES_ROBOT_DART = includes_check
    except:
    	conf.end_msg('Not found', 'RED')
    	return
    return 1
Exemplo n.º 15
0
def find_at(conf, check, what, where, **kwargs):
    if not exists(where):
        conf.msg("Specified path for %s" % what, "doesn't exist: %s" % where, color="RED")
        return False
        
    pkgp = os.getenv("PKG_CONFIG_PATH", "")
    try:
        conf.env.stash()
        conf.env[what + "_HOME"] = where
        conf.env.append_value('PATH',  pjoin(where, "bin"))
        conf.env.append_value('RPATH', pjoin(where, "lib"))
        pkgconf_path = pjoin(where, "lib/pkgconfig")
        conf.env.append_value('PKG_CONFIG_PATH', pkgconf_path)
        conf.to_log("Pkg config path: %s" % conf.env.PKG_CONFIG_PATH)
        
        if pkgp: pkgp = pkgp + ":"
        os.environ["PKG_CONFIG_PATH"] = pkgconf_path + pkgp
        
        conf.parse_flags("-I%s/include -L%s/lib" % (where, where),
                         uselib=kwargs["uselib_store"])
        this_kwargs = kwargs.copy()
        this_kwargs['check_path'] = where
        check(**this_kwargs)
        return True
    except conf.errors.ConfigurationError:
        raise
        os.environ["PKG_CONFIG_PATH"] = pkgp
        conf.end_msg("failed", color="YELLOW")
        conf.env.revert()
        return False
Exemplo n.º 16
0
def check_libdynamixel(conf, **kw):
    required = 'required' in kw and kw.get('required', False)
    includes_check = ['/usr/include', '/usr/local/include']
    resibots_dir = conf.options.resibots if hasattr(conf.options, 'resibots') and conf.options.resibots else None

    if resibots_dir:
        includes_check = [resibots_dir + '/include'] + includes_check

    if conf.options.libdynamixel:
        includes_check = [conf.options.libdynamixel + '/include'] + includes_check

    conf.start_msg('Checking for libdynamixel includes')
    try:
        res = conf.find_file('dynamixel/dynamixel.hpp', includes_check)
    except:
        res = False

    if res:
        conf.env.INCLUDES_LIBDYNAMIXEL = [os.path.expanduser(include) for include in includes_check]
        conf.env.DEFINES_LIBDYNAMIXEL = ['USE_LIBDYNAMIXEL']
        conf.end_msg('ok')
    else:
        if conf.options.libdynamixel and resibots_dir:
            msg = 'not found in %s nor in %s' % (conf.options.libdynamixel, resibots_dir)
        elif conf.options.libdynamixel or resibots_dir:
            msg = 'not found in %s' % (conf.options.libdynamixel if conf.options.libdynamixel else resibots_dir)
        else:
            msg = 'not found, use --libdynamixel=/path/to/libdynamixel or --resibots=/path/to/resibots'

        if required:
            conf.fatal(msg)
        else:
            conf.end_msg(msg, 'YELLOW')
Exemplo n.º 17
0
def check_cython_version(conf, minver):
    conf.start_msg("Checking cython version")
    minver = tuple(minver)
    import re
    version_re = re.compile(
        r'cython\s*version\s*(?P<major>\d*)\.(?P<minor>\d*)(?:\.(?P<micro>\d*))?',
        re.I).search
    cmd = conf.cmd_to_list(conf.env['CYTHON'])
    cmd = cmd + ['--version']
    from waflib.Tools import fc_config
    stdout, stderr = fc_config.getoutput(conf, cmd)
    if stdout:
        match = version_re(stdout)
    else:
        match = version_re(stderr)
    if not match:
        conf.fatal("cannot determine the Cython version")
    cy_ver = [match.group('major'), match.group('minor')]
    if match.group('micro'):
        cy_ver.append(match.group('micro'))
    else:
        cy_ver.append('0')
    cy_ver = tuple([int(x) for x in cy_ver])
    if cy_ver < minver:
        conf.end_msg(False)
        conf.fatal("cython version %s < %s" % (cy_ver, minver))
    conf.end_msg(str(cy_ver))
Exemplo n.º 18
0
def check_mpi(conf):
    opt = conf.options

    conf.env['LIB_MPI'] = ''
    conf.env['MPI_FOUND'] = False
    if conf.options.no_mpi:
        return
    if conf.options.mpi:
        conf.env.INCLUDES_MPI = conf.options.mpi + '/include'
        conf.env.LIBPATH_MPI = conf.options.mpi + '/lib'
    else:
        conf.env.INCLUDES_MPI = [
            '/usr/include/mpi', '/usr/local/include/mpi', '/usr/include',
            '/usr/local/include'
        ]
        conf.env.LIBPATH_MPI = [
            '/usr/lib', '/usr/local/lib', '/usr/lib/openmpi'
        ]

    try:
        conf.start_msg('Checking for MPI include')
        res = conf.find_file('mpi.h', conf.env.INCLUDES_MPI)
        conf.end_msg('ok')
        conf.env['MPI_FOUND'] = True
        conf.env.LIB_MPI = ['mpi_cxx', 'mpi']
    except:
        conf.end_msg('Not found', 'RED')
    return 1
Exemplo n.º 19
0
def check_glut(conf):
	conf.env['GLUT_FOUND'] = False
	conf.env.INCLUDES_GLUT = []
	conf.env.LIBPATH_GLUT = []
	if conf.options.glut_include:
		conf.env.INCLUDES_GLUT += [conf.options.glut_include, conf.options.glut_include + '/GL']
	if conf.options.glut_lib:
		conf.env.LIBPATH_GLUT += [conf.options.glut_lib]
	if conf.options.glut:
		conf.env.INCLUDES_GLUT += [conf.options.glut + '/include', conf.options.glut + '/include/GL']
		conf.env.LIBPATH_GLUT += [conf.options.glut + '/lib']
	if len(conf.env.INCLUDES_GLUT) == 0 or len(conf.env.LIBPATH_GLUT) == 0:
		conf.env.INCLUDES_GLUT += ['/usr/include', '/usr/local/include', '/usr/include/GL', '/usr/local/include/GL']
		conf.env.LIBPATH_GLUT += ['/usr/lib', '/usr/local/lib']

	conf.start_msg('Checking for GLUT include')

	if Logs.verbose:
		Logs.pprint('CYAN', '\n   looking in paths : %s' % conf.env.INCLUDES_GLUT )
	# The location and name of the open gl header file in the old version of osx
	try:
		conf.find_file('glut.h', conf.env.INCLUDES_GLUT)
		conf.end_msg('ok')
		conf.env['GLUT_FOUND'] = True
		conf.env.LIB_GLUT = ['glut']
	except:
		conf.end_msg('Not found', 'RED')
        if Logs.verbose:
                Logs.pprint('CYAN', '   looking in library paths : %s' % conf.env.LIBPATH_GLUT )
	return 1
Exemplo n.º 20
0
def check_wt(conf):
    opt = conf.options
    conf.env['WT_FOUND'] = False

    if conf.options.wtIncDir:
        conf.env.INCLUDES_WT = conf.options.wtIncDir
    else:
        conf.env.INCLUDES_WT = [conf.options.gkylDepsDir + '/wt/include']

    if conf.options.wtLibDir:
        conf.env.LIBPATH_WT = conf.options.wtLibDir
    else:
        conf.env.LIBPATH_WT = [conf.options.gkylDepsDir + '/wt/lib']

    conf.env.LIB_WT = ['wthttp', 'wt']

    conf.start_msg('Checking for WT')
    conf.check(header_name='Wt/WApplication.h',
               features='cxx cxxprogram',
               use="WT",
               mandatory=True)
    conf.end_msg("Found Wt")
    conf.env['WT_FOUND'] = True

    return 1
Exemplo n.º 21
0
def mkspec_try_flags(conf, flagtype, flaglist):
    """
    Tries the given list of compiler/linker flags if they are supported by the
    current compiler, and returns the list of supported flags

    :param flagtype: The flag type, cflags, cxxflags or linkflags
    :param flaglist: The list of flags to be checked

    :return: The list of supported flags
    """
    ret = []

    for flag in flaglist:
        conf.start_msg('Checking for %s: %s' % (flagtype, flag))
        try:
            if flagtype == 'cflags':
                conf.check_cc(cflags=flag)
            elif flagtype == 'cxxflags':
                conf.check_cxx(cxxflags=flag)
            elif flagtype == 'linkflags':
                conf.check_cxx(linkflags=flag)
        except conf.errors.ConfigurationError:
            conf.end_msg('no', color='YELLOW')
        else:
            conf.end_msg('yes')
            ret.append(flag)

    return ret
Exemplo n.º 22
0
def _check_default_arch(conf,
                        start_msg,
                        fragment,
                        output_var,
                        compile_filename="test.c",
                        features="c cprogram"):
    env = conf.env

    if not "FILE_BIN" in conf.env:
        file_bin = conf.find_program(["file"], var="FILE_BIN")
    else:
        file_bin = conf.env.FILE_BIN

    conf.start_msg(start_msg)
    ret = conf.check_cc(fragment=fragment,
                        compile_filename=compile_filename,
                        features=features)
    task_gen = conf.test_bld.groups[0][0]
    obj_filename = task_gen.tasks[0].outputs[0].abspath()
    out = conf.cmd_and_log([file_bin, obj_filename])
    m = FILE_MACHO_RE.search(out)
    if m is None:
        conf.fatal("Could not determine arch from output %r" % out)
    else:
        default_arch = m.group(1)
        conf.env[output_var] = default_arch
        conf.end_msg(default_arch)
Exemplo n.º 23
0
def mkspec_try_flags(conf, flagtype, flaglist):
    """
    Tries the given list of compiler/linker flags if they are supported by the
    current compiler, and returns the list of supported flags

    :param flagtype: The flag type, cflags, cxxflags or linkflags
    :param flaglist: The list of flags to be checked

    :return: The list of supported flags
    """
    ret = []

    for flag in flaglist:
        conf.start_msg("Checking for %s: %s" % (flagtype, flag))
        try:
            if flagtype == "cflags":
                conf.check_cc(cflags=flag)
            elif flagtype == "cxxflags":
                conf.check_cxx(cxxflags=flag)
            elif flagtype == "linkflags":
                conf.check_cxx(linkflags=flag)
        except conf.errors.ConfigurationError:
            conf.end_msg("no", color="YELLOW")
        else:
            conf.end_msg("yes")
            ret.append(flag)

    return ret
Exemplo n.º 24
0
def check_hexapod_robdyn_simu(conf):
    includes_check = ['/usr/local/include', '/usr/include']
    libs_check = ['/usr/local/lib', '/usr/lib']

    if 'RESIBOTS_DIR' in os.environ:
        includes_check = [os.environ['RESIBOTS_DIR'] + '/include'
                          ] + includes_check
        libs_check = [os.environ['RESIBOTS_DIR'] + '/lib'] + libs_check

    if conf.options.simu:
        includes_check = [conf.options.simu + '/include']
        libs_check = [conf.options.simu + '/lib']

    try:
        conf.start_msg('Checking for hexapod_robdyn_simu includes')
        res = conf.find_file('hexapod_robdyn/hexapod_robdyn_simu.hpp',
                             includes_check)
        conf.end_msg('ok')
        conf.env.INCLUDES_HEXAPOD_ROBDYN_SIMU = includes_check
        conf.env.LIB_HEXAPOD_ROBDYN_SIMU = 'hexapod_robdyn'

    except:
        conf.end_msg('Not found', 'RED')
        return
    return 1
Exemplo n.º 25
0
def check_rhex_dart(conf):
    conf.load('rhex_controller')

    includes_check = ['/usr/local/include', '/usr/include']
    libs_check = ['/usr/local/lib', '/usr/lib']

    # You can customize where you want to check
    # e.g. here we search also in a folder defined by an environmental variable
    if 'RESIBOTS_DIR' in os.environ:
    	includes_check = [os.environ['RESIBOTS_DIR'] + '/include'] + includes_check
    	libs_check = [os.environ['RESIBOTS_DIR'] + '/lib'] + libs_check

    if conf.options.rhex_dart:
    	includes_check = [conf.options.rhex_dart + '/include']
    	libs_check = [conf.options.rhex_dart + '/lib']

    try:
    	conf.start_msg('Checking for rhex_dart includes')
    	res = conf.find_file('rhex_dart/rhex.hpp', includes_check)
    	res = res and conf.find_file('rhex_dart/rhex_control_hopf.hpp', includes_check)
    	res = res and conf.find_file('rhex_dart/rhex_dart_simu.hpp', includes_check)
    	res = res and conf.find_file('rhex_dart/descriptors.hpp', includes_check)
    	res = res and conf.find_file('rhex_dart/safety_measures.hpp', includes_check)
        res = res and conf.find_file('rhex_dart/visualizations.hpp', includes_check)
    	conf.end_msg('ok')
    	conf.env.INCLUDES_RHEX_DART = includes_check
    except:
    	conf.fatal('Not found')
    	return
    return 1
Exemplo n.º 26
0
def check_opencv(conf):
    # possible path to find headers
    includes_check = [
        '/usr/local/include/opencv2', '/usr/local/include/opencv2/core'
    ]
    libs_check = ['/usr/local/lib', '/usr/lib']
    try:
        conf.start_msg('Checking for opencv includes')
        include_files = ['opencv.hpp', 'mat.hpp']
        for file in include_files:
            conf.find_file(file, includes_check)
        conf.end_msg('got it!')
        conf.env.INCLUDES_OPENCV = includes_check

        conf.start_msg('Checking for opencv libs')
        lib_files = [
            'opencv_core', 'opencv_highgui', 'opencv_imgproc',
            'opencv_calib3d', 'opencv_contrib', 'opencv_features2d',
            'opencv_flann', 'opencv_gpu', 'opencv_legacy', 'opencv_objdetect',
            'opencv_ocl', 'opencv_photo', 'opencv_stitching',
            'opencv_superres', 'opencv_video', 'opencv_videostab'
        ]
        for file in lib_files:
            conf.find_file('lib' + file + '.so', libs_check)
            #print "Found file {}".format(file)
        conf.end_msg('got it!')
        conf.env.LIBPATH_OPENCV = libs_check
        conf.env.LIB_OPENCV = lib_files
    except:
        conf.fatal('opencv not found')
        return
Exemplo n.º 27
0
def mkspec_try_flags(conf, flagtype, flaglist):
    """
    Check support of the given list of compiler/linker flags.

    :param flagtype: The flag type, cflags, cxxflags or linkflags
    :param flaglist: The list of flags to be checked

    :return: The list of supported flags
    """
    ret = []

    for flag in flaglist:
        conf.start_msg('Checking for %s: %s' % (flagtype, flag))
        try:
            if flagtype == 'cflags':
                conf.check_cc(cflags=flag)
            elif flagtype == 'cxxflags':
                conf.check_cxx(cxxflags=flag)
            elif flagtype == 'linkflags':
                conf.check_cxx(linkflags=flag)
        except conf.errors.ConfigurationError:
            conf.end_msg('no', color='YELLOW')
        else:
            conf.end_msg('yes')
            ret.append(flag)

    return ret
Exemplo n.º 28
0
def check_opengl(conf):
        conf.env['OPENGL_FOUND'] = False
        mac_framework = False
        if conf.options.opengl:
                conf.env.INCLUDES_OPENGL = [conf.options.opengl + '/include']
                conf.env.LIBPATH_OPENGL = [conf.options.opengl + '/lib']
        elif platform.system() == 'Darwin':
                __check_bullet_osx(conf)
                mac_framework = True
        else:
                conf.env.INCLUDES_OPENGL = ['/usr/include', '/usr/local/include', '/usr/local/include/GL', '/usr/include/GL']
                conf.env.LIBPATH_OPENGL = ['/usr/lib', '/usr/local/lib']

        conf.start_msg('Checking for OpenGL include')
        if Logs.verbose: Logs.pprint('CYAN', '...')
        if Logs.verbose: Logs.pprint('CYAN', '  Searching in: %s' % conf.env.INCLUDES_OPENGL)
        # The location and name of the open gl header file in the old version of osx
        try:
                if Logs.verbose: Logs.pprint('CYAN', '    Searching for OpenGL/gl.h')    
                res = conf.find_file('OpenGL/gl.h', conf.env.INCLUDES_OPENGL)
                if Logs.verbose: Logs.pprint('CYAN', '    Found at: %s' % res)
                __bullet_header_found(conf, mac_framework)
                return 1
        except:
                if Logs.verbose: Logs.pprint('CYAN', '    Not found')
                pass

        # The location an name of the open gl header file in more recent versions of osx
        try:
                if Logs.verbose: Logs.pprint('CYAN', '    Searching for gl.h')
                res = conf.find_file('gl.h', conf.env.INCLUDES_OPENGL)
                if Logs.verbose: Logs.pprint('CYAN', '    Found at: %s' % res)
                __bullet_header_found(conf, mac_framework)
                return 1
        except:
                if Logs.verbose: Logs.pprint('CYAN', '    Not found')
                pass

        # The location an name of the open gl header file on linux (I think)
        # The location an name of the open gl header file on linux (I think)
        try:
                if Logs.verbose: Logs.pprint('CYAN', '    Searching for OpenGL.h')
                res = conf.find_file('OpenGl.h', conf.env.INCLUDES_OPENGL)
                if Logs.verbose: Logs.pprint('CYAN', '    Found at: %s' % res)
                __bullet_header_found(conf, mac_framework)
                return 1
        except:
                if Logs.verbose: Logs.pprint('CYAN', '    Not found')
                pass
        # The location of the open gl header file on titan
        try:
                if Logs.verbose: Logs.pprint('CYAN', '    Searching for GL/gl.h')
                res = conf.find_file('GL/gl.h', conf.env.INCLUDES_OPENGL)
                if Logs.verbose: Logs.pprint('CYAN', '    Found at: %s' % res)
                __bullet_header_found(conf, mac_framework)
                return 1
        except:
                conf.end_msg('Not found', 'RED')
        return 1
Exemplo n.º 29
0
def check_python_module(conf,module_name):
	conf.start_msg('Python module %s'%module_name)
	try:
		conf.cmd_and_log([conf.env['PYTHON'],'-c','import %s\nprint(1)\n'%module_name])
	except:
		conf.end_msg(False)
		conf.fatal('Could not find the python module %r'%module_name)
	conf.end_msg(True)
Exemplo n.º 30
0
def check_python_module(conf,module_name):
	conf.start_msg('Python module %s'%module_name)
	try:
		conf.cmd_and_log([conf.env['PYTHON'],'-c','import %s\nprint(1)\n'%module_name])
	except:
		conf.end_msg(False)
		conf.fatal('Could not find the python module %r'%module_name)
	conf.end_msg(True)
Exemplo n.º 31
0
def check_python_module(conf, module_name):
    conf.start_msg("Python module %s" % module_name)
    try:
        conf.cmd_and_log(conf.env["PYTHON"] + ["-c", PYTHON_MODULE_TEMPLATE % module_name])
    except:
        conf.end_msg(False)
        conf.fatal("Could not find the python module %r" % module_name)
    conf.end_msg(True)
Exemplo n.º 32
0
def check_python_module(conf,module_name):
	conf.start_msg('Python module %s'%module_name)
	try:
		conf.cmd_and_log(conf.env['PYTHON']+['-c',PYTHON_MODULE_TEMPLATE%module_name])
	except:
		conf.end_msg(False)
		conf.fatal('Could not find the python module %r'%module_name)
	conf.end_msg(True)
Exemplo n.º 33
0
def __bullet_header_found(conf, mac_framework=True):
	conf.end_msg('ok')
	conf.env['OPENGL_FOUND'] = True
	if mac_framework:
		conf.env.FRAMEWORK_OPENGL = ['OpenGL', 'Cocoa']
	else:
		conf.env.LIB_OPENGL = ['GL','GLU']
        	if Logs.verbose:
                	Logs.pprint('CYAN', '   libs : %s' % conf.env.LIB_OPENGL )
Exemplo n.º 34
0
def check_python_module(conf, module_name):
    conf.start_msg('Python module %s' % module_name)
    try:
        conf.cmd_and_log(conf.env['PYTHON'] +
                         ['-c', PYTHON_MODULE_TEMPLATE % module_name])
    except:
        conf.end_msg(False)
        conf.fatal('Could not find the python module %r' % module_name)
    conf.end_msg(True)
Exemplo n.º 35
0
def check_sdl(conf):
	conf.start_msg('Checking for SDL (2.x - sdl2-config)')
	try:
		conf.check_cfg(path='sdl2-config', args='--cflags --libs', package='', uselib_store='SDL')
	except:
		conf.end_msg('sdl2-config not found in the PATH', 'RED')
		return 1
	conf.end_msg('ok')
	conf.env.DEFINES_SDL += ['USE_SDL']
	return 1
Exemplo n.º 36
0
 def check_perl_config_var(var):
     conf.start_msg("Checking for perl $Config{%s}:" % var)
     try:
         v = read_perl_config_var('print $Config{%s}' % var)[0]
         conf.end_msg("'%s'" % (v), 'GREEN')
         return v
     except IndexError:
         conf.end_msg(False, 'YELLOW')
         pass
     return None
Exemplo n.º 37
0
def configure(conf):
	conf.start_msg('Checking for program module')
	# this does not work, since module is exported as a function on valgol:
	# conf.find_program('module')
	# Therfore:
	if os.system('source /usr/local/Modules/current/init/bash && module purge') == 0:
		conf.end_msg('module')
	else:
		conf.end_msg('module not found')
		conf.fatal('Could not find the program module')
def configure(conf):
    """
    The configure function for the bundle dependency tool
    :param conf: the configuration context
    """
    conf.load('wurf_dependency_resolve')

    # Get the path where the bundled dependencies should be
    # placed
    bundle_path = expand_path(conf.options.bundle_path)

    # List all the dependencies to be bundled
    bundle_list = expand_bundle(conf, conf.options.bundle)

    # List all the dependencies with an explicit path
    explicit_list = explicit_dependencies(conf.options)

    # Make sure that no dependencies were both explicitly specified
    # and specified as bundled
    overlap = set(bundle_list).intersection(set(explicit_list))

    if len(overlap) > 0:
        conf.fatal("Overlapping dependencies %r" % overlap)

    conf.env['BUNDLE_DEPENDENCIES'] = dict()

    # Loop over all dependencies and fetch the ones
    # specified in the bundle_list
    for name in bundle_list:

        Utils.check_dir(bundle_path)

        conf.start_msg('Resolve dependency %s' % name)

        key = DEPENDENCY_CHECKOUT_KEY % name
        dependency_checkout = getattr(conf.options, key, None)

        dependency_path = dependencies[name].resolve(
            ctx=conf,
            path=bundle_path,
            use_checkout=dependency_checkout)

        conf.end_msg(dependency_path)

        conf.env['BUNDLE_DEPENDENCIES'][name] = dependency_path

    for name in explicit_list:
        key = DEPENDENCY_PATH_KEY % name
        dependency_path = getattr(conf.options, key)
        dependency_path = expand_path(dependency_path)

        conf.start_msg('User resolve dependency %s' % name)
        conf.env['BUNDLE_DEPENDENCIES'][name] = dependency_path
        conf.end_msg(dependency_path)
Exemplo n.º 39
0
def check_sdl(conf):
	conf.start_msg('Checking for SDL (1.2 - sdl-config)')

	try:
		conf.check_cfg(path='sdl-config', args='--cflags --libs', package='', uselib_store='SDL')
	except:
		conf.end_msg('sdl-config not found', 'RED')
		return 1
	conf.end_msg('ok')
	conf.env.DEFINES_SDL += ['USE_SDL']
	return 1
Exemplo n.º 40
0
def cxx_default(conf, arch=None):
    """
    Detect and setup the default compiler for the platform
    """
    # If the user-defined CXX variable is set
    # then use that compiler as the first option
    if "CXX" in os.environ:
        compiler = os.environ["CXX"]
        conf.start_msg("Checking C++ compiler %r" % compiler)
        load_compiler(conf, compiler, arch)
        if conf.env["CXX"]:
            conf.end_msg(conf.env.get_flat("CXX"))
            conf.env["COMPILER_CXX"] = compiler
            return  # Compiler configured successfully
        else:
            conf.end_msg(False)
            conf.fatal("Could not configure a C++ compiler!")

    # Otherwise we try to find a compiler on the current host
    # based on the following compiler list
    cxx_compilers = {
        "win32": ["msvc", "g++"],
        "linux": ["g++", "clang++"],
        "darwin": ["clang++"],
        "cygwin": ["g++"],
        "default": ["g++"],
    }

    sys_platform = Utils.unversioned_sys_platform()
    platform = "default"
    # Check if we have a specific list for the current system
    if sys_platform in cxx_compilers:
        platform = sys_platform

    # The list of the compilers to be checked
    possible_compiler_list = cxx_compilers[platform]

    for compiler in possible_compiler_list:
        conf.env.stash()
        conf.start_msg("Checking for %r (C++ compiler)" % compiler)
        try:
            load_compiler(conf, compiler, arch)
        except conf.errors.ConfigurationError as e:
            conf.env.revert()
            conf.end_msg(e, color="YELLOW")
            Logs.debug("cxx_default: %r" % e)
        else:
            if conf.env["CXX"]:
                conf.end_msg(conf.env.get_flat("CXX"))
                conf.env["COMPILER_CXX"] = compiler
                break  # Break from the for-cycle
            conf.end_msg(False)
    else:
        conf.fatal("Could not configure a C++ compiler!")
Exemplo n.º 41
0
def cxx_default(conf, arch=None):
    """
    Detect and setup the default compiler for the platform
    """
    # If the user-defined CXX variable is set
    # then use that compiler as the first option
    if 'CXX' in os.environ:
        compiler = os.environ['CXX']
        conf.start_msg('Checking C++ compiler %r' % compiler)
        load_compiler(conf, compiler, arch)
        if conf.env['CXX']:
            conf.end_msg(conf.env.get_flat('CXX'))
            conf.env['COMPILER_CXX'] = compiler
            return  # Compiler configured successfully
        else:
            conf.end_msg(False)
            conf.fatal('Could not configure a C++ compiler!')

    # Otherwise we try to find a compiler on the current host
    # based on the following compiler list
    cxx_compilers = {
        'win32':  ['msvc', 'g++'],
        'linux':  ['g++', 'clang++'],
        'darwin': ['clang++'],
        'cygwin': ['g++'],
        'default': ['g++']
    }

    sys_platform = Utils.unversioned_sys_platform()
    platform = 'default'
    # Check if we have a specific list for the current system
    if sys_platform in cxx_compilers:
        platform = sys_platform

    # The list of the compilers to be checked
    possible_compiler_list = cxx_compilers[platform]

    for compiler in possible_compiler_list:
        conf.env.stash()
        conf.start_msg('Checking for %r (C++ compiler)' % compiler)
        try:
            load_compiler(conf, compiler, arch)
        except conf.errors.ConfigurationError as e:
            conf.env.revert()
            conf.end_msg(e, color='YELLOW')
            Logs.debug('cxx_default: %r' % e)
        else:
            if conf.env['CXX']:
                conf.end_msg(conf.env.get_flat('CXX'))
                conf.env['COMPILER_CXX'] = compiler
                break  # Break from the for-cycle
            conf.end_msg(False)
    else:
        conf.fatal('Could not configure a C++ compiler!')
Exemplo n.º 42
0
def check_python_module(conf, module_name):
	"""
	Check if the selected python interpreter can import the given python module.
	"""
	conf.start_msg('Python module %s' % module_name)
	try:
		conf.cmd_and_log([conf.env['PYTHON'], '-c', 'import %s\nprint(1)\n' % module_name])
	except:
		conf.end_msg(False)
		conf.fatal('Could not find the python module %r' % module_name)
	conf.end_msg(True)
Exemplo n.º 43
0
def check_numpy_version(conf, minver, maxver=None):
    conf.start_msg("Checking numpy version")
    minver = tuple(minver)
    if maxver: maxver = tuple(maxver)
    (np_ver_str,) = conf.get_python_variables(
            ['numpy.version.short_version'], ['import numpy'])
    np_ver = tuple([int(x) for x in np_ver_str.split('.')])
    if np_ver < minver or (maxver and np_ver > maxver):
        conf.end_msg(False)
        conf.fatal("numpy version %s is not in the "
                "range of supported versions: minimum=%s, maximum=%s" % (np_ver_str, minver, maxver))
    conf.end_msg(str(np_ver))
Exemplo n.º 44
0
def check_python_module(conf, module_name, condition=""):
    msg = "Checking for python module '%s'" % module_name
    if condition:
        msg = "%s (%s)" % (msg, condition)
    conf.start_msg(msg)
    try:
        ret = conf.cmd_and_log(conf.env["PYTHON"] + ["-c", PYTHON_MODULE_TEMPLATE % module_name])
    except Exception:
        conf.end_msg(False)
        conf.fatal("Could not find the python module %r" % module_name)
    ret = ret.strip()
    if condition:
        conf.end_msg(ret)
        if ret == "unknown version":
            conf.fatal("Could not check the %s version" % module_name)
        from distutils.version import LooseVersion

        def num(*k):
            if isinstance(k[0], int):
                return LooseVersion(".".join([str(x) for x in k]))
            else:
                return LooseVersion(k[0])

        d = {"num": num, "ver": LooseVersion(ret)}
        ev = eval(condition, {}, d)
        if not ev:
            conf.fatal("The %s version does not satisfy the requirements" % module_name)
    else:
        if ret == "unknown version":
            conf.end_msg(True)
        else:
            conf.end_msg(ret)
Exemplo n.º 45
0
def check_nlopt(conf):
	if conf.options.nlopt:
		includes_check = [conf.options.nlopt + '/include']
		libs_check = [conf.options.nlopt + '/lib']
	else:
		includes_check = ['/usr/local/include', '/usr/include']
		libs_check = ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu/']
		if 'RESIBOTS_DIR' in os.environ:
			includes_check = [os.environ['RESIBOTS_DIR'] + '/include'] + includes_check
			libs_check = [os.environ['RESIBOTS_DIR'] + '/lib'] + libs_check

	try:
		conf.start_msg('Checking for NLOpt includes')
		res = conf.find_file('nlopt.hpp', includes_check)
		conf.end_msg('ok')
	except:
		conf.end_msg('Not found', 'RED')
		return 1
	conf.start_msg('Checking for NLOpt libs')
	found = False
	for lib in ['libnlopt_cxx.so', 'libnlopt_cxx.a', 'libnlopt_cxx.dylib']:
		try:
			found = found or conf.find_file(lib, libs_check)
		except:
			continue
	if not found:
		conf.end_msg('Not found', 'RED')
		return 1
	else:
		conf.end_msg('ok')
		conf.env.INCLUDES_NLOPT = includes_check
		conf.env.LIBPATH_NLOPT = libs_check
		conf.env.DEFINES_NLOPT = ['USE_NLOPT']
		conf.env.LIB_NLOPT = ['nlopt_cxx']
	return 1
Exemplo n.º 46
0
def check_libcmaes(conf):
	if conf.options.libcmaes:
		includes_check = [conf.options.libcmaes + '/include']
		libs_check = [conf.options.libcmaes + '/lib']
	else:
		includes_check = ['/usr/local/include', '/usr/include']
		libs_check = ['/usr/local/lib', '/usr/lib']

	try:
		conf.start_msg('Checking for libcmaes includes')
		res = conf.find_file('libcmaes/cmaes.h', includes_check)
		conf.end_msg('ok')
	except:
		conf.end_msg('Not found', 'RED')
		return 1
	conf.start_msg('Checking for libcmaes libs')
	found = False
	for lib in ['libcmaes.so', 'libcmaes.a', 'libcmaes.dylib']:
		try:
			found = found or conf.find_file(lib, libs_check)
		except:
			continue
	if not found:
		conf.end_msg('Not found', 'RED')
		return 1
	else:
		conf.end_msg('ok')
		conf.env.INCLUDES_LIBCMAES = includes_check
		conf.env.LIBPATH_LIBCMAES = libs_check
		conf.env.DEFINES_LIBCMAES = ['USE_LIBCMAES']
		conf.env.LIB_LIBCMAES= ['cmaes']
	return 1
Exemplo n.º 47
0
def check_libcmaes(conf):
	if conf.options.libcmaes:
		includes_check = [conf.options.libcmaes + '/include']
		libs_check = [conf.options.libcmaes + '/lib']
	else:
		includes_check = ['/usr/local/include', '/usr/include']
		libs_check = ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu/']

	incl = ''
	try:
		conf.start_msg('Checking for libcmaes includes (optional)')
		res = conf.find_file('libcmaes/cmaes.h', includes_check)
		incl = res[:-len('libcmaes/cmaes.h')-1]
		conf.end_msg(incl)
	except:
		conf.end_msg('Not found in %s' % str(includes_check), 'YELLOW')
		return 1
	conf.start_msg('Checking for libcmaes libs (optional)')
	lib_path = ''
	for lib in ['libcmaes.so', 'libcmaes.a', 'libcmaes.dylib']:
		try:
			res = conf.find_file(lib, libs_check)
			lib_path = res[:-len(lib)-1]
		except:
			continue
	if lib_path == '':
		conf.end_msg('Not found in %s' % str(libs_check), 'YELLOW')
		return 1
	else:
		conf.end_msg(lib_path)
		conf.env.INCLUDES_LIBCMAES = [incl]
		conf.env.LIBPATH_LIBCMAES = [lib_path]
		conf.env.DEFINES_LIBCMAES = ['USE_LIBCMAES']
		conf.env.LIB_LIBCMAES= ['cmaes']
	return 1
Exemplo n.º 48
0
def check_filesystem(conf):
    conf.start_msg('Checking filesystem support')
    try:
        conf.check_cxx(
         fragment='\n'.join([
          '#include <filesystem>',
          'int main() { std::tr2::sys::path path; }',
         ]),
         execute=False,
        )
        conf.define('STL_FILESYSTEM_ENABLED', 1)
        conf.end_msg('<filesystem>')
    except:
        conf.end_msg('<boost/filesystem.hpp>')
Exemplo n.º 49
0
def check_robdyn(conf):
	includes_check = ['/usr/local/include/robdyn', '/usr/include/robdyn']
	libs_check = ['/usr/local/lib', '/usr/lib']
	if 'RESIBOTS_DIR' in os.environ:
		includes_check = [os.environ['RESIBOTS_DIR'] + '/include/robdyn'] + includes_check
		libs_check = [os.environ['RESIBOTS_DIR'] + '/lib'] + libs_check

	if conf.options.robdyn:
		includes_check = [conf.options.robdyn + '/include/robdyn']
		libs_check = [conf.options.robdyn + '/lib']

	try:
		conf.start_msg('Checking for robdyn includes')
		res = conf.find_file('ode/environment.hh', includes_check)
		res = res and conf.find_file('ode/environment_hexa.hh', includes_check)
		conf.end_msg('ok')
		conf.start_msg('Checking for robdyn libs')
		res = res and conf.find_file('librobdyn.a', libs_check)
		conf.end_msg('ok')
		conf.env.INCLUDES_ROBDYN = includes_check
		conf.env.LIBPATH_ROBDYN = libs_check
		conf.env.DEFINES_ROBDYN = ['USE_ROBDYN']
		conf.env.LIB_ROBDYN = ['robdyn']
		conf.start_msg('Checking for robdyn osg visitor libs')
		res = res and conf.find_file('librobdyn_osgvisitor.a', libs_check)
		conf.end_msg('ok')
		conf.get_env()['BUILD_GRAPHIC'] = True
		conf.env.LIB_ROBDYN.append('robdyn_osgvisitor');
	except:
		conf.end_msg('Not found', 'RED')
		return
	return 1
Exemplo n.º 50
0
def check_ros(conf):
  if conf.options.ros:
    includes_check = [conf.options.ros + '/include']
    libs_check = [conf.options.ros + '/lib']
  else:
    if 'ROS_DISTRO' not in os.environ:
      conf.start_msg('Checking for ROS')
      conf.end_msg('ROS_DISTRO not in environmental variables', 'RED')
      return 1
    includes_check = ['/opt/ros/' + os.environ['ROS_DISTRO'] + '/include']
    libs_check = ['/opt/ros/' + os.environ['ROS_DISTRO'] + '/lib/']

  try:
    conf.start_msg('Checking for ROS includes')
    res = conf.find_file('ros/ros.h', includes_check)
    conf.end_msg('ok')
    libs = ['roscpp','rosconsole','roscpp_serialization','rostime', 'xmlrpcpp','rosconsole_log4cxx', 'rosconsole_backend_interface']
    conf.start_msg('Checking for ROS libs')
    for lib in libs:
      res = res and conf.find_file('lib'+lib+'.so', libs_check)
    conf.end_msg('ok')
    conf.env.INCLUDES_ROS = includes_check
    conf.env.LIBPATH_ROS = libs_check
    conf.env.LIB_ROS = libs
    conf.env.DEFINES_ROS = ['USE_ROS']
  except:
    conf.end_msg('Not found', 'RED')
    return 1
  return 1
Exemplo n.º 51
0
def check_python_module(conf,module_name,condition=''):
	msg="Checking for python module '%s'"%module_name
	if condition:
		msg='%s (%s)'%(msg,condition)
	conf.start_msg(msg)
	try:
		ret=conf.cmd_and_log(conf.env['PYTHON']+['-c',PYTHON_MODULE_TEMPLATE%module_name])
	except Exception:
		conf.end_msg(False)
		conf.fatal('Could not find the python module %r'%module_name)
	ret=ret.strip()
	if condition:
		conf.end_msg(ret)
		if ret=='unknown version':
			conf.fatal('Could not check the %s version'%module_name)
		from distutils.version import LooseVersion
		def num(*k):
			if isinstance(k[0],int):
				return LooseVersion('.'.join([str(x)for x in k]))
			else:
				return LooseVersion(k[0])
		d={'num':num,'ver':LooseVersion(ret)}
		ev=eval(condition,{},d)
		if not ev:
			conf.fatal('The %s version does not satisfy the requirements'%module_name)
	else:
		if ret=='unknown version':
			conf.end_msg(True)
		else:
			conf.end_msg(ret)
Exemplo n.º 52
0
def check_cpp14(conf):
    conf.start_msg('Checking C++14 support')
    try:
        conf.check_cxx(
         fragment='\n'.join([
          '#include <memory>',
          'class test { test(test&&) = default; };',
          'int main() { auto ptr = std::make_unique<int>(); }',
         ]),
         execute=False,
        )
        conf.end_msg('ok')
    except:
        conf.fatal('failed')
Exemplo n.º 53
0
def check_eigen(conf):
	conf.start_msg('Checking for Eigen')
	if conf.options.eigen:
		conf.env.INCLUDES_EIGEN = [conf.options.eigen]
		conf.env.LIBPATH_EIGEN = [conf.options.eigen]
	else:
		conf.env.INCLUDES_EIGEN = ['/usr/include/eigen3',
                                           '/usr/local/include/eigen3',
                                           '/usr/include', '/usr/local/include']
	try:
		res = conf.find_file('Eigen/Core', conf.env.INCLUDES_EIGEN)
		conf.end_msg('ok')
	except:
		conf.end_msg('Not found', 'RED')
	return 1
Exemplo n.º 54
0
 def add_toolchain(self, conf, compiler, sub_compilers=[], add=True):
     toolchain = '%s_%s-%s_%s-%s' % (self.NAME.lower(), compiler.arch, compiler.NAMES[0].lower(),
                                     compiler.arch_name, compiler.version)
     if sub_compilers:
         toolchain = '%s-%s-%s' % (self.NAME.lower(), compiler.NAMES[0].lower(), compiler.version)
     if add:
         conf.start_msg('  `- %s' % toolchain)
     else:
         conf.start_msg('    `- %s' % compiler.arch)
     try:
         conf.setenv(toolchain, conf.env)
         compiler.load_tools(conf, self)
         self.load_in_env(conf, compiler)
         if not sub_compilers:
             compiler.load_in_env(conf, self)
         v = conf.env
         v.ARCH_NAME = compiler.arch
         v.TOOLCHAIN = toolchain
         v.append_unique('DEFINES', ['BE_PLATFORM=platform_%s'%v.VALID_PLATFORMS[0]])
         if not add:
             v.ENV_PREFIX = compiler.arch
         if not sub_compilers:
             conf.recurse(conf.bugenginenode.abspath()+'/mak/arch/%s'%compiler.arch, once=False)
             self.add_kernel_toolchains(conf)
     except Exception as e:
         conf.end_msg(e, color='RED')
         conf.variant = ''
         return None
     else:
         conf.end_msg(' ')
         if not sub_compilers:
             conf.recurse(conf.bugenginenode.abspath()+'/mak', name='setup', once=False)
         if v.STATIC:
             v.append_unique('DEFINES', ['BE_STATIC=1'])
         conf.variant = ''
         v.TMPDIR = os.path.join(conf.bldnode.abspath(), toolchain)
         v.PREFIX = os.path.join('bld', toolchain)
         conf.variant = ''
         for c in sub_compilers:
             t = self.add_toolchain(conf, c, add=False)
             if t:
                 v.append_unique('SUB_TOOLCHAINS', [t])
         if add:
             for optim in conf.env.ALL_VARIANTS:
                 add_build_command(toolchain, optim)
             conf.env.append_unique('ALL_TOOLCHAINS', toolchain)
         return toolchain
Exemplo n.º 55
0
def check_python_module(conf, module_name):
    """
	Check if the selected python interpreter can import the given python module::

		def configure(conf):
			conf.check_python_module('pygccxml')

	:param module_name: module
	:type module_name: string
	"""
    conf.start_msg("Python module %s" % module_name)
    try:
        conf.cmd_and_log([conf.env["PYTHON"], "-c", "import %s\nprint(1)\n" % module_name])
    except:
        conf.end_msg(False)
        conf.fatal("Could not find the python module %r" % module_name)
    conf.end_msg(True)
Exemplo n.º 56
0
def check_python_module(conf, module_name):
    """
    Check if the selected python interpreter can import the given python module::

        def configure(conf):
            conf.check_python_module('pygccxml')

    :param module_name: module
    :type module_name: string
    """
    conf.start_msg('Python module %s' % module_name)
    try:
        conf.cmd_and_log(conf.env['PYTHON'] + ['-c', PYTHON_MODULE_TEMPLATE % module_name])
    except:
        conf.end_msg(False)
        conf.fatal('Could not find the python module %r' % module_name)
    conf.end_msg(True)