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_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
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
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
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
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
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
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
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
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
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
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
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
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
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
def __find_file_in_list(conf, filename, pathlist): for path in pathlist: try: conf.find_file(filename, path) return [path] except: pass return pathlist
def __find_file_in_list(conf, filename, pathlist): for path in pathlist: try: if Logs.verbose: Logs.pprint('CYAN', ' Looking for %s in %s' % filename, path) conf.find_file(filename, path) return [path] except: pass return pathlist
def check_robox2d(conf): def get_directory(filename, dirs): res = conf.find_file(filename, dirs) return res[:-len(filename) - 1] includes_check = ['/usr/local/include', '/usr/include'] libs_check = ['/usr/local/lib', '/usr/lib'] # OSX/Mac uses .dylib and GNU/Linux .so suffix = 'dylib' if conf.env['DEST_OS'] == 'darwin' else 'so' # 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.robox2d: includes_check = [conf.options.robox2d + '/include'] libs_check = [conf.options.robox2d + '/lib'] try: conf.start_msg('Checking for robox2d includes') res = conf.find_file('robox2d/simu.hpp', includes_check) res = res and conf.find_file('robox2d/robot.hpp', includes_check) res = res and conf.find_file('robox2d/common.hpp', includes_check) include_robox2d = get_directory('robox2d/simu.hpp', includes_check) conf.env.INCLUDES_ROBOX2D = include_robox2d conf.end_msg('ok: ' + include_robox2d) except: conf.fatal('Includes not found') return try: conf.start_msg('Checking for robox2d libs') res = conf.find_file('libRobox2d.' + suffix, libs_check) res = conf.find_file('libRobox2dMagnum.' + suffix, libs_check) conf.env.LIBPATH_ROBOX2D = get_directory('libRobox2d.' + suffix, libs_check) conf.env.LIB_ROBOX2D = ['Robox2d'] conf.env.LIB_ROBOX2D.append('Robox2dMagnum') conf.end_msg('libs: ' + str(conf.env.LIB_ROBOX2D[:])) except: conf.fatal('Libs not found') return return 1
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
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
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')
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')
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')
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
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 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 incl = '' try: conf.start_msg('Checking for NLOpt C++ includes (optional)') res = conf.find_file('nlopt.hpp', includes_check) incl = res[:-len('nlopt.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 NLOpt C++ libs (optional)') lib_path = '' lib_name = '' for lib in [ 'libnlopt_cxx.so', 'libnlopt_cxx.a', 'libnlopt_cxx.dylib', 'libnlopt.so', 'libnlopt.a', 'libnlopt.dylib' ]: try: res = conf.find_file(lib, libs_check) lib_path = res[:-len(lib) - 1] lib_name = os.path.splitext(lib)[0][3:] 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_NLOPT = [incl] conf.env.LIBPATH_NLOPT = [lib_path] conf.env.DEFINES_NLOPT = ['USE_NLOPT'] conf.env.LIB_NLOPT = [lib_name] return 1
def check_sferes(conf): if conf.options.sferes: conf.env.INCLUDES_SFERES = [conf.options.sferes] conf.env.LIBPATH_SFERES = [conf.options.sferes + '/build/default/sferes'] try: res = conf.find_file('sferes/ea/ea.hpp', conf.env.INCLUDES_SFERES) conf.define("USE_SFERES", 1) except: print 'SFERES not found' return 1
def check_eigen(conf): #print "calling eigen config" if conf.options.eigen: conf.env.INCLUDES_EIGEN = [conf.options.eigen] conf.env.LIBPATH_EIGEN = [conf.options.eigen] else: conf.env.INCLUDES_EIGEN = ['/home/hmengist/sferes/include/'] res = conf.find_file('Eigen/Core', conf.env.INCLUDES_EIGEN) return 1
def check_eigen(conf): 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'] res = conf.find_file('Eigen/Core', conf.env.INCLUDES_EIGEN) return 1
def check_yamlcpp(conf): # possible path to find headers includes_check = ['/usr/local/include/'] libs_check = ['/usr/local/lib/'] try: conf.start_msg('Checking for yaml-cpp includes\n') conf.find_file('yaml-cpp/yaml.h', includes_check) conf.find_file('libyaml-cpp.a', libs_check) conf.env.INCLUDES_YAMLCPP = includes_check conf.env.LIBPATH_YAMLCPP= libs_check conf.env.LIB_YAMLCPP = 'yaml-cpp' conf.env.DEFINES_YAMLCPP = ['USE_YAMLCPP'] print(conf.env.INCLUDES_YAMLCPP) conf.end_msg('ok') except: conf.end_msg('Not found', 'RED') return
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
def check_mkl(conf): if conf.options.mkl: includes_mkl = [conf.options.mkl + '/include'] libpath_mkl = [conf.options.mkl + '/lib/intel64'] else: includes_mkl = ['/usr/local/include', '/usr/include', '/opt/intel/mkl/include'] libpath_mkl = ['/usr/local/lib/', '/usr/lib', '/opt/intel/mkl/lib/intel64'] conf.start_msg('Checking Intel MKL includes') try: res = conf.find_file('mkl.h', includes_mkl) conf.end_msg('ok') conf.start_msg('Checking Intel MKL libs') res = res and conf.find_file('libmkl_core.so', libpath_mkl) conf.end_msg('ok') except: print 'Intel MKL not found' return conf.env.LIB_MKL_SEQ = ["mkl_intel_lp64", "mkl_core", "mkl_sequential", "pthread", "m"] conf.env.LIB_MKL_TBB = ["mkl_intel_lp64", "mkl_core", "mkl_tbb_thread", "tbb", "stdc++", "pthread", "m"] if conf.env.CXX_NAME in ["icc", "icpc"]: conf.env.LIB_MKL_OMP = ["mkl_intel_lp64", "mkl_core", "mkl_intel_thread", "pthread", "m"] else: conf.env.LIB_MKL_OMP = ["mkl_intel_lp64", "mkl_core", "mkl_gnu_thread", "dl", "pthread", "m"] conf.env.INCLUDES_MKL_SEQ = includes_mkl conf.env.INCLUDES_MKL_TBB = includes_mkl conf.env.INCLUDES_MKL_OMP = includes_mkl conf.env.LIBPATH_MKL_SEQ = libpath_mkl conf.env.LIBPATH_MKL_TBB = libpath_mkl conf.env.LIBPATH_MKL_OMP = libpath_mkl conf.env.CXXFLAGS_MKL_SEQ = ["-m64", "-DEIGEN_USE_MKL_ALL", "-DMKL_BLAS=MKL_DOMAIN_BLAS"] conf.env.LINKFLAGS_MKL_SEQ = [ "-Wl,--no-as-needed" ] conf.env.CXXFLAGS_MKL_TBB = ["-m64", "-DEIGEN_USE_MKL_ALL" , "-DMKL_BLAS=MKL_DOMAIN_BLAS"] conf.env.LINKFLAGS_MKL_TBB = [ "-Wl,--no-as-needed" ] if conf.env.CXX_NAME in ["icc", "icpc"]: conf.env.CXXFLAGS_MKL_OMP = ["-qopenmp", "-m64", "-DEIGEN_USE_MKL_ALL", "-DMKL_BLAS=MKL_DOMAIN_BLAS" ] else: conf.env.CXXFLAGS_MKL_OMP = ["-fopenmp", "-m64", "-DEIGEN_USE_MKL_ALL", "-DMKL_BLAS=MKL_DOMAIN_BLAS"] conf.end_msg('ok') conf.env.LINKFLAGS_MKL_OMP = [ "-Wl,--no-as-needed" ]
def check_pngwriter(conf): conf.env['PNGWRITER_FOUND'] = False if conf.options.pngwriter: conf.env.INCLUDES_PNGWRITER = [conf.options.pngwriter + '/include'] conf.env.LIBPATH_PNGWRITER = [conf.options.pngwriter + '/lib'] else: conf.env.INCLUDES_PNGWRITER = ['/usr/include', '/usr/local/include'] conf.env.LIBPATH_PNGWRITER = ['/usr/lib', '/usr/local/lib'] try: conf.start_msg('Checking for pngwriter include') conf.env.INCLUDES_PNGWRITER = __find_file_in_list( conf, PNGWRITER_HEADER_FILE, conf.env.INCLUDES_PNGWRITER) conf.find_file(PNGWRITER_HEADER_FILE, conf.env.INCLUDES_PNGWRITER) conf.end_msg('ok') if Logs.verbose: Logs.pprint('CYAN', ' Paths: %s' % conf.env.INCLUDES_PNGWRITER) conf.env['PNGWRITER_FOUND'] = True conf.env.LIB_PNGWRITER = ['pngwriter', 'png'] except: conf.end_msg('Not found', 'RED') if Logs.verbose: traceback.print_exc() return 1
def check_pybind(conf): # possible path to find headers includes_check = ['/usr/local/include/', '/usr/include', '/usr/include/python3.6m'] libs_check = ['/usr/local/lib/'] try: conf.start_msg('Checking for pyBind includes\n') conf.find_file('pybind11/pybind11.h', includes_check) conf.find_file('python3.6m/Python.h', includes_check) #conf.find_file('libyaml-cpp.a', libs_check) conf.env.INCLUDES_PYBIND = includes_check conf.env.LIBPATH_PYBIND= libs_check conf.env.LIB_PYTHON = 'python3.6m' conf.env.DEFINES_PYBIND = ['USE_PYBIND'] print(conf.env.INCLUDES_PYBIND) conf.end_msg('ok') except: conf.end_msg('Not found', 'RED') return
def check_mkl(conf): if conf.options.mkl: includes_mkl = [conf.options.mkl + "/include"] libpath_mkl = [conf.options.mkl + "/lib/intel64"] else: includes_mkl = ["/usr/local/include", "/usr/include", "/opt/intel/mkl/include"] libpath_mkl = ["/usr/local/lib/", "/usr/lib", "/opt/intel/mkl/lib/intel64", "/usr/lib/x86_64-linux-gnu/"] conf.start_msg("Checking Intel MKL includes (optional)") try: res = conf.find_file("mkl.h", includes_mkl) conf.end_msg("ok") conf.start_msg("Checking Intel MKL libs (optional)") res = res and conf.find_file("libmkl_core.so", libpath_mkl) conf.end_msg("ok") except: conf.end_msg("Not found", "RED") return conf.env.LIB_MKL_SEQ = ["mkl_intel_lp64", "mkl_core", "mkl_sequential", "pthread", "m"] conf.env.LIB_MKL_TBB = ["mkl_intel_lp64", "mkl_core", "mkl_tbb_thread", "tbb", "stdc++", "pthread", "m"] if conf.env.CXX_NAME in ["icc", "icpc"]: conf.env.LIB_MKL_OMP = ["mkl_intel_lp64", "mkl_core", "mkl_intel_thread", "pthread", "m"] else: conf.env.LIB_MKL_OMP = ["mkl_intel_lp64", "mkl_core", "mkl_gnu_thread", "dl", "pthread", "m"] conf.env.INCLUDES_MKL_SEQ = includes_mkl conf.env.INCLUDES_MKL_TBB = includes_mkl conf.env.INCLUDES_MKL_OMP = includes_mkl conf.env.LIBPATH_MKL_SEQ = libpath_mkl conf.env.LIBPATH_MKL_TBB = libpath_mkl conf.env.LIBPATH_MKL_OMP = libpath_mkl conf.env.CXXFLAGS_MKL_SEQ = ["-m64", "-DEIGEN_USE_MKL_ALL", "-DMKL_BLAS=MKL_DOMAIN_BLAS"] conf.env.LINKFLAGS_MKL_SEQ = ["-Wl,--no-as-needed"] conf.env.CXXFLAGS_MKL_TBB = ["-m64", "-DEIGEN_USE_MKL_ALL", "-DMKL_BLAS=MKL_DOMAIN_BLAS"] conf.env.LINKFLAGS_MKL_TBB = ["-Wl,--no-as-needed"] if conf.env.CXX_NAME in ["icc", "icpc"]: conf.env.CXXFLAGS_MKL_OMP = ["-qopenmp", "-m64", "-DEIGEN_USE_MKL_ALL", "-DMKL_BLAS=MKL_DOMAIN_BLAS"] else: conf.env.CXXFLAGS_MKL_OMP = ["-fopenmp", "-m64", "-DEIGEN_USE_MKL_ALL", "-DMKL_BLAS=MKL_DOMAIN_BLAS"] conf.env.LINKFLAGS_MKL_OMP = ["-Wl,--no-as-needed"]
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
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 incl = '' try: conf.start_msg('Checking for NLOpt C++ includes (optional)') res = conf.find_file('nlopt.hpp', includes_check) incl = res[:-len('nlopt.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 NLOpt C++ libs (optional)') lib_path = '' for lib in ['libnlopt_cxx.so', 'libnlopt_cxx.a', 'libnlopt_cxx.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_NLOPT = [incl] conf.env.LIBPATH_NLOPT = [lib_path] conf.env.DEFINES_NLOPT = ['USE_NLOPT'] conf.env.LIB_NLOPT = ['nlopt_cxx'] return 1
def check_freetype(conf): conf.env['FREETYPE_FOUND'] = False if conf.options.freetype: conf.env.INCLUDES_FREETYPE = [ conf.options.freetype + '/include', conf.options.freetype + '/include/freetype2' ] conf.env.LIBPATH_FREETYPE = [conf.options.freetype + '/lib'] else: conf.env.INCLUDES_FREETYPE = [ '/usr/include', '/usr/local/include', '/usr/include/freetype2', '/usr/local/include/freetype2' ] conf.env.LIBPATH_FREETYPE = ['/usr/lib', '/usr/local/lib'] try: conf.start_msg('Checking for Freetype2 include') conf.env.INCLUDES_FREETYPE = __find_file_in_list( conf, FREETYPE_HEADER_FILE, conf.env.INCLUDES_FREETYPE) conf.find_file('ft2build.h', conf.env.INCLUDES_FREETYPE) # Freetype-config may provide additional paths that need to be added for freetype to work properly. # For this, we trust freetype-config, we will not check whether certain files are actually in this path. output = subprocess.check_output(["freetype-config", "--cflags"]) additional_includes = [ path[2:] for path in output.split() if path[0:2] == '-I' ] for include in additional_includes: if include not in conf.env.INCLUDES_FREETYPE: conf.env.INCLUDES_FREETYPE.append(include) conf.end_msg('ok') if Logs.verbose: Logs.pprint('CYAN', ' Paths: %s' % conf.env.INCLUDES_FREETYPE) conf.env['FREETYPE_FOUND'] = True conf.env.LIB_FREETYPE = ['freetype'] except: conf.end_msg('Not found', 'RED') return 1
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
def check_eigen(conf): 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/eigen2", "/usr/local/include/eigen3", "/usr/include", "/usr/local/include", ] res = conf.find_file("Eigen/Core", conf.env.INCLUDES_EIGEN) return 1
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
def check_tbb(conf): conf.env.LIB_TBB = ['tbb'] if conf.options.tbb: conf.env.INCLUDES_TBB = [conf.options.tbb + '/include'] conf.env.LIBPATH_TBB = [conf.options.tbb + '/lib'] else: conf.env.INCLUDES_TBB = ['/usr/local/include', '/usr/include'] conf.env.LIBPATH_TBB = ['/usr/local/lib/', '/usr/lib'] try: res = conf.find_file('tbb/parallel_for.h', conf.env.INCLUDES_TBB) conf.define("USE_TBB", 1) except: print 'TBB not found'
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
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
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
def check_dart(conf, **kw): required = 'required' in kw and kw.get('required', False) require_graphics = 'require_graphics' in kw and kw.get('require_graphics', False) includes_check = ['/usr/include', '/usr/local/include'] libs_check = ['/usr/local/lib', '/usr/lib'] 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 libs_check = [resibots_dir + '/lib'] + libs_check if conf.options.dart: includes_check = [conf.options.dart + '/include'] + includes_check libs_check = [conf.options.dart + '/lib'] + libs_check conf.start_msg('Checking for DART includes') res = True try: for incl in ['dart', 'dart-core']: res = res and conf.find_file('dart/' + incl + '.h', includes_check) except: res = False if res: conf.end_msg('ok') else: if conf.options.dart and resibots_dir: msg = 'not found in %s nor in %s' % (conf.options.dart, resibots_dir) elif conf.options.dart or resibots_dir: msg = 'not found in %s' % (conf.options.dart if conf.options.dart else resibots_dir) else: msg = 'not found, use --dart=/path/to/dart or --resibots=/path/to/resibots' if required: conf.fatal(msg) else: conf.end_msg(msg, 'YELLOW') return conf.start_msg('Checking for DART libs') try: for lib in ['dart', 'dart-core']: res = res and conf.find_file('lib' + lib + '.so', libs_check) except: res = False if res: conf.env.INCLUDES_DART = [os.path.expanduser(include) for include in includes_check] + ['/usr/local/include/bullet', '/usr/include/bullet'] conf.env.LIBPATH_DART = [os.path.expanduser(lib) for lib in libs_check] conf.env.LIB_DART = ['dart', 'dart-core', 'assimp', 'LinearMath', 'BulletCollision'] conf.env.DEFINES_DART = ['USE_DART'] conf.end_msg('ok') else: if conf.options.dart and resibots_dir: msg = 'not found in %s nor in %s' % (conf.options.dart, resibots_dir) elif conf.options.dart or resibots_dir: msg = 'not found in %s' % (conf.options.dart if conf.options.dart else resibots_dir) else: msg = 'not found, use --dart=/path/to/dart or --resibots=/path/to/resibots' if required: conf.fatal(msg) else: conf.end_msg(msg, 'YELLOW') conf.start_msg('Checking for DART OSG includes') try: res = conf.find_file('osgDart/osgDart.h', includes_check) except: res = False if res: conf.end_msg('ok') else: if conf.options.dart and resibots_dir: msg = 'not found in %s nor in %s' % (conf.options.dart, resibots_dir) elif conf.options.dart or resibots_dir: msg = 'not found in %s' % (conf.options.dart if conf.options.dart else resibots_dir) else: msg = 'not found, use --dart=/path/to/dart or --resibots=/path/to/resibots' if require_graphics: conf.fatal(msg) else: conf.end_msg(msg, 'YELLOW') return conf.start_msg('Checking for DART OSG libs') try: res = conf.find_file('libosgDart.so', libs_check) except: res = False if res: conf.env.INCLUDES_DART_GRAPHIC = [os.path.expanduser(include) for include in includes_check] conf.env.LIBPATH_DART_GRAPHIC = [os.path.expanduser(lib) for lib in libs_check] conf.env.LIB_DART_GRAPHIC = ['dart', 'dart-core', 'osgDart', 'osg', 'osgViewer', 'osgManipulator', 'osgGA', 'osgDB'] conf.env.DEFINES_DART_GRAPHIC = ['USE_DART_GRAPHIC'] conf.end_msg('ok') else: if conf.options.dart and resibots_dir: msg = 'not found in %s nor in %s' % (conf.options.dart, resibots_dir) elif conf.options.dart or resibots_dir: msg = 'not found in %s' % (conf.options.dart if conf.options.dart else resibots_dir) else: msg = 'not found, use --dart=/path/to/dart or --resibots=/path/to/resibots' if required: conf.fatal(msg) else: conf.end_msg(msg, 'YELLOW')
def check_dart(conf): if conf.options.dart: includes_check = [conf.options.dart + '/include'] libs_check = [conf.options.dart + '/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 # DART requires some of bullets includes (if installed with bullet enabled) bullet_check = ['/usr/local/include/bullet', '/usr/include/bullet'] bullet_found = False try: bullet_found = conf.find_file('btBulletCollisionCommon.h', bullet_check) except: bullet_found = False # DART requires assimp library assimp_check = ['/usr/local/include', '/usr/include'] assimp_libs = ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu/'] assimp_found = False try: assimp_found = conf.find_file('assimp/scene.h', assimp_check) assimp_found = assimp_found and conf.find_file('libassimp.so', assimp_libs) except: assimp_found = False # DART requires OSG library for their graphic version osg_check = ['/usr/local/include', '/usr/include'] osg_libs = ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu'] osg_found = False osg_comp = ['osg', 'osgViewer', 'osgManipulator', 'osgGA', 'osgDB'] try: osg_found = True for f in osg_comp: osg_found = osg_found and conf.find_file(f + '/Version', osg_check) osg_found = osg_found and conf.find_file('lib' + f + '.so', osg_libs) except: osg_found = False try: conf.start_msg('Checking for DART includes (including utils/urdf)') res = conf.find_file('dart/dart.hpp', includes_check) res = res and conf.find_file('dart/utils/utils.hpp', includes_check) res = res and conf.find_file('dart/utils/urdf/urdf.hpp', includes_check) conf.end_msg('ok') try: conf.start_msg('Checking for DART gui includes') res = res and conf.find_file('dart/gui/gui.hpp', includes_check) res = res and conf.find_file('dart/gui/osg/osg.hpp', includes_check) conf.end_msg('ok') except: conf.end_msg('Not found', 'RED') conf.start_msg('DART: Checking for optional Bullet includes') more_includes = [] if bullet_found: more_includes += bullet_check conf.end_msg('ok') else: conf.end_msg('Not found - be sure that your DART installation is without Bullet enabled', 'RED') if assimp_found: more_includes += assimp_check conf.start_msg('Checking for DART libs (including utils/urdf)') res = res and conf.find_file('libdart.so', libs_check) res = res and conf.find_file('libdart-utils.so', libs_check) res = res and conf.find_file('libdart-utils-urdf.so', libs_check) conf.end_msg('ok') conf.env.INCLUDES_DART = includes_check + more_includes conf.env.LIBPATH_DART = libs_check conf.env.LIB_DART = ['dart', 'dart-utils', 'dart-utils-urdf'] conf.start_msg('DART: Checking for Assimp') if assimp_found: conf.end_msg('ok') conf.env.LIBPATH_DART = conf.env.LIBPATH_DART + assimp_libs conf.env.LIB_DART.append('assimp') else: conf.end_msg('Not found - Your programs may not compile', 'RED') if bullet_found: conf.env.LIB_DART.append('BulletCollision') conf.env.LIB_DART.append('LinearMath') try: conf.start_msg('Checking for DART gui libs') res = res and conf.find_file('libdart-gui.so', libs_check) res = res and conf.find_file('libdart-gui-osg.so', libs_check) conf.end_msg('ok') conf.env.INCLUDES_DART_GRAPHIC = conf.env.INCLUDES_DART conf.env.LIBPATH_DART_GRAPHIC = conf.env.LIBPATH_DART conf.env.LIB_DART_GRAPHIC = conf.env.LIB_DART + ['dart-gui', 'dart-gui-osg'] conf.start_msg('DART: Checking for OSG (optional)') if osg_found: conf.env.INCLUDES_DART_GRAPHIC += osg_check conf.env.LIBPATH_DART_GRAPHIC += osg_libs conf.env.LIB_DART_GRAPHIC += osg_comp conf.end_msg('ok') else: conf.end_msg('Not found - Your graphical programs may not compile/link', 'RED') conf.get_env()['BUILD_GRAPHIC'] = True except: conf.end_msg('Not found', 'RED') except: conf.end_msg('Not found', 'RED') return return 1
def check_vrep_ros(conf, **kw): required = 'required' in kw and kw.get('required', False) if conf.options.vrep_ros: includes_check = [conf.options.vrep_ros + '/include'] libs_check = [conf.options.vrep_ros + '/lib'] else: if 'ROS_PACKAGE_PATH' not in os.environ: conf.start_msg('Checking for V-REP ROS plugin') if required: conf.fatal('ROS_PACKAGE_PATH not in environmental variables, use --vrep_ros=/path/to/vrep_ros') else: conf.end_msg('ROS_PACKAGE_PATH not in environmental variables, use --vrep_ros=/path/to/vrep_ros', 'YELLOW') return path = os.environ['ROS_PACKAGE_PATH'] paths = re.split(":", path) path = os.path.join(paths[0], '../devel') includes_check = [path + '/include'] libs_check = [path + '/lib'] conf.start_msg('Checking for V-REP ROS plugin includes') try: res = conf.find_file('vrep_common/VrepInfo.h', includes_check) except: res = False if res: conf.end_msg('ok') else: if conf.options.vrep_ros: msg = 'not found in %s' % conf.options.vrep_ros elif 'ROS_PACKAGE_PATH' in os.environ: msg = 'not found in %s (from ROS_PACKAGE_PATH environmental variable)' % path else: msg = 'not found, use --vrep_ros=/path/to/vrep_ros' if required: conf.fatal(msg) else: conf.end_msg(msg, 'YELLOW') return conf.start_msg('Checking for V-REP ROS plugin libs') try: res = conf.find_file('libv_repExtRos.so', libs_check) except: res = False if res: conf.env.INCLUDES_VREP_ROS = [os.path.expanduser(include) for include in includes_check] conf.env.LIBPATH_VREP_ROS = [os.path.expanduser(lib) for lib in libs_check] conf.env.LIB_VREP_ROS = ['v_repExtRos'] conf.env.DEFINES_VREP_ROS = ['USE_VREP_ROS'] conf.end_msg('ok') else: if conf.options.vrep_ros: msg = 'not found in %s' % conf.options.vrep_ros elif 'ROS_PACKAGE_PATH' in os.environ: msg = 'not found in %s (from ROS_PACKAGE_PATH environmental variable)' % path else: msg = 'not found, use --vrep_ros=/path/to/vrep_ros' if required: conf.fatal(msg) else: conf.end_msg(msg, 'YELLOW')
def check_eigen(conf): 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] try: res = conf.find_file('Eigen/Core', includes_check) incl = res[:-len('Eigen/Core')-1] conf.env.INCLUDES_EIGEN = [incl] conf.end_msg(incl) if conf.options.lapacke_blas: conf.start_msg('Checking for LAPACKE/BLAS (optional)') p1 = subprocess.Popen(["cat", incl+"/Eigen/src/Core/util/Macros.h"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) p2 = subprocess.Popen(["grep", "#define EIGEN_WORLD_VERSION"], stdin=p1.stdout, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p1.stdout.close() out1, err = p2.communicate() p1 = subprocess.Popen(["cat", incl+"/Eigen/src/Core/util/Macros.h"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) p2 = subprocess.Popen(["grep", "#define EIGEN_MAJOR_VERSION"], stdin=p1.stdout, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p1.stdout.close() out2, err = p2.communicate() out1 = out1.decode('UTF-8') out2 = out2.decode('UTF-8') world_version = int(out1.strip()[-1]) major_version = int(out2.strip()[-1]) if world_version == 3 and major_version >= 3: # Check for lapacke and blas extra_libs = ['/usr/lib', '/usr/local/lib', '/usr/local/opt/openblas/lib'] blas_libs = ['blas', 'openblas'] blas_lib = '' blas_path = '' for b in blas_libs: try: if conf.env['DEST_OS']=='darwin': res = conf.find_file('lib'+b+'.dylib', extra_libs) blas_path = res[:-len('lib'+b+'.dylib')-1] else: res = conf.find_file('lib'+b+'.so', extra_libs) blas_path = res[:-len('lib'+b+'.so')-1] except: continue blas_lib = b break lapacke = False lapacke_path = '' try: if conf.env['DEST_OS']=='darwin': res = conf.find_file('liblapacke.dylib', extra_libs) lapacke_path = res[:-len('liblapacke.dylib')-1] else: res = conf.find_file('liblapacke.so', extra_libs) lapacke_path = res[:-len('liblapacke.so')-1] lapacke = True except: lapacke = False if lapacke or blas_lib != '': conf.env.DEFINES_EIGEN = [] if lapacke_path != blas_path: conf.env.LIBPATH_EIGEN = [lapacke_path, blas_path] else: conf.env.LIBPATH_EIGEN = [lapacke_path] conf.env.LIB_EIGEN = [] conf.end_msg('LAPACKE: \'%s\', BLAS: \'%s\'' % (lapacke_path, blas_path)) elif lapacke: conf.end_msg('Found only LAPACKE: %s' % lapacke_path, 'YELLOW') elif blas_lib != '': conf.end_msg('Found only BLAS: %s' % blas_path, 'YELLOW') else: conf.end_msg('Not found in %s' % str(extra_libs), 'RED') if lapacke: conf.env.DEFINES_EIGEN.append('EIGEN_USE_LAPACKE') conf.env.LIB_EIGEN.append('lapacke') if blas_lib != '': conf.env.DEFINES_EIGEN.append('EIGEN_USE_BLAS') conf.env.LIB_EIGEN.append(blas_lib) else: conf.end_msg('LAPACKE/BLAS can be used only with Eigen>=3.3', 'RED') except: conf.fatal('Not found in %s' % str(includes_check)) return 1
def configure( conf ): conf.find_program( 'java' ) conf.env['htmlcompressor_abspath'] = os.path.abspath( conf.find_file( 'htmlcompressor-1.5.3.jar', ['.','./tools' ] ) )
def check_ros(conf, **kw): required = 'required' in kw and kw.get('required', False) 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') if required: conf.fatal('ROS_DISTRO not in environmental variables, use --ros=/path/to/ros') else: conf.end_msg('ROS_DISTRO not in environmental variables, use --ros=/path/to/ros', 'YELLOW') return includes_check = ['/opt/ros/' + os.environ['ROS_DISTRO'] + '/include'] libs_check = ['/opt/ros/' + os.environ['ROS_DISTRO'] + '/lib'] conf.start_msg('Checking for ROS includes') try: res = conf.find_file('ros/ros.h', includes_check) except: res = False if res: conf.end_msg('ok') else: if conf.options.ros: msg = 'not found in %s' % conf.options.ros elif 'ROS_DISTRO' in os.environ: msg = 'not found in %s (from ROS_DISTRO environmental variable)' % os.environ['ROS_DISTRO'] else: msg = 'not found, use --ros=/path/to/ros' if required: conf.fatal(msg) else: conf.end_msg(msg, 'YELLOW') return libs = Utils.to_list(kw.get('lib', [])) conf.start_msg('Checking for ROS libs') try: for lib in libs: res = res and conf.find_file('lib'+lib+'.so', libs_check) except: res = False if res: conf.env.INCLUDES_ROS = [os.path.expanduser(include) for include in includes_check] conf.env.LIBPATH_ROS = [os.path.expanduser(lib) for lib in libs_check] conf.env.LIB_ROS = libs conf.env.DEFINES_ROS = ['USE_ROS'] conf.end_msg('ok') else: if conf.options.ros: msg = 'not found in %s' % conf.options.ros elif 'ROS_DISTRO' in os.environ: msg = 'not found in %s (from ROS_DISTRO environmental variable)' % os.environ['ROS_DISTRO'] else: msg = 'not found, use --ros=/path/to/ros' if required: conf.fatal(msg) else: conf.end_msg(msg, 'YELLOW')
def check_mpi(conf): opt = conf.options conf.env['LIB_MPI'] = '' conf.env['MPI_FOUND'] = False includes_check = [] libs_check = [] if conf.options.no_mpi : return if conf.options.mpi: includes_check = [conf.options.mpi + '/include'] libs_check = [conf.options.mpi + '/lib'] else: includes_check = ['/usr/include/mpi', '/usr/local/include/mpi', '/usr/include', '/usr/local/include'] libs_check = ['/usr/lib', '/usr/local/lib', '/usr/lib/openmpi'] if 'MPI_ROOT' in os.environ: includes_check += [os.environ['MPI_ROOT'] +"/include", os.environ['MPI_ROOT'] +"/include64"] elif 'I_MPI_ROOT' in os.environ: includes_check += [os.environ['I_MPI_ROOT'] +"/include", os.environ['I_MPI_ROOT'] +"/include64"] elif 'CPPFLAGS' in os.environ: includes_check += [path[2:] for path in os.environ['CPPFLAGS'].split() if path[0:2] == '-I'] if 'LD_LIBRARY_PATH' in os.environ: libs_check += os.environ['LD_LIBRARY_PATH'].split(":") try: conf.start_msg('Checking for MPI include (optional)') res = conf.find_file('mpi.h', includes_check) i_index = includes_check.index(res[:-len('mpi.h')-1]) conf.end_msg('ok') if Logs.verbose: Logs.pprint('CYAN', ' path : %s' % includes_check[i_index]) conf.start_msg('Checking for MPI libs (optional)') lib_paths = [] libs = ['libmpi.so'] for l in libs: res = conf.find_file(l, libs_check) index = libs_check.index(res[:-len(l)-1]) if libs_check[index] not in lib_paths: lib_paths += [libs_check[index]] anta_libs = ['mpi_cxx', 'mpicxx'] found = False ii = -1 for i in range(len(anta_libs)): l = 'lib'+anta_libs[i]+'.so' try: res = conf.find_file(l, libs_check) index = libs_check.index(res[:-len(l)-1]) if libs_check[index] not in lib_paths: lib_paths += [libs_check[index]] found = True ii = i break except: continue if not found: conf.end_msg('Not found', 'RED') return 1 conf.end_msg('ok') if Logs.verbose: Logs.pprint('CYAN', ' paths : %s' % lib_paths) Logs.pprint('CYAN', ' libs : %s' % [anta_libs[ii],'mpi']) conf.env.INCLUDES_MPI = includes_check[i_index] conf.env.LIBPATH_MPI = lib_paths conf.env['MPI_FOUND'] = True conf.env.LIB_MPI = [anta_libs[ii],'mpi'] except: conf.end_msg('Not found', 'RED') return 1