def check_hexa_control(conf):
    if conf.options.hexa_control:
        conf.env.INCLUDES_HEXACONTROL = [
            conf.options.hexa_control + '/include'
        ]
    else:
        if 'ROS_PACKAGE_PATH' not in os.environ:
            conf.start_msg('Checking for hexa_control')
            conf.end_msg('Not found', 'RED')
            return
        path = os.environ['ROS_PACKAGE_PATH']
        paths = re.split(":", path)
        path = os.path.join(paths[0], 'hexapod_ros/hexapod_driver/include')
        conf.env.INCLUDES_HEXACONTROL = [path]
        conf.env.LIBPATH_HEXACONTROL = [os.path.join(paths[0], '../devel/lib')]
        conf.env.LIB_HEXACONTROL = ['hexapod_control']

    try:
        conf.start_msg('Checking for hexa_control')
        res = conf.find_file('hexapod_driver/hexapod.hpp',
                             conf.env.INCLUDES_HEXACONTROL)
        res = res and conf.find_file('libhexapod_control.so',
                                     conf.env.LIBPATH_HEXACONTROL)
        conf.end_msg('ok')
    except:
        conf.end_msg('Not found', 'RED')
        return
    return 1
Exemple #2
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
Exemple #3
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
Exemple #4
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
Exemple #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))
Exemple #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
Exemple #7
0
def check_hexapod_controller(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.controller:
        includes_check = [conf.options.controller + '/include']
        libs_check = [conf.options.controller + '/lib']

    try:
        conf.start_msg('Checking for hexapod_controller includes')
        res = conf.find_file('hexapod_controller/hexapod_controller_simple.hpp', includes_check)
        conf.end_msg('ok')
        conf.start_msg('Checking for hexapod_controller libs')
        res = res and conf.find_file('libhexapod_controller_simple.a', libs_check)
        conf.end_msg('ok')
        conf.env.INCLUDES_HEXAPOD_CONTROLLER = includes_check
        conf.env.STLIBPATH_HEXAPOD_CONTROLLER = libs_check
        conf.env.STLIB_HEXAPOD_CONTROLLER = ['hexapod_controller_simple']
    except:
        conf.end_msg('Not found', 'RED')
        return
    return 1
Exemple #8
0
def check_python_module(conf, module_name, condition=''):
    msg = '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)
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
Exemple #10
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')
Exemple #11
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
Exemple #12
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
Exemple #13
0
def check_cutools(conf):
    opt = conf.options
    conf.env['CUTOOLS_FOUND'] = False

    conf.start_msg('Checking for NVCC compiler')
    try:
        conf.find_program('nvcc', var='NVCC', mandatory=True)
        conf.end_msg("Found NVCC")
        if conf.options.cuIncDir:
            conf.env.INCLUDES_CUTOOLS = conf.options.cuIncDir.split(":")

        if conf.options.cuLibDir:
            conf.env.LIBPATH_CUTOOLS = conf.options.cuLibDir.split(":")
        conf.env.OUT = conf.options.out

        libList = conf.options.cuLinkLibs
        conf.env.LIB_CUTOOLS = libList.split(',')
        conf.check(header_name='cuda.h',
                   features='cxx cxxprogram',
                   use="CUTOOLS",
                   mandatory=True)
        conf.check(header_name='cuda_runtime.h',
                   features='cxx cxxprogram',
                   use="CUTOOLS",
                   mandatory=True)
        conf.end_msg("Linking to libraries work")
        conf.env['CUTOOLS_FOUND'] = True
    except:
        conf.end_msg("Not found NVCC", "YELLOW")
        conf.env['CUTOOLS_FOUND'] = False

    return 1
Exemple #14
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
Exemple #15
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
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)
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
Exemple #18
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
Exemple #19
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')
Exemple #20
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)
Exemple #21
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
Exemple #22
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
def check_opencv(conf):
    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 OpenCV2 C++ includes (optional)')
        res = conf.find_file('opencv2/opencv.hpp', includes_check)
        res = conf.find_file('opencv2/ml/ml.hpp', includes_check)
        incl = res[:-len('opencv2/ml/ml.hpp') - 1]
        conf.end_msg(incl)
    except:
        conf.end_msg('Not found in %s' % str(includes_check), 'YELLOW')
        return 1
    conf.start_msg('Checking for OpenCV2 C++ libs (optional)')
    lib_path = ''
    for lib in ['libopencv_core.so', 'libopencv_ml.so']:
        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_OPENCV = [incl]
        conf.env.LIBPATH_OPENCV = [lib_path]
        conf.env.DEFINES_OPENCV = ['USE_OPENCV']
        conf.env.LIB_OPENCV = ['opencv_core', 'opencv_ml']
    return 1
