def find_msvc(conf): """Due to path format limitations, limit operation only to native Win32. Yeah it sucks.""" if sys.platform == "cygwin": conf.fatal("MSVC module does not work under cygwin Python!") # the autodetection is supposed to be performed before entering in this method v = conf.env path = v.PATH compiler = v.MSVC_COMPILER version = v.MSVC_VERSION compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler) v.MSVC_MANIFEST = ( (compiler == "msvc" and version >= 8) or (compiler == "wsdk" and version >= 6) or (compiler == "intel" and version >= 11) ) # compiler cxx = conf.find_program(compiler_name, var="CXX", path_list=path) # before setting anything, check if the compiler is really msvc env = dict(conf.environ) if path: env.update(PATH=";".join(path)) if not conf.cmd_and_log(cxx + ["/nologo", "/help"], env=env): conf.fatal("the msvc compiler could not be identified") # c/c++ compiler v.CC = v.CXX = cxx v.CC_NAME = v.CXX_NAME = "msvc" # linker if not v.LINK_CXX: conf.find_program( linker_name, path_list=path, errmsg="%s was not found (linker)" % linker_name, var="LINK_CXX", ) if not v.LINK_CC: v.LINK_CC = v.LINK_CXX # staticlib linker if not v.AR: stliblink = conf.find_program(lib_name, path_list=path, var="AR") if not stliblink: return v.ARFLAGS = ["/nologo"] # manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later if v.MSVC_MANIFEST: conf.find_program("MT", path_list=path, var="MT") v.MTFLAGS = ["/nologo"] try: conf.load("winres") except Errors.ConfigurationError: Logs.warn("Resource compiler not found. Compiling resource file is disabled")
def cxx_load_tools(conf): """ Load the cxx tool """ if not conf.env.DEST_OS: conf.env.DEST_OS = Utils.unversioned_sys_platform() conf.load('cxx')
def configure(conf): # Only run the configure step from the top-level wscript if conf.is_toplevel(): # Store the options that are specified during the configure step conf.env["stored_options"] = Options.options.__dict__.copy() conf.load('wurf_dependency_bundle')
def cxx_load_tools(conf): """ Loads the Waf c++ extensions """ if not conf.env.DEST_OS: conf.env.DEST_OS = Utils.unversioned_sys_platform() conf.load('cxx')
def ecpp_setupbuild(conf, id, board = None, device = None, platform = None, arch = None): kw = zip('board device platform arch'.split(),(board,device,platform,arch)) for k,v in kw: module = 'ecpp_%s_%s' % (k,v) if os.path.exists(os.path.join(conf.env['ECPP_DIR'], 'waf' , module + '.py')): conf.load(module) conf.setenv("") envname = id if envname not in conf.all_envs: for k,v in kw: func = getattr(conf,'ecpp_setupbuild_%s_%s' % (k,v),None) if func: func(**dict(kw)) break conf.setenv(envname,conf.env) conf.env['ECPP_ENVNAME'] = envname # override build flag if conf.env['ECPP_BUILDLIB_TARGET']: conf.env['ECPP_BUILDLIB'] = True ecpp_libname = 'ecpp_build_%s' % id.lower() conf.env.append_value('ECPP_LIBNAME', ecpp_libname) conf.env.append_value('ECPP_USE', [ecpp_libname]) else: conf.env['ECPP_BUILDLIB'] = False else: conf.fatal("Doubly defined build id")
def find_msvc(conf): if sys.platform=='cygwin': conf.fatal('MSVC module does not work under cygwin Python!') v=conf.env path=v.PATH compiler=v.MSVC_COMPILER version=v.MSVC_VERSION compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler) v.MSVC_MANIFEST=(compiler=='msvc'and version>=8)or(compiler=='wsdk'and version>=6)or(compiler=='intel'and version>=11) cxx=conf.find_program(compiler_name,var='CXX',path_list=path) env=dict(conf.environ) if path: env.update(PATH=';'.join(path)) if not conf.cmd_and_log(cxx+['/nologo','/help'],env=env): conf.fatal('the msvc compiler could not be identified') v.CC=v.CXX=cxx v.CC_NAME=v.CXX_NAME='msvc' if not v.LINK_CXX: conf.find_program(linker_name,path_list=path,errmsg='%s was not found (linker)'%linker_name,var='LINK_CXX') if not v.LINK_CC: v.LINK_CC=v.LINK_CXX if not v.AR: stliblink=conf.find_program(lib_name,path_list=path,var='AR') if not stliblink: return v.ARFLAGS=['/nologo'] if v.MSVC_MANIFEST: conf.find_program('MT',path_list=path,var='MT') v.MTFLAGS=['/nologo'] try: conf.load('winres') except Errors.ConfigurationError: Logs.warn('Resource compiler not found. Compiling resource file is disabled')
def ecpp_setupbuild_arch_avr8(conf,board,device,platform,arch): envname = 'device_%s' % device conf.load('ecpp_toolchain') conf.ecpp_setuptoolchain('avr8') create = envname not in conf.all_envs if create: conf.setenv(envname, conf.env) for x in 'ASFLAGS CFLAGS CXXFLAGS LINKFLAGS'.split(): conf.env.append_value(x, ['-mmcu=%s' % device.lower()]) for x in 'CFLAGS CXXFLAGS'.split(): conf.env.append_value(x, ['-Os', '-funsigned-bitfields', '-fshort-enums', '-fomit-frame-pointer']) conf.env.append_value('LINKFLAGS', ['--static', '-Wl,--gc-sections']) n = conf.root.find_dir(os.path.join(conf.env['ECPP_DIR'],'src')) conf.env.append_value('INCLUDES', n.abspath()) conf.env['DEVICE'] = device # Mark this env to build a ecpp library for # each target independently conf.env['ECPP_BUILDLIB_TARGET'] = True conf.env.append_value('ECPP_FEATURES',['avr-firmware']) else: conf.setenv(envname)
def find_ifort_win32(conf): v=conf.env path=v.PATH compiler=v.MSVC_COMPILER version=v.MSVC_VERSION compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler) v.IFORT_MANIFEST=(compiler=='intel'and version>=11) fc=conf.find_program(compiler_name,var='FC',path_list=path) env=dict(conf.environ) if path: env.update(PATH=';'.join(path)) if not conf.cmd_and_log(fc+['/nologo','/help'],env=env): conf.fatal('not intel fortran compiler could not be identified') v.FC_NAME='IFORT' if not v.LINK_FC: conf.find_program(linker_name,var='LINK_FC',path_list=path,mandatory=True) if not v.AR: conf.find_program(lib_name,path_list=path,var='AR',mandatory=True) v.ARFLAGS=['/nologo'] if v.IFORT_MANIFEST: conf.find_program('MT',path_list=path,var='MT') v.MTFLAGS=['/nologo'] try: conf.load('winres') except Errors.WafError: Logs.warn('Resource compiler not found. Compiling resource file is disabled')
def SAMBA_CHECK_PYTHON(conf, version=(3, 6, 0)): if conf.env.disable_python: version = (2, 6, 0) if conf.env.enable_fuzzing: version = (3, 5, 0) # enable tool to build python extensions if conf.env.HAVE_PYTHON_H: conf.check_python_version(version) return interpreters = [] conf.find_program('python3', var='PYTHON', mandatory=not conf.env.disable_python) conf.load('python') path_python = conf.find_program('python3') conf.env.PYTHON_SPECIFIED = (conf.env.PYTHON != path_python) conf.check_python_version(version) interpreters.append(conf.env['PYTHON']) conf.env.python_interpreters = interpreters
def cc_load_tools(conf): """ Load the c tool """ if not conf.env.DEST_OS: conf.env.DEST_OS = Utils.unversioned_sys_platform() conf.load('c')
def load_compiler(conf, compiler, arch): # Note clang goes first otherwise 'g++' will be in 'clang++' # ¯¯¯ ¯¯¯ if 'clang' in compiler: conf.mkspec_clang_configure(3, 6, minimum=True) elif 'g++' in compiler: conf.mkspec_gxx_configure(4, 9, minimum=True) elif 'msvc' in compiler or 'CL.exe' in compiler or 'cl.exe' in compiler: if arch == 'x86': conf.env.MSVC_TARGETS = ['x86'] elif arch == 'x64': conf.env.MSVC_TARGETS = ['x86_amd64'] conf.load('msvc') # Note: the waf msvc tool also loads msvc as a C compiler conf.mkspec_check_minimum_msvc_version(14.0) conf.mkspec_set_msvc_flags() else: raise Errors.WafError('Unknown compiler: %s' % compiler) if ('clang' in compiler or 'g++' in compiler) and arch: if arch == 'x86': conf.mkspec_add_common_flag('-m32') elif arch == 'x64': conf.mkspec_add_common_flag('-m64')
def load_compiler(conf, compiler, arch): # Note clang goes first otherwise 'g++' will be in 'clang++' # ¯¯¯ ¯¯¯ if 'clang' in compiler: conf.mkspec_clang_configure(3, 6, minimum=True) elif 'g++' in compiler: conf.mkspec_gxx_configure(4, 9, minimum=True) elif 'msvc' in compiler or 'CL.exe' in compiler or 'cl.exe' in compiler: if arch == 'x86': conf.env.MSVC_TARGETS = ['x86'] elif arch == 'x64': conf.env.MSVC_TARGETS = ['x64', 'x86_amd64'] conf.load('msvc') # Note: the waf msvc tool also loads msvc as a C compiler conf.mkspec_check_minimum_msvc_version(14.0) conf.mkspec_set_msvc_flags() else: raise Errors.WafError('Unknown compiler: %s' % compiler) if ('clang' in compiler or 'g++' in compiler) and arch: if arch == 'x86': conf.mkspec_add_common_flag('-m32') elif arch == 'x64': conf.mkspec_add_common_flag('-m64')
def find_msvc(conf): if sys.platform=='cygwin': conf.fatal('MSVC module does not work under cygwin Python!') v=conf.env path=v.PATH compiler=v.MSVC_COMPILER version=v.MSVC_VERSION compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler) v.MSVC_MANIFEST=(compiler=='msvc'and version>=8)or(compiler=='wsdk'and version>=6)or(compiler=='intel'and version>=11) cxx=conf.find_program(compiler_name,var='CXX',path_list=path) env=dict(conf.environ) if path:env.update(PATH=';'.join(path)) if not conf.cmd_and_log(cxx+['/nologo','/help'],env=env): conf.fatal('the msvc compiler could not be identified') v.CC=v.CXX=cxx v.CC_NAME=v.CXX_NAME='msvc' if not v.LINK_CXX: v.LINK_CXX=conf.find_program(linker_name,path_list=path,errmsg='%s was not found (linker)'%linker_name) if not v.LINK_CC: v.LINK_CC=v.LINK_CXX if not v.AR: stliblink=conf.find_program(lib_name,path_list=path,var='AR') if not stliblink: return v.ARFLAGS=['/nologo'] if v.MSVC_MANIFEST: conf.find_program('MT',path_list=path,var='MT') v.MTFLAGS=['/nologo'] try: conf.load('winres') except Errors.ConfigurationError: Logs.warn('Resource compiler not found. Compiling resource file is disabled')
def configure(conf): libs = ["c", "nosys", "m"] c_flags = ["-mno-unaligned-access"] link_flags = ["-Wl,--gc-sections", "--specs=nano.specs"] # configure cc for arm conf.load("c_config") conf.find_armgcc() conf.cc_add_flags() conf.link_add_flags() conf.load("asm") conf.env.ARFLAGS = ['rcs'] conf.env.CC_TGT_F = ['-c', '-o'] conf.env.AS_TGT_F = ["-c", "-o"] conf.env.ASLNK_TGT_F = ["-o"] conf.env.CCLNK_TGT_F = ['-o'] conf.env.CPPPATH_ST = '-I%s' conf.env.DEFINES_ST = '-D%s' conf.env.LIB_ST = '-l%s' # template for adding libs conf.env.LIBPATH_ST = '-L%s' # template for adding libpaths conf.env.CPPFLAGS.extend(c_flags) conf.env.CXXFLAGS.extend("-fno-exceptions") conf.env.LIB = libs conf.env.LINKFLAGS = link_flags conf.env.CXXLNK_TGT_F = ['-o'] conf.env.CXX_TGT_F = ['-c', '-o'] conf.env.INCLUDES = [] conf.env.DEFINES = []
def SAMBA_CHECK_PYTHON(conf, mandatory=True, version=(2, 6, 0)): # enable tool to build python extensions if conf.env.HAVE_PYTHON_H: conf.check_python_version(version) return interpreters = [] if conf.env['EXTRA_PYTHON']: conf.all_envs['extrapython'] = conf.env.derive() conf.setenv('extrapython') conf.env['PYTHON'] = conf.env['EXTRA_PYTHON'] conf.env['IS_EXTRA_PYTHON'] = 'yes' conf.find_program('python', var='PYTHON', mandatory=True) conf.load('python') try: conf.check_python_version(version) except Exception: Logs.warn('extra-python needs to be Python %s.%s.%s or later' % (version[0], version[1], version[2])) raise interpreters.append(conf.env['PYTHON']) conf.setenv('default') conf.find_program('python3', var='PYTHON', mandatory=mandatory) conf.load('python') path_python = conf.find_program('python3') conf.env.PYTHON_SPECIFIED = (conf.env.PYTHON != path_python) conf.check_python_version(version) interpreters.append(conf.env['PYTHON']) conf.env.python_interpreters = interpreters
def find_msvc(conf): if sys.platform=='cygwin': conf.fatal('MSVC module does not work under cygwin Python!') v=conf.env path=v['PATH'] compiler=v['MSVC_COMPILER'] version=v['MSVC_VERSION'] compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler) v.MSVC_MANIFEST=(compiler=='msvc'and version>=8)or(compiler=='wsdk'and version>=6)or(compiler=='intel'and version>=11) cxx=conf.find_program(compiler_name,var='CXX',path_list=path) env=dict(conf.environ) if path:env.update(PATH=';'.join(path)) if not conf.cmd_and_log(cxx+['/nologo','/help'],env=env): conf.fatal('the msvc compiler could not be identified') v['CC']=v['CXX']=cxx v['CC_NAME']=v['CXX_NAME']='msvc' if not v['LINK_CXX']: link=conf.find_program(linker_name,path_list=path) if link:v['LINK_CXX']=link else:conf.fatal('%s was not found (linker)'%linker_name) v['LINK']=link if not v['LINK_CC']: v['LINK_CC']=v['LINK_CXX'] if not v['AR']: stliblink=conf.find_program(lib_name,path_list=path,var='AR') if not stliblink:return v['ARFLAGS']=['/NOLOGO'] if v.MSVC_MANIFEST: conf.find_program('MT',path_list=path,var='MT') v['MTFLAGS']=['/NOLOGO'] try: conf.load('winres') except Errors.WafError: warn('Resource compiler not found. Compiling resource file is disabled')
def load_lmbr_waf_modules(conf, module_table): """ Load a list of modules (with optional platform restrictions) :param module_list: List of modules+platform restrictions to load """ host_platform = Utils.unversioned_sys_platform() for tool_dir in module_table: module_list = module_table[tool_dir] for lmbr_waflib_module in module_list: if ':' in lmbr_waflib_module: module_platform = lmbr_waflib_module.split(':') module = module_platform[0] restricted_platform = module_platform[1] if restricted_platform != host_platform: continue else: module = lmbr_waflib_module try: if tool_dir == GENERAL_WAF_TOOL_DIR: conf.load(module) else: conf.load(module, tooldir=tool_dir) except: conf.fatal( "[Error] Unable to load required module '{}.py'".format( module))
def configure(conf): conf.load('g++') conf.load('gcc') conf.find_program('ldd') conf.check_cxx(lib='z', errmsg=missing_pkg_msg(fedora='zlib-devel', ubuntu='zlib1g-dev')) no_mlx = conf.options.no_mlx conf.env.NO_MLX = no_mlx if not no_mlx: ofed_ok = conf.check_ofed(mandatory=False) if ofed_ok: conf.check_cxx( lib='ibverbs', errmsg= 'Could not find library ibverbs, will use internal version.', mandatory=False) else: Logs.pprint( 'YELLOW', 'Warning: will use internal version of ibverbs. If you need to use Mellanox NICs, install OFED:\n' + 'https://trex-tgn.cisco.com/trex/doc/trex_manual.html#_mellanox_connectx_4_support' )
def filter_target_platforms(conf): """ Filter out any target platforms based on settings or options from the configuration/options :param conf: Configuration context """ # handle disabling android here to avoid having the same block of code in each of the compile_rules # for all the current and future android targets android_enabled = conf.get_env_file_var('ENABLE_ANDROID', required=False, silent=True) if android_enabled == 'True': # We need to validate the JDK path from SetupAssistant before loading the javaw tool. # This way we don't introduce a dependency on lmbrwaflib in the core waflib. jdk_home = conf.get_env_file_var('LY_JDK', required=True) if not jdk_home: conf.fatal( '[ERROR] Missing JDK path from Setup Assistant detected. Please re-run Setup Assistant with "Compile For Android" enabled and run the configure command again.' ) conf.env['JAVA_HOME'] = jdk_home conf.load('javaw') conf.load('android', tooldir=LMBR_WAF_TOOL_DIR) else: android_targets = [ target for target in conf.get_available_platforms() if 'android' in target ] Logs.warn( '[WARN] Removing the following Android target platforms due to "Compile For Android" not checked in Setup Assistant.\n' '\t-> {}'.format(', '.join(android_targets))) for android in android_targets: conf.remove_platform_from_available_platforms(android)
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)
def load_lmbr_waf_modules(conf, module_table): """ Load a list of modules (with optional platform restrictions) :param module_list: List of modules+platform restrictions to load """ host_platform = Utils.unversioned_sys_platform() for tool_dir, module_list in module_table: for lmbr_waflib_module in module_list: if ':' in lmbr_waflib_module: module_platform = lmbr_waflib_module.split(':') module = module_platform[0] restricted_platform = module_platform[1] if restricted_platform != host_platform: continue else: module = lmbr_waflib_module try: if tool_dir == GENERAL_WAF_TOOL_DIR: conf.load(module) else: conf.load(module, tooldir=[tool_dir]) except SyntaxError as syntax_err: conf.fatal("[Error] Unable to load required module '{}.py: {} (Line:{}, Offset:{})'".format(module, syntax_err.msg, syntax_err.lineno, syntax_err.offset)) except Exception as e: conf.fatal("[Error] Unable to load required module '{}.py: {}'".format(module, e.message or e.msg))
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 find_ifort_win32(conf): v=conf.env path=v.PATH compiler=v.MSVC_COMPILER version=v.MSVC_VERSION compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler) v.IFORT_MANIFEST=(compiler=='intel'and version>=11) fc=conf.find_program(compiler_name,var='FC',path_list=path) env=dict(conf.environ) if path:env.update(PATH=';'.join(path)) if not conf.cmd_and_log(fc+['/nologo','/help'],env=env): conf.fatal('not intel fortran compiler could not be identified') v.FC_NAME='IFORT' if not v.LINK_FC: conf.find_program(linker_name,var='LINK_FC',path_list=path,mandatory=True) if not v.AR: conf.find_program(lib_name,path_list=path,var='AR',mandatory=True) v.ARFLAGS=['/nologo'] if v.IFORT_MANIFEST: conf.find_program('MT',path_list=path,var='MT') v.MTFLAGS=['/nologo'] try: conf.load('winres') except Errors.WafError: Logs.warn('Resource compiler not found. Compiling resource file is disabled')
def load_compiler(conf, compiler, arch): # Note clang goes first otherwise 'g++' will be in 'clang++' # ¯¯¯ ¯¯¯ if "clang" in compiler: conf.mkspec_clang_configure(3, 6, minimum=True) elif "g++" in compiler: conf.mkspec_gxx_configure(4, 9, minimum=True) elif "msvc" in compiler or "CL.exe" in compiler or "cl.exe" in compiler: if arch == "x86": conf.env.MSVC_TARGETS = ["x86"] elif arch == "x64": conf.env.MSVC_TARGETS = ["x64", "x86_amd64"] conf.load("msvc") # Note: the waf msvc tool also loads msvc as a C compiler conf.mkspec_check_minimum_msvc_version(14.0) conf.mkspec_set_msvc_flags() else: raise Errors.WafError("Unknown compiler: %s" % compiler) if ("clang" in compiler or "g++" in compiler) and arch: if arch == "x86": conf.mkspec_add_common_flag("-m32") elif arch == "x64": conf.mkspec_add_common_flag("-m64")
def find_msvc(conf): """Due to path format limitations, limit operation only to native Win32. Yeah it sucks.""" if sys.platform == 'cygwin': conf.fatal('MSVC module does not work under cygwin Python!') # the autodetection is supposed to be performed before entering in this method v = conf.env path = v['PATH'] compiler = v['MSVC_COMPILER'] version = v['MSVC_VERSION'] compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler) v.MSVC_MANIFEST = (compiler == 'msvc' and version >= 8) or ( compiler == 'wsdk' and version >= 6) or (compiler == 'intel' and version >= 11) # compiler cxx = None if v['CXX']: cxx = v['CXX'] elif 'CXX' in conf.environ: cxx = conf.environ['CXX'] cxx = conf.find_program(compiler_name, var='CXX', path_list=path) cxx = conf.cmd_to_list(cxx) # before setting anything, check if the compiler is really msvc env = dict(conf.environ) if path: env.update(PATH=';'.join(path)) if not conf.cmd_and_log(cxx + ['/nologo', '/help'], env=env): conf.fatal('the msvc compiler could not be identified') # c/c++ compiler v['CC'] = v['CXX'] = cxx v['CC_NAME'] = v['CXX_NAME'] = 'msvc' # linker if not v['LINK_CXX']: link = conf.find_program(linker_name, path_list=path) if link: v['LINK_CXX'] = link else: conf.fatal('%s was not found (linker)' % linker_name) v['LINK'] = link if not v['LINK_CC']: v['LINK_CC'] = v['LINK_CXX'] # staticlib linker if not v['AR']: stliblink = conf.find_program(lib_name, path_list=path, var='AR') if not stliblink: return v['ARFLAGS'] = ['/NOLOGO'] # manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later if v.MSVC_MANIFEST: conf.find_program('MT', path_list=path, var='MT') v['MTFLAGS'] = ['/NOLOGO'] try: conf.load('winres') except Errors.WafError: warn( 'Resource compiler not found. Compiling resource file is disabled')
def configure(conf): conf.find_dmd() conf.load("ar") conf.load("d") conf.common_flags_dmd() conf.d_platform_flags() if str(conf.env.D).find("ldc") > -1: conf.common_flags_ldc()
def configure(conf): conf.find_dmd() conf.load('ar') conf.load('d') conf.common_flags_dmd() conf.d_platform_flags() if str(conf.env.D).find('ldc') > -1: conf.common_flags_ldc()
def configure(conf): conf.find_android_gcc() conf.load('android-ar', tooldir="waf-tools") conf.gcc_common_flags() conf.android_gcc_modifier_platform() conf.cc_load_tools() conf.cc_add_flags() conf.link_add_flags()
def configure(conf): conf.find_arm_none_eabi_gxx() conf.load('arm-none-eabi-ar', tooldir=os.path.dirname(os.path.realpath(__file__))) conf.gcc_common_flags() conf.gcc_modifier_platform() conf.cxx_load_tools() conf.cxx_add_flags() conf.link_add_flags()
def configure(conf): _set_default_options(conf) conf.find_program('git', var='GIT', mandatory=True) conf.load('cross_none_gnu') conf.load('cross_none_objcopy') conf.load('isix_link') conf.load('build_summary') conf.load('isix_cpudb')
def configure(conf): conf.find_emcc() conf.load('emar', tooldir="waf-tools") conf.emcc_common_flags() conf.emcc_modifier_platform() conf.cc_load_tools() conf.cc_add_flags() conf.link_add_flags()
def configure(conf): conf.find_dmd() conf.load('ar') conf.load('d') conf.common_flags_dmd() conf.d_platform_flags() if str(conf.env.D).find('ldc')>-1: conf.common_flags_ldc()
def find_msvc(conf): """Due to path format limitations, limit operation only to native Win32. Yeah it sucks.""" if sys.platform == 'cygwin': conf.fatal('MSVC module does not work under cygwin Python!') # the autodetection is supposed to be performed before entering in this method v = conf.env path = v.PATH compiler = v.MSVC_COMPILER version = v.MSVC_VERSION compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler) v.MSVC_MANIFEST = (compiler == 'msvc' and version >= 8) or ( compiler == 'wsdk' and version >= 6) or (compiler == 'intel' and version >= 11) # compiler cxx = conf.find_program(compiler_name, var='CXX', path_list=path) # before setting anything, check if the compiler is really msvc env = dict(conf.environ) if path: env.update(PATH=';'.join(path)) if not conf.cmd_and_log(cxx + ['/nologo', '/help'], env=env): conf.fatal('the msvc compiler could not be identified') # c/c++ compiler v.CC = v.CXX = cxx v.CC_NAME = v.CXX_NAME = 'msvc' # linker if not v.LINK_CXX: # TODO: var=LINK_CXX to let so that LINK_CXX can be overridden? v.LINK_CXX = conf.find_program(linker_name, path_list=path, errmsg='%s was not found (linker)' % linker_name) if not v.LINK_CC: v.LINK_CC = v.LINK_CXX # staticlib linker if not v.AR: stliblink = conf.find_program(lib_name, path_list=path, var='AR') if not stliblink: return v.ARFLAGS = ['/nologo'] # manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later if v.MSVC_MANIFEST: conf.find_program('MT', path_list=path, var='MT') v.MTFLAGS = ['/nologo'] try: conf.load('winres') except Errors.ConfigurationError: Logs.warn( 'Resource compiler not found. Compiling resource file is disabled')
def configure(conf): """ Configuration for gdc """ conf.find_gdc() conf.load('ar') conf.load('d') conf.common_flags_gdc() conf.d_platform_flags()
def load_external_tool(conf, category, name): if not conf.has_dependency_path('waf-tools'): conf.fatal(load_error) # Get the path and load the tool path = conf.dependency_path('waf-tools') conf.load([name], tooldir=[os.path.join(path, category)])
def configure(conf): """ Configuration for *ldc2* """ conf.find_ldc2() conf.load('ar') conf.load('d') conf.common_flags_ldc2() conf.d_platform_flags()
def options(conf): conf.add_option('--cross', default='arm-none-eabi-', help='Cross compiler prefix, e.g. arm-none-eabi-') conf.add_option('--disable-defconfig', help='Disable reading configuration from config.json', action='store_true', default=False) conf.load('isix_cpudb')
def find_msvc(conf): """Due to path format limitations, limit operation only to native Win32. Yeah it sucks.""" if sys.platform == 'cygwin': conf.fatal('MSVC module does not work under cygwin Python!') # the autodetection is supposed to be performed before entering in this method v = conf.env path = v['PATH'] compiler = v['MSVC_COMPILER'] version = v['MSVC_VERSION'] compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler) v.MSVC_MANIFEST = (compiler == 'msvc' and version >= 8) or (compiler == 'wsdk' and version >= 6) or (compiler == 'intel' and version >= 11) # compiler cxx = None if v['CXX']: cxx = v['CXX'] elif 'CXX' in conf.environ: cxx = conf.environ['CXX'] cxx = conf.find_program(compiler_name, var='CXX', path_list=path) cxx = conf.cmd_to_list(cxx) # before setting anything, check if the compiler is really msvc env = dict(conf.environ) if path: env.update(PATH = ';'.join(path)) if not conf.cmd_and_log(cxx + ['/nologo', '/help'], env=env): conf.fatal('the msvc compiler could not be identified') # c/c++ compiler v['CC'] = v['CXX'] = cxx v['CC_NAME'] = v['CXX_NAME'] = 'msvc' # linker if not v['LINK_CXX']: link = conf.find_program(linker_name, path_list=path) if link: v['LINK_CXX'] = link else: conf.fatal('%s was not found (linker)' % linker_name) v['LINK'] = link if not v['LINK_CC']: v['LINK_CC'] = v['LINK_CXX'] # staticlib linker if not v['AR']: stliblink = conf.find_program(lib_name, path_list=path, var='AR') if not stliblink: return v['ARFLAGS'] = ['/NOLOGO'] # manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later if v.MSVC_MANIFEST: conf.find_program('MT', path_list=path, var='MT') v['MTFLAGS'] = ['/NOLOGO'] try: conf.load('winres') except Errors.WafError: warn('Resource compiler not found. Compiling resource file is disabled')
def find_gas(conf): """ Find the programs gas/as/gcc and set the variable *AS* """ cross_gcc = '%sgcc' % conf.options.cross cross_gas = '%sgas' % conf.options.cross conf.find_program([cross_gcc, cross_gas], var='AS') conf.env.AS_TGT_F = ['-c', '-o'] conf.env.ASLNK_TGT_F = ['-o'] conf.find_ar() conf.load('asm')
def configure(conf): conf.find_arm_none_eabi_gcc() conf.load("arm-none-eabi-ar", tooldir=os.path.dirname(os.path.realpath(__file__))) conf.gcc_common_flags() conf.gcc_modifier_platform() conf.cc_load_tools() conf.cc_add_flags() conf.link_add_flags() v = conf.env v["SHLIB_MARKER"] = [] v["STLIB_MARKER"] = []
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)
def SAMBA_CHECK_PERL(conf, mandatory=True, version=(5, 0, 0)): if "done" in done: return done["done"] = True conf.find_program('perl', var='PERL', mandatory=mandatory) conf.load('perl') path_perl = conf.find_program('perl') conf.env.PERL_SPECIFIED = (conf.env.PERL != path_perl) conf.check_perl_version(version) def read_perl_config_var(cmd): output = Utils.cmd_output( [conf.env.get_flat('PERL'), '-MConfig', '-e', cmd]) if not isinstance(output, str): output = output.decode('utf8') return Utils.to_list(output) def check_perl_config_var(var): conf.start_msg("Checking for perl $Config{%s}:" % var) try: v = read_perl_config_var('print $Config{%s}' % var)[0] conf.end_msg("'%s'" % (v), 'GREEN') return v except IndexError: conf.end_msg(False, 'YELLOW') pass return None vendor_prefix = check_perl_config_var('vendorprefix') perl_arch_install_dir = None if vendor_prefix == conf.env.PREFIX: perl_arch_install_dir = check_perl_config_var('vendorarch') if perl_arch_install_dir is None: perl_arch_install_dir = "${LIBDIR}/perl5" conf.start_msg("PERL_ARCH_INSTALL_DIR: ") conf.end_msg("'%s'" % (perl_arch_install_dir), 'GREEN') conf.env.PERL_ARCH_INSTALL_DIR = perl_arch_install_dir perl_lib_install_dir = None if vendor_prefix == conf.env.PREFIX: perl_lib_install_dir = check_perl_config_var('vendorlib') if perl_lib_install_dir is None: perl_lib_install_dir = "${DATADIR}/perl5" conf.start_msg("PERL_LIB_INSTALL_DIR: ") conf.end_msg("'%s'" % (perl_lib_install_dir), 'GREEN') conf.env.PERL_LIB_INSTALL_DIR = perl_lib_install_dir perl_inc = read_perl_config_var('print "@INC"') if '.' in perl_inc: perl_inc.remove('.') conf.start_msg("PERL_INC: ") conf.end_msg("%s" % (perl_inc), 'GREEN') conf.env.PERL_INC = perl_inc
def configure(conf): conf.load('g++') conf.load('gcc') conf.find_program('ldd') conf.check_cxx(lib = 'z', errmsg = missing_pkg_msg(fedora = 'zlib-devel', ubuntu = 'zlib1g-dev')) ofed_ok = conf.check_ofed(mandatory = False) if ofed_ok: conf.check_cxx(lib = 'ibverbs', errmsg = 'Could not find library ibverbs, will use internal version.', mandatory = False) else: Logs.pprint('YELLOW', 'Warning: will use internal version of ibverbs. If you need to use Mellanox NICs, install OFED:\n' + 'https://trex-tgn.cisco.com/trex/doc/trex_manual.html#_mellanox_connectx_4_support')
def configure(conf): conf.find_dmd() if sys.platform=='win32': out=conf.cmd_and_log([conf.env.D,'--help']) if out.find("D Compiler v2.")>-1: conf.fatal('dmd2 on Windows is not supported, use gdc or ldc instead') conf.load('ar') conf.load('d') conf.common_flags_dmd() conf.d_platform_flags() if str(conf.env.D).find('ldc')>-1: conf.common_flags_ldc()
def configure(conf): conf.find_dmd() if sys.platform=='win32': out=conf.cmd_and_log([conf.env.D,'--help']) if out.find("D Compiler v2.")>-1: conf.fatal('dmd2 on Windows is not supported, use gdc or ldc2 instead') conf.load('ar') conf.load('d') conf.common_flags_dmd() conf.d_platform_flags() if str(conf.env.D).find('ldc')>-1: conf.common_flags_ldc()
def find_msvc(conf): """Due to path format limitations, limit operation only to native Win32. Yeah it sucks.""" if sys.platform == 'cygwin': conf.fatal('MSVC module does not work under cygwin Python!') # the autodetection is supposed to be performed before entering in this method v = conf.env path = v.PATH compiler = v.MSVC_COMPILER version = v.MSVC_VERSION compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler) v.MSVC_MANIFEST = (compiler == 'msvc' and version >= 8) or (compiler == 'wsdk' and version >= 6) or (compiler == 'intel' and version >= 11) # compiler cxx = conf.find_program(compiler_name, var='CXX', path_list=path) # before setting anything, check if the compiler is really msvc env = dict(conf.environ) if path: env.update(PATH = ';'.join(path)) if not conf.cmd_and_log(cxx + ['/nologo', '/help'], env=env): conf.fatal('the msvc compiler could not be identified') # c/c++ compiler v.CC = v.CXX = cxx v.CC_NAME = v.CXX_NAME = 'msvc' # linker if not v.LINK_CXX: # TODO: var=LINK_CXX to let so that LINK_CXX can be overridden? v.LINK_CXX = conf.find_program(linker_name, path_list=path, errmsg='%s was not found (linker)' % linker_name) if not v.LINK_CC: v.LINK_CC = v.LINK_CXX # staticlib linker if not v.AR: stliblink = conf.find_program(lib_name, path_list=path, var='AR') if not stliblink: return v.ARFLAGS = ['/nologo'] # manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later if v.MSVC_MANIFEST: conf.find_program('MT', path_list=path, var='MT') v.MTFLAGS = ['/nologo'] try: conf.load('winres') except Errors.ConfigurationError: Logs.warn('Resource compiler not found. Compiling resource file is disabled')
def check_module_load_options(conf): if hasattr(check_module_load_options, 'did_check'): return check_module_load_options.did_check = True crash_reporter_file = 'crash_reporting' crash_reporter_path = os.path.join(LMBR_WAF_TOOL_DIR,crash_reporter_file + '.py') if conf.options.external_crash_reporting: if os.path.exists(crash_reporter_path): conf.load(crash_reporter_file, tooldir=[LMBR_WAF_TOOL_DIR])
def configure(conf): # Check that the NDK path was given on the command-line conf.msg("NDK path configured with --ndk", conf.options.ndk != None) if not conf.options.ndk: raise "no NDK path" conf.load('android-gcc', tooldir="waf-tools") conf.find_android_gxx() conf.load('android-ar', tooldir="waf-tools") conf.android_gxx_common_flags() conf.android_gxx_modifier_platform() conf.cxx_load_tools() conf.cxx_add_flags() conf.link_add_flags()
def ecpp_setupbuild_platform_netx(conf, device, board, platform, arch): global netx_cpu if not device: device, ldscript = netx_boards[board], 'board_hilscher_%s.ld' % board else: ldscript = 'device_hilscher_%s.ld' % device cpu = netx_cpu[device] envname = 'device_%s' % device conf.load('ecpp_toolchain') conf.ecpp_setuptoolchain('arm') if envname not in conf.all_envs: conf.setenv(envname, conf.env) for x in 'CFLAGS CXXFLAGS LINKFLAGS'.split(): conf.env.append_value(x, ['-mthumb-interwork','-mcpu=%s' % cpu]) for x in 'CFLAGS CXXFLAGS LINKFLAGS'.split(): conf.env.append_value(x + "_compile_thumb", ['-mthumb']) for x in 'CFLAGS CXXFLAGS LINKFLAGS'.split(): conf.env.append_value(x + "_compile_arm", ['-marm']) conf.env.append_value('LINKFLAGS', ['-nodefaultlibs', '--static', '-Wl,--gc-sections']) ldscript = conf.root.find_node(os.path.join(conf.env['ECPP_DIR'],'linkerscripts',ldscript)) if ldscript: conf.env['LINKERSCRIPT'] = ldscript.abspath() conf.env['DEVICE'] = device # Mark this env to build a ecpp library for conf.env['ECPP_BUILDLIB'] = True conf.env.append_value('ECPP_LIBNAME', 'ecpp_%s' % conf.env['DEVICE'].lower()) # new libc needs ecpp library for support code! conf.env['STLIB_c'] = ['c', 'ecpp_%s' % conf.env['DEVICE'].lower()] # lib gcc needs memcpy from libc conf.env['STLIB_gcc'] = ['gcc', 'c'] conf.env.append_value('ECPP_FEATURES',['netx-firmware']) else: conf.setenv(envname)
def ecpp_setupbuild_platform_stm32(conf, device, board, platform, arch): global stm32_vars ldscript = 'device_%s.ld' % device vars = stm32_vars[device] envname = 'device_%s' % device conf.load('ecpp_toolchain ecpp_platform_arm') conf.ecpp_setuptoolchain('arm') create = envname not in conf.all_envs if create: conf.setenv(envname, conf.env) conf.env['ECPP_ENVNAME'] = envname for k,v in vars.items(): conf.env.append_value(k, Utils.to_list(v)) for x in 'CFLAGS CXXFLAGS LINKFLAGS'.split(): conf.env.append_value(x + "_release", ['-Os']) conf.env.append_value(x + "_debug", ['-O0']) conf.env.append_value('LINKFLAGS', ['-nodefaultlibs', '--static', '-Wl,--gc-sections']) ldscript = conf.root.find_node(os.path.join(conf.env['ECPP_DIR'],'linkerscripts',ldscript)) if ldscript: conf.env['LINKERSCRIPT'] = ldscript.abspath() conf.env['DEVICE'] = device # new libc needs ecpp library for support code! conf.env['STLIB_c'] = ['c', 'ecpp_%s' % conf.env['DEVICE'].lower()] conf.env['STLIB_gcc'] = ['gcc', 'c'] # Mark this env to build a ecpp library for conf.env['ECPP_BUILDLIB'] = True conf.env.append_value('ECPP_LIBNAME', 'ecpp_%s' % conf.env['DEVICE'].lower()) conf.env.append_value('ECPP_FEATURES',['stm32-firmware']) else: conf.setenv(envname)
def configure(conf): """ Configuration for *dmd*, *dmd2*, and *ldc* """ conf.find_dmd() if sys.platform == 'win32': out = conf.cmd_and_log(conf.env.D + ['--help']) if out.find('D Compiler v2.') > -1: conf.fatal('dmd2 on Windows is not supported, use gdc or ldc2 instead') conf.load('ar') conf.load('d') conf.common_flags_dmd() conf.d_platform_flags() if str(conf.env.D).find('ldc') > -1: conf.common_flags_ldc()
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()
def configure(conf): """ Configuration for dmd/ldc """ conf.find_dmd() if sys.platform == "win32": out = conf.cmd_and_log([conf.env.D, "--help"]) if out.find("D Compiler v2.") > -1: conf.fatal("dmd2 on Windows is not supported, use gdc or ldc instead") conf.load("ar") conf.load("d") conf.common_flags_dmd() conf.d_platform_flags() if str(conf.env.D).find("ldc") > -1: conf.common_flags_ldc()
def ecpp_setupbuild_platform_atsam(conf, device, board, platform, arch): global atsam_vars vars = atsam_vars[device] envname = 'device_%s' % device conf.load('ecpp_toolchain ecpp_platform_arm') conf.ecpp_setuptoolchain('arm') create = envname not in conf.all_envs if create: conf.setenv(envname, conf.env) conf.env['ECPP_ENVNAME'] = envname for k,v in vars.items(): conf.env.append_value(k, Utils.to_list(v)) for x in 'CFLAGS CXXFLAGS LINKFLAGS'.split(): conf.env.append_value(x + "_release", ['-Os']) conf.env.append_value(x + "_debug", ['-O0']) conf.env.append_value('LINKFLAGS', ['-nodefaultlibs', '--static', '-Wl,--gc-sections']) for x in 'ram flash'.split(): ldscript = 'device_%s_%s.ld' % (device,x) ldscript = conf.root.find_node(os.path.join(conf.env['ECPP_DIR'],'linkerscripts',ldscript )) if ldscript: conf.env['LINKERSCRIPT_%s' % x] = ldscript.abspath() else: conf.env['LINKERSCRIPT_%s' % x] = u'Error: Please define a linkerscript in wscript' conf.env['DEVICE'] = device # new libc needs ecpp library for support code! conf.env['STLIB_c'] = ['c', 'gcc', 'ecpp_%s' % conf.env['DEVICE'].lower()] conf.env['STLIB_gcc'] = [] conf.env.append_value('ECPP_FEATURES',['firmware-hex']) else: conf.setenv(envname)