Exemple #24
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
Exemple #25
0
def check_trac_ik(conf):
    if conf.options.trac_ik:
        includes_check = [conf.options.trac_ik + '/include']
        libs_check = [conf.options.trac_ik + '/lib']
    else:
        includes_check = ['/usr/local/include', '/usr/include']
        libs_check = ['/usr/local/lib/', '/usr/lib']

    try:
        conf.start_msg('Checking for TRAC IK includes')
        res = conf.find_file('trac_ik/trac_ik.hpp', includes_check)
        incl = res[:-len('trac_ik/trac_ik.hpp')]
        conf.end_msg('ok')
        lib = 'trac_ik_no_ros'
        conf.start_msg('Checking for TRAC IK lib')
        res = conf.find_file('lib' + lib + '.so', libs_check)
        lib_path = res[:-len('lib' + lib + '.so')]
        conf.end_msg('ok')
        conf.env.INCLUDES_TRAC_IK = [incl]
        conf.env.LIBPATH_TRAC_IK = [lib_path]
        conf.env.LIB_TRAC_IK = [lib]
    except:
        conf.end_msg('Not found', 'RED')
        return 1
    return 1
Exemple #26
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))
Exemple #27
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)
Exemple #28
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
Exemple #29
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
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
Exemple #31
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')
Exemple #32
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)
Exemple #33
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
Exemple #34
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
Exemple #35
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
Exemple #36
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
Exemple #37
0
def check_sdl(conf):
	if conf.options.sdl:
		includes_check = [conf.options.sdl + '/include']
		libs_check = [conf.options.sdl + '/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 SDL 2 C++ includes')
		res = conf.find_file('SDL2/SDL.h', includes_check)
		conf.end_msg('ok')
	except:
		conf.end_msg('Not found', 'RED')
		return 1
	conf.start_msg('Checking for SDL 2 C++ libs')
	found = False
	for lib in ['libSDL2.so', 'libSDL2_image.so']:
		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_SDL = includes_check
		conf.env.LIBPATH_SDL = libs_check
		conf.env.DEFINES_SDL = ['USE_SDL']
		conf.env.LIB_SDL = ['SDL2', 'SDL2_image']
	return 1
Exemple #38
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)
Exemple #39
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)
Exemple #40
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)
Exemple #41
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')
Exemple #42
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!')
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)
Exemple #44
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
Exemple #45
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)
Exemple #46
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))
Exemple #47
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>')
Exemple #48
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')
Exemple #49
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
Exemple #50
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
Exemple #51
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)
Exemple #52
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)
def mkspec_msvc_configure(conf, version):

    conf.env.MSVC_VERSIONS = ['msvc %s' % version]

    # Here we suppress all the "Checking for program CL"
    # messages printed by waf when loading the msvc tool
    conf.env.stash()
    conf.start_msg('Checking for msvc %s compiler' % version)
    try:
        conf.load('msvc')
    except conf.errors.ConfigurationError as e:
        conf.env.revert()
        conf.end_msg(False)
        debug('msvc_common: %r' % e)
    else:
        conf.end_msg(conf.env.get_flat('CXX'))
        conf.end_msg(False)
        conf.mkspec_set_msvc_flags()
Exemple #54
0
def check_python_module(conf, module_name, condition=""):
    """
	Check if the selected python interpreter can import the given python module::

		def configure(conf):
			conf.check_python_module('pygccxml')
			conf.check_python_module('re', condition="ver > num(2, 0, 4) and ver <= num(3, 0, 0)")

	:param module_name: module
	:type module_name: string
	"""
    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)
Exemple #55
0
def extract_archive (conf, archive_path, name, destnode):
	# path is the destination folder where the file will be extracted 
	path = os.path.join (destnode.abspath (), name)

	conf.start_msg("Extracting %s" % os.path.basename(archive_path))

	if os.path.isdir (path): # if output directory already exists, remove it
		shutil.rmtree (path, ignore_errors = True)

	# extract the sources
	os.makedirs (path)

	t = tarfile.open (archive_path)
	t.extractall (destnode.abspath ())
	t.close()

	conf.end_msg("done")

	return path