コード例 #1
0
ファイル: wurf_git.py プロジェクト: peymanphl/correlation
def find_git_win32(conf):
	path=find_in_winreg()
	if path:
		path_list=[path,os.path.join(path,'bin')]
		conf.find_program('git',path_list=path_list)
	else:
		conf.find_program('git')
コード例 #2
0
ファイル: c_nec.py プロジェクト: AleemDev/waf
def configure(conf):
	conf.find_sxc()
	conf.find_program('sxar',VAR='AR')
	conf.sxc_common_flags()
	conf.cc_load_tools()
	conf.cc_add_flags()
	conf.link_add_flags()
コード例 #3
0
ファイル: python.py プロジェクト: blablack/ams-lv2
def configure(conf):
	"""
	Detect the python interpreter
	"""
	v = conf.env
	if getattr(Options.options, 'pythondir', None):
		v.PYTHONDIR = Options.options.pythondir
	if getattr(Options.options, 'pythonarchdir', None):
		v.PYTHONARCHDIR = Options.options.pythonarchdir
	if getattr(Options.options, 'nopycache', None):
		v.NOPYCACHE=Options.options.nopycache

	if not v.PYTHON:
		v.PYTHON = [getattr(Options.options, 'python', None) or sys.executable]
	v.PYTHON = Utils.to_list(v.PYTHON)
	conf.find_program('python', var='PYTHON')

	v.PYFLAGS = ''
	v.PYFLAGS_OPT = '-O'

	v.PYC = getattr(Options.options, 'pyc', 1)
	v.PYO = getattr(Options.options, 'pyo', 1)

	try:
		v.PYTAG = conf.cmd_and_log(conf.env.PYTHON + ['-c', "import imp;print(imp.get_tag())"]).strip()
	except Errors.WafError:
		pass
コード例 #4
0
ファイル: ifort.py プロジェクト: afeldman/waf
def configure(conf):
	"""
	Detects the Intel Fortran compilers
	"""
	if Utils.is_win32:
		compiler, version, path, includes, libdirs, arch = conf.detect_ifort()
		v = conf.env
		v.DEST_CPU = arch
		v.PATH = path
		v.INCLUDES = includes
		v.LIBPATH = libdirs
		v.MSVC_COMPILER = compiler
		try:
			v.MSVC_VERSION = float(version)
		except ValueError:
			v.MSVC_VERSION = float(version[:-3])

		conf.find_ifort_win32()
		conf.ifort_modifier_win32()
	else:
		conf.find_ifort()
		conf.find_program('xiar', var='AR')
		conf.find_ar()
		conf.fc_flags()
		conf.fc_add_flags()
		conf.ifort_modifier_platform()
コード例 #5
0
ファイル: ticgt.py プロジェクト: ArduPilot/waf
def configure(conf):
    v = conf.env
    v.TI_CGT_DIR = getattr(Options.options, "ti-cgt-dir", "")
    v.TI_DSPLINK_DIR = getattr(Options.options, "ti-dsplink-dir", "")
    v.TI_BIOSUTILS_DIR = getattr(Options.options, "ti-biosutils-dir", "")
    v.TI_DSPBIOS_DIR = getattr(Options.options, "ti-dspbios-dir", "")
    v.TI_XDCTOOLS_DIR = getattr(Options.options, "ti-xdctools-dir", "")
    conf.find_ticc()
    conf.find_tiar()
    conf.find_tild()
    conf.ticc_common_flags()
    conf.cc_load_tools()
    conf.cc_add_flags()
    conf.link_add_flags()
    conf.find_program(["tconf"], var="TCONF", path_list=v.TI_XDCTOOLS_DIR)

    conf.env.TCONF_INCLUDES += [opj(conf.env.TI_DSPBIOS_DIR, "packages")]

    conf.env.INCLUDES += [opj(conf.env.TI_CGT_DIR, "include")]

    conf.env.LIBPATH += [opj(conf.env.TI_CGT_DIR, "lib")]

    conf.env.INCLUDES_DSPBIOS += [opj(conf.env.TI_DSPBIOS_DIR, "packages", "ti", "bios", "include")]

    conf.env.LIBPATH_DSPBIOS += [opj(conf.env.TI_DSPBIOS_DIR, "packages", "ti", "bios", "lib")]

    conf.env.INCLUDES_DSPLINK += [opj(conf.env.TI_DSPLINK_DIR, "dsplink", "dsp", "inc")]
コード例 #6
0
ファイル: ifort.py プロジェクト: Anastasia1302/code-pile
def configure(conf):
	conf.find_ifort()
	conf.find_program('xiar', var='AR')
	conf.env.ARFLAGS = 'rcs'
	conf.fc_flags()
	conf.fc_add_flags()
	conf.ifort_modifier_platform()
コード例 #7
0
ファイル: ifort.py プロジェクト: eriser/alta
def configure(conf):
    conf.find_ifort()
    conf.find_program("xiar", var="AR")
    conf.env.ARFLAGS = "rcs"
    conf.fc_flags()
    conf.fc_add_flags()
    conf.ifort_modifier_platform()
コード例 #8
0
def mkspec_gxx_configure(conf, major, minor, prefix=None, minimum=False):
    """
    :param major:   The major version number of the compiler, e.g. 4
    :param minor:   The minor version number of the compiler, e.g. 6
    :param prefix:  Prefix to the compiler name, e.g. 'arm-linux-androideabi'
    :param minimum: Only check for a minimum compiler version, if true
    """
    # Where to look for the compiler
    paths = conf.mkspec_get_toolchain_paths()

    # Find g++ first
    gxx_names = conf.mkspec_get_gnu_binary_name('g++', major, minor, prefix)
    if minimum:
        gxx_names = 'g++'
    cxx = conf.find_program(gxx_names, path_list=paths)
    cxx = conf.cmd_to_list(cxx)
    conf.env['CXX'] = cxx
    conf.env['CXX_NAME'] = os.path.basename(conf.env.get_flat('CXX'))
    if minimum:
        conf.mkspec_check_minimum_cc_version(cxx, major, minor)
    else:
        conf.mkspec_check_cc_version(cxx, major, minor)

    # Also find gcc
    gcc_names = conf.mkspec_get_gnu_binary_name('gcc', major, minor, prefix)
    if minimum:
        gcc_names = 'gcc'
    cc = conf.find_program(gcc_names, path_list=paths)
    cc = conf.cmd_to_list(cc)
    conf.env['CC'] = cc
    conf.env['CC_NAME'] = os.path.basename(conf.env.get_flat('CC'))
    if minimum:
        conf.mkspec_check_minimum_cc_version(cc, major, minor)
    else:
        conf.mkspec_check_cc_version(cc, major, minor)

    # Find the archiver
    ar = conf.mkspec_get_ar_binary_name(prefix)
    conf.find_program(ar, path_list=paths, var='AR')
    conf.env.ARFLAGS = 'rcs'

    # Set up C++ tools and flags
    conf.gxx_common_flags()
    conf.gxx_modifier_platform()
    conf.cxx_load_tools()
    conf.cxx_add_flags()

    # Also set up C tools and flags
    conf.gcc_common_flags()
    conf.gcc_modifier_platform()
    conf.cc_load_tools()
    conf.cc_add_flags()

    # Add linker flags
    conf.link_add_flags()

    # Add our own cxx flags
    conf.mkspec_set_gxx_cxxflags()
    # Add our own cc flags
    conf.mkspec_set_gcc_ccflags()
コード例 #9
0
ファイル: dmd.py プロジェクト: AkiraShirase/audacity
def find_dmd(conf):
	conf.find_program(['dmd','dmd2','ldc'],var='D')
	out=conf.cmd_and_log([conf.env.D,'--help'])
	if out.find("D Compiler v")==-1:
		out=conf.cmd_and_log([conf.env.D,'-version'])
		if out.find("based on DMD v1.")==-1:
			conf.fatal("detected compiler is not dmd/ldc")
コード例 #10
0
ファイル: cs.py プロジェクト: SjB/waftools
def configure(conf):
	"""
	Find a C# compiler, set the variable MCS for the compiler and CS_NAME (mono or csc)
	"""
	csc = getattr(Options.options, 'cscbinary', None)
	if csc:
		conf.env.MCS = csc
	conf.find_program(['csc', 'dmcs', 'gmcs', 'mcs'], var='MCS')
	conf.env.ASS_ST = '/r:%s'
	conf.env.RES_ST = '/resource:%s'

	conf.env.CS_NAME = 'csc'
	if str(conf.env.MCS).lower().find('mcs') > -1:
		conf.env.CS_NAME = 'mono'

	conf.env.package_dep_lib = getattr(Options.options, 'package_dep_lib', False)

	# new variable that allow the sdk version to be specified at the command line.
	sdk_version = getattr(Options.options, 'sdk_version', None)
	if sdk_version:
		self.env.append_value('CSFLAGS', '/sdk:%s' % sdk_version)

	debug = getattr(Options.options, 'debug', None)
	if debug:
		conf.env.append_value('CSFLAGS', '/define:DEBUG')
		conf.env.CSDEBUG = debug;
コード例 #11
0
def find_sxx(conf):
    """
	Detect the sun C++ compiler
	"""
    v = conf.env
    cc = None
    if v["CXX"]:
        cc = v["CXX"]
    elif "CXX" in conf.environ:
        cc = conf.environ["CXX"]
    if not cc:
        cc = conf.find_program("CC", var="CXX")  # studio
    if not cc:
        cc = conf.find_program("c++", var="CXX")
    if not cc:
        conf.fatal("Could not find a Sun C++ compiler")

    try:
        conf.cmd_and_log(cc + ["-flags"])
    except Exception:
        conf.fatal("%r is not a Sun compiler" % cc)

    v["CXX"] = cc
    v["CXX_NAME"] = "sun"
    conf.get_suncc_version(cc)
コード例 #12
0
ファイル: msvc.py プロジェクト: guysherman/basic-cpp-template
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')
コード例 #13
0
ファイル: msvc.py プロジェクト: allencubie/lib
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')
コード例 #14
0
ファイル: clangxx.py プロジェクト: afeldman/waf
def configure(conf):
	conf.find_clangxx()
	conf.find_program(['llvm-ar', 'ar'], var='AR')
	conf.find_ar()
	conf.gxx_common_flags()
	conf.gxx_modifier_platform()
	conf.cxx_load_tools()
	conf.cxx_add_flags()
	conf.link_add_flags()
コード例 #15
0
ファイル: clang.py プロジェクト: bugengine/BugEngine
def configure(conf):
	conf.find_clang()
	conf.find_program(['ar'], var='AR')
	conf.find_ar()
	conf.gcc_common_flags()
	conf.gcc_modifier_platform()
	conf.cc_load_tools()
	conf.cc_add_flags()
	conf.link_add_flags()
コード例 #16
0
ファイル: gdc.py プロジェクト: afeldman/waf
def find_gdc(conf):
	"""
	Finds the program gdc and set the variable *D*
	"""
	conf.find_program('gdc', var='D')

	out = conf.cmd_and_log(conf.env.D + ['--version'])
	if out.find("gdc") == -1:
		conf.fatal("detected compiler is not gdc")
コード例 #17
0
ファイル: ldc2.py プロジェクト: ArduPilot/waf
def find_ldc2(conf):
	"""
	Finds the program *ldc2* and set the variable *D*
	"""
	conf.find_program(['ldc2'], var='D')

	out = conf.cmd_and_log(conf.env.D + ['-version'])
	if out.find("based on DMD v2.") == -1:
		conf.fatal("detected compiler is not ldc2")
コード例 #18
0
def find_emscripten(conf):
	cc = conf.find_program(['emcc'], var='CC')
	conf.get_emscripten_version(cc)
	conf.env.CC = cc
	conf.env.CC_NAME = 'emscripten'
	cxx = conf.find_program(['em++'], var='CXX')
	conf.env.CXX = cxx
	conf.env.CXX_NAME = 'emscripten'
	conf.find_program(['emar'], var='AR')
コード例 #19
0
ファイル: fc_nfort.py プロジェクト: afeldman/waf
def configure(conf):
	conf.find_nfort()
	conf.find_program('nar',var='AR')
	conf.add_os_flags('ARFLAGS')
	if not conf.env.ARFLAGS:
		conf.env.ARFLAGS=['rcs']
	conf.fc_flags()
	conf.fc_add_flags()
	conf.nfort_flags()
コード例 #20
0
ファイル: intltool.py プロジェクト: JodyGoldberg/waf
def find_intltool_merge(conf):
	"""
	Detects intltool-merge
	"""
	if not conf.env.PERL:
		conf.find_program('perl', var='PERL')
	conf.env.INTLCACHE_ST = '--cache=%s'
	conf.env.INTLFLAGS_DEFAULT = ['-q', '-u']
	conf.find_program('intltool-merge', interpreter='PERL', var='INTLTOOL')
コード例 #21
0
ファイル: msvc.py プロジェクト: anthonyrisinger/zippy
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')
コード例 #22
0
ファイル: cs.py プロジェクト: Estoque86/COBRA
def configure(conf):
    csc = getattr(Options.options, "cscbinary", None)
    if csc:
        conf.env.MCS = csc
    conf.find_program(["csc", "mcs", "gmcs"], var="MCS")
    conf.env.ASS_ST = "/r:%s"
    conf.env.RES_ST = "/resource:%s"
    conf.env.CS_NAME = "csc"
    if str(conf.env.MCS).lower().find("mcs") > -1:
        conf.env.CS_NAME = "mono"
コード例 #23
0
ファイル: wurf_git.py プロジェクト: nitesh5513/external-waf
def configure(conf):
    """
    Attempts to locate the git binary
    :param conf: a Waf ConfigurationContext
    """

    if Utils.is_win32:
        find_git_win32(conf)
    else:
        conf.find_program("git")
コード例 #24
0
ファイル: cs.py プロジェクト: Gnurou/glmark2
def configure(conf):
	csc=getattr(Options.options,'cscbinary',None)
	if csc:
		conf.env.MCS=csc
	conf.find_program(['csc','mcs','gmcs'],var='MCS')
	conf.env.ASS_ST='/r:%s'
	conf.env.RES_ST='/resource:%s'
	conf.env.CS_NAME='csc'
	if str(conf.env.MCS).lower().find('mcs')>-1:
		conf.env.CS_NAME='mono'
コード例 #25
0
ファイル: ldc2.py プロジェクト: Anastasia1302/code-pile
def find_ldc2(conf):
    """
	Find the program *ldc2* and set the variable *D*
	"""

    conf.find_program(["ldc2"], var="D")

    out = conf.cmd_and_log([conf.env.D, "-version"])
    if out.find("based on DMD v2.") == -1:
        conf.fatal("detected compiler is not ldc2")
コード例 #26
0
ファイル: suncxx.py プロジェクト: RunarFreyr/waz
def find_sxx(conf):
	v=conf.env
	cc=None
	if v['CXX']:cc=v['CXX']
	elif'CXX'in conf.environ:cc=conf.environ['CXX']
	if not cc:cc=conf.find_program('c++',var='CXX')
	if not cc:cc=conf.find_program('CC',var='CXX')
	if not cc:conf.fatal('sunc++ was not found')
	v['CXX']=cc
	v['CXX_NAME']='sun'
コード例 #27
0
ファイル: fc_nec.py プロジェクト: JodyGoldberg/waf
def configure(conf):
	conf.find_sxfc()
	conf.find_program('sxar',var='AR')
	conf.add_os_flags('ARFLAGS')
	if not conf.env.ARFLAGS:
		conf.env.ARFLAGS=['rcs']

	conf.fc_flags()
	conf.fc_add_flags()
	conf.sxfc_flags()
コード例 #28
0
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')
コード例 #29
0
ファイル: fsc.py プロジェクト: AleemDev/waf
def configure(conf):
	"""
	Find a F# compiler, set the variable FSC for the compiler and FS_NAME (mono or fsc)
	"""
	conf.find_program(['fsc.exe', 'fsharpc'], var='FSC')
	conf.env.ASS_ST = '/r:%s'
	conf.env.RES_ST = '/resource:%s'

	conf.env.FS_NAME = 'fsc'
	if str(conf.env.FSC).lower().find('fsharpc') > -1:
		conf.env.FS_NAME = 'mono'
コード例 #30
0
ファイル: glib2.py プロジェクト: WU-ARL/ndn-ops
def find_glib_compile_schemas(conf):
	conf.find_program('glib-compile-schemas',var='GLIB_COMPILE_SCHEMAS')
	def getstr(varname):
		return getattr(Options.options,varname,getattr(conf.env,varname,''))
	gsettingsschemadir=getstr('GSETTINGSSCHEMADIR')
	if not gsettingsschemadir:
		datadir=getstr('DATADIR')
		if not datadir:
			prefix=conf.env['PREFIX']
			datadir=os.path.join(prefix,'share')
		gsettingsschemadir=os.path.join(datadir,'glib-2.0','schemas')
	conf.env['GSETTINGSSCHEMADIR']=gsettingsschemadir
コード例 #31
0
ファイル: ar.py プロジェクト: sky4D/mavsim
def configure(conf):
    conf.find_program('ar', var='AR')
    conf.env.ARFLAGS = 'rcs'
コード例 #32
0
def check_python_headers(conf, features="pyembed pyext"):
    """
    Check for headers and libraries necessary to extend or embed python by using the module *distutils*.
    On success the environment variables xxx_PYEXT and xxx_PYEMBED are added:

    * PYEXT: for compiling python extensions
    * PYEMBED: for embedding a python interpreter
    """
    features = Utils.to_list(features)
    assert ("pyembed" in features) or (
        "pyext" in features
    ), "check_python_headers features must include 'pyembed' and/or 'pyext'"
    env = conf.env
    if not env.CC_NAME and not env.CXX_NAME:
        conf.fatal("load a compiler first (gcc, g++, ..)")

    # bypass all the code below for cross-compilation
    if conf.python_cross_compile(features):
        return

    if not env.PYTHON_VERSION:
        conf.check_python_version()

    pybin = env.PYTHON
    if not pybin:
        conf.fatal("Could not find the python executable")

    # so we actually do all this for compatibility reasons and for obtaining pyext_PATTERN below
    v = "prefix SO LDFLAGS LIBDIR LIBPL INCLUDEPY Py_ENABLE_SHARED MACOSX_DEPLOYMENT_TARGET LDSHARED CFLAGS LDVERSION".split(
    )
    try:
        lst = conf.get_python_variables(
            ["get_config_var('%s') or ''" % x for x in v])
    except RuntimeError:
        conf.fatal("Python development headers not found (-v for details).")

    vals = [f"{x} = {y!r}" for (x, y) in zip(v, lst)]
    conf.to_log("Configuration returned from {!r}:\n{}\n".format(
        pybin, "\n".join(vals)))

    dct = dict(zip(v, lst))
    x = "MACOSX_DEPLOYMENT_TARGET"
    if dct[x]:
        env[x] = conf.environ[x] = dct[x]
    env.pyext_PATTERN = "%s" + dct["SO"]  # not a mistake

    # Try to get pythonX.Y-config
    num = ".".join(env.PYTHON_VERSION.split(".")[:2])
    conf.find_program(
        [
            "".join(pybin) + "-config",
            "python%s-config" % num,
            "python-config-%s" % num,
            "python%sm-config" % num,
        ],
        var="PYTHON_CONFIG",
        msg="python-config",
        mandatory=False,
    )

    if env.PYTHON_CONFIG:
        # python2.6-config requires 3 runs
        all_flags = [["--cflags", "--libs", "--ldflags"]]
        if sys.hexversion < 0x2070000:
            all_flags = [[k] for k in all_flags[0]]

        xx = env.CXX_NAME and "cxx" or "c"

        if "pyembed" in features:
            for flags in all_flags:
                conf.check_cfg(
                    msg="Asking python-config for pyembed %r flags" %
                    " ".join(flags),
                    path=env.PYTHON_CONFIG,
                    package="",
                    uselib_store="PYEMBED",
                    args=flags,
                )

            try:
                conf.test_pyembed(xx)
            except conf.errors.ConfigurationError:
                # python bug 7352
                if dct["Py_ENABLE_SHARED"] and dct["LIBDIR"]:
                    env.append_unique("LIBPATH_PYEMBED", [dct["LIBDIR"]])
                    conf.test_pyembed(xx)
                else:
                    raise

        if "pyext" in features:
            for flags in all_flags:
                conf.check_cfg(
                    msg="Asking python-config for pyext %r flags" %
                    " ".join(flags),
                    path=env.PYTHON_CONFIG,
                    package="",
                    uselib_store="PYEXT",
                    args=flags,
                )

            try:
                conf.test_pyext(xx)
            except conf.errors.ConfigurationError:
                # python bug 7352
                if dct["Py_ENABLE_SHARED"] and dct["LIBDIR"]:
                    env.append_unique("LIBPATH_PYEXT", [dct["LIBDIR"]])
                    conf.test_pyext(xx)
                else:
                    raise

        conf.define("HAVE_PYTHON_H", 1)
        return

    # No python-config, do something else on windows systems
    all_flags = dct["LDFLAGS"] + " " + dct["CFLAGS"]
    conf.parse_flags(all_flags, "PYEMBED")

    all_flags = dct["LDFLAGS"] + " " + dct["LDSHARED"] + " " + dct["CFLAGS"]
    conf.parse_flags(all_flags, "PYEXT")

    result = None
    if not dct["LDVERSION"]:
        dct["LDVERSION"] = env.PYTHON_VERSION

    # further simplification will be complicated
    for name in (
            "python" + dct["LDVERSION"],
            "python" + env.PYTHON_VERSION + "m",
            "python" + env.PYTHON_VERSION.replace(".", ""),
    ):

        # LIBPATH_PYEMBED is already set; see if it works.
        if not result and env.LIBPATH_PYEMBED:
            path = env.LIBPATH_PYEMBED
            conf.to_log("\n\n# Trying default LIBPATH_PYEMBED: %r\n" % path)
            result = conf.check(
                lib=name,
                uselib="PYEMBED",
                libpath=path,
                mandatory=False,
                msg="Checking for library %s in LIBPATH_PYEMBED" % name,
            )

        if not result and dct["LIBDIR"]:
            path = [dct["LIBDIR"]]
            conf.to_log("\n\n# try again with -L$python_LIBDIR: %r\n" % path)
            result = conf.check(
                lib=name,
                uselib="PYEMBED",
                libpath=path,
                mandatory=False,
                msg="Checking for library %s in LIBDIR" % name,
            )

        if not result and dct["LIBPL"]:
            path = [dct["LIBPL"]]
            conf.to_log(
                "\n\n# try again with -L$python_LIBPL (some systems don't install the python library in $prefix/lib)\n"
            )
            result = conf.check(
                lib=name,
                uselib="PYEMBED",
                libpath=path,
                mandatory=False,
                msg="Checking for library %s in python_LIBPL" % name,
            )

        if not result:
            path = [os.path.join(dct["prefix"], "libs")]
            conf.to_log(
                "\n\n# try again with -L$prefix/libs, and pythonXY name rather than pythonX.Y (win32)\n"
            )
            result = conf.check(
                lib=name,
                uselib="PYEMBED",
                libpath=path,
                mandatory=False,
                msg="Checking for library %s in $prefix/libs" % name,
            )

        if result:
            break  # do not forget to set LIBPATH_PYEMBED

    if result:
        env.LIBPATH_PYEMBED = path
        env.append_value("LIB_PYEMBED", [name])
    else:
        conf.to_log("\n\n### LIB NOT FOUND\n")

    # under certain conditions, python extensions must link to
    # python libraries, not just python embedding programs.
    if Utils.is_win32 or dct["Py_ENABLE_SHARED"]:
        env.LIBPATH_PYEXT = env.LIBPATH_PYEMBED
        env.LIB_PYEXT = env.LIB_PYEMBED

    conf.to_log(
        "Include path for Python extensions (found via distutils module): {!r}\n"
        .format(dct["INCLUDEPY"]))
    env.INCLUDES_PYEXT = [dct["INCLUDEPY"]]
    env.INCLUDES_PYEMBED = [dct["INCLUDEPY"]]

    # Code using the Python API needs to be compiled with -fno-strict-aliasing
    if env.CC_NAME == "gcc":
        env.append_value("CFLAGS_PYEMBED", ["-fno-strict-aliasing"])
        env.append_value("CFLAGS_PYEXT", ["-fno-strict-aliasing"])
    if env.CXX_NAME == "gcc":
        env.append_value("CXXFLAGS_PYEMBED", ["-fno-strict-aliasing"])
        env.append_value("CXXFLAGS_PYEXT", ["-fno-strict-aliasing"])

    if env.CC_NAME == "msvc":
        from distutils.msvccompiler import MSVCCompiler

        dist_compiler = MSVCCompiler()
        dist_compiler.initialize()
        env.append_value("CFLAGS_PYEXT", dist_compiler.compile_options)
        env.append_value("CXXFLAGS_PYEXT", dist_compiler.compile_options)
        env.append_value("LINKFLAGS_PYEXT", dist_compiler.ldflags_shared)

    # See if it compiles
    conf.check(
        header_name="Python.h",
        define_name="HAVE_PYTHON_H",
        uselib="PYEMBED",
        fragment=FRAG,
        errmsg=
        "Distutils not installed? Broken python installation? Get python-config now!",
    )
コード例 #33
0
ファイル: g95.py プロジェクト: van-de-bugger/waf
def find_g95(conf):
    fc = conf.find_program('g95', var='FC')
    conf.get_g95_version(fc)
    conf.env.FC_NAME = 'G95'
コード例 #34
0
ファイル: msvc.py プロジェクト: cawka/waf-old-fork
def get_msvc_version(conf, compiler, version, target, vcvars):
    """
	Create a bat file to obtain the location of the libraries

	:param compiler: ?
	:param version: ?
	:target: ?
	:vcvars: ?
	:return: the location of msvc, the location of include dirs, and the library paths
	:rtype: tuple of strings
	"""
    debug('msvc: get_msvc_version: %r %r %r', compiler, version, target)

    try:
        conf.msvc_cnt += 1
    except AttributeError:
        conf.msvc_cnt = 1
    batfile = conf.bldnode.make_node('waf-print-msvc-%d.bat' % conf.msvc_cnt)
    batfile.write("""@echo off
set INCLUDE=
set LIB=
call "%s" %s
echo PATH=%%PATH%%
echo INCLUDE=%%INCLUDE%%
echo LIB=%%LIB%%;%%LIBPATH%%
""" % (vcvars, target))
    sout = conf.cmd_and_log(
        ['cmd.exe', '/E:on', '/V:on', '/C',
         batfile.abspath()])
    lines = sout.splitlines()

    if not lines[0]:
        lines.pop(0)

    MSVC_PATH = MSVC_INCDIR = MSVC_LIBDIR = None
    for line in lines:
        if line.startswith('PATH='):
            path = line[5:]
            MSVC_PATH = path.split(';')
        elif line.startswith('INCLUDE='):
            MSVC_INCDIR = [i for i in line[8:].split(';') if i]
        elif line.startswith('LIB='):
            MSVC_LIBDIR = [i for i in line[4:].split(';') if i]
    if None in (MSVC_PATH, MSVC_INCDIR, MSVC_LIBDIR):
        conf.fatal(
            'msvc: Could not find a valid architecture for building (get_msvc_version_3)'
        )

    # Check if the compiler is usable at all.
    # The detection may return 64-bit versions even on 32-bit systems, and these would fail to run.
    env = dict(os.environ)
    env.update(PATH=path)
    compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler)
    cxx = conf.find_program(compiler_name, path_list=MSVC_PATH)

    # delete CL if exists. because it could contain parameters wich can change cl's behaviour rather catastrophically.
    if 'CL' in env:
        del (env['CL'])

    try:
        try:
            conf.cmd_and_log(cxx + ['/help'], env=env)
        except Exception as e:
            debug('msvc: get_msvc_version: %r %r %r -> failure' %
                  (compiler, version, target))
            debug(str(e))
            conf.fatal('msvc: cannot run the compiler (in get_msvc_version)')
        else:
            debug('msvc: get_msvc_version: %r %r %r -> OK', compiler, version,
                  target)
    finally:
        conf.env[compiler_name] = ''

    return (MSVC_PATH, MSVC_INCDIR, MSVC_LIBDIR)
コード例 #35
0
def find_dld(conf):
    conf.find_program(['dld'],
                      var='LINK_CC',
                      path_list=getattr(Options.options, 'diabbindir', ""))
    conf.env.LINK_CC_NAME = 'dld'
コード例 #36
0
def find_ddump(conf):
    conf.find_program(['ddump'],
                      var='DDUMP',
                      path_list=getattr(Options.options, 'diabbindir', ""))
コード例 #37
0
ファイル: msvc.py プロジェクト: rivy/waf
def get_msvc_version(conf, compiler, version, target, vcvars):
    """
	Checks that an installed compiler actually runs and uses vcvars to obtain the
	environment needed by the compiler.

	:param compiler: compiler type, for looking up the executable name
	:param version: compiler version, for debugging only
	:param target: target architecture
	:param vcvars: batch file to run to check the environment
	:return: the location of the compiler executable, the location of include dirs, and the library paths
	:rtype: tuple of strings
	"""
    Logs.debug('msvc: get_msvc_version: %r %r %r', compiler, version, target)

    try:
        conf.msvc_cnt += 1
    except AttributeError:
        conf.msvc_cnt = 1
    batfile = conf.bldnode.make_node('waf-print-msvc-%d.bat' % conf.msvc_cnt)
    batfile.write("""@echo off
set INCLUDE=
set LIB=
call "%s" %s
echo PATH=%%PATH%%
echo INCLUDE=%%INCLUDE%%
echo LIB=%%LIB%%;%%LIBPATH%%
""" % (vcvars, target))
    sout = conf.cmd_and_log(
        ['cmd.exe', '/E:on', '/V:on', '/C',
         batfile.abspath()])
    lines = sout.splitlines()

    if not lines[0]:
        lines.pop(0)

    MSVC_PATH = MSVC_INCDIR = MSVC_LIBDIR = None
    for line in lines:
        if line.startswith('PATH='):
            path = line[5:]
            MSVC_PATH = path.split(';')
        elif line.startswith('INCLUDE='):
            MSVC_INCDIR = [i for i in line[8:].split(';') if i]
        elif line.startswith('LIB='):
            MSVC_LIBDIR = [i for i in line[4:].split(';') if i]
    if None in (MSVC_PATH, MSVC_INCDIR, MSVC_LIBDIR):
        conf.fatal(
            'msvc: Could not find a valid architecture for building (get_msvc_version_3)'
        )

    # Check if the compiler is usable at all.
    # The detection may return 64-bit versions even on 32-bit systems, and these would fail to run.
    env = dict(os.environ)
    env.update(PATH=path)
    compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler)
    cxx = conf.find_program(compiler_name, path_list=MSVC_PATH)

    # delete CL if exists. because it could contain parameters which can change cl's behaviour rather catastrophically.
    if 'CL' in env:
        del (env['CL'])

    try:
        conf.cmd_and_log(cxx + ['/help'], env=env)
    except UnicodeError:
        st = traceback.format_exc()
        if conf.logger:
            conf.logger.error(st)
        conf.fatal('msvc: Unicode error - check the code page?')
    except Exception as e:
        Logs.debug('msvc: get_msvc_version: %r %r %r -> failure %s', compiler,
                   version, target, str(e))
        conf.fatal(
            'msvc: cannot run the compiler in get_msvc_version (run with -v to display errors)'
        )
    else:
        Logs.debug('msvc: get_msvc_version: %r %r %r -> OK', compiler, version,
                   target)
    finally:
        conf.env[compiler_name] = ''

    return (MSVC_PATH, MSVC_INCDIR, MSVC_LIBDIR)
コード例 #38
0
ファイル: avr-gxx.py プロジェクト: dmay31/grbl-waf
def find_avr_gxx(conf):
    cxx = conf.find_program(['avr-g++'], var='CXX')
    cxx = conf.cmd_to_list(cxx)
    conf.get_cc_version(cxx, gcc=True)
    conf.env.CXX_NAME = 'avr-gcc'
    conf.env.CXX = cxx
コード例 #39
0
def find_gcc(conf):
    cc = conf.find_program(['gcc', 'cc'], var='CC')
    conf.get_cc_version(cc, gcc=True)
    conf.env.CC_NAME = 'gcc'
コード例 #40
0
def get_msvc_version(conf, compiler, version, target, vcvars):
    debug('msvc: get_msvc_version: %r %r %r', compiler, version, target)
    batfile = conf.bldnode.make_node('waf-print-msvc.bat')
    batfile.write("""@echo off
set INCLUDE=
set LIB=
call "%s" %s
echo PATH=%%PATH%%
echo INCLUDE=%%INCLUDE%%
echo LIB=%%LIB%%
""" % (vcvars, target))
    sout = conf.cmd_and_log(['cmd', '/E:on', '/V:on', '/C', batfile.abspath()])
    lines = sout.splitlines()
    if not lines[0]:
        lines.pop(0)
    if version == '11.0':
        if lines[0].startswith('Error'):
            conf.fatal(
                'msvc: Could not find a valid architecture for building (get_msvc_version_1)'
            )
    else:
        for x in ('Setting environment', 'Setting SDK environment',
                  'Intel(R) C++ Compiler', 'Intel Parallel Studio'):
            if lines[0].find(x) > -1:
                lines.pop(0)
                break
        else:
            debug('msvc: get_msvc_version: %r %r %r -> not found', compiler,
                  version, target)
            conf.fatal(
                'msvc: Could not find a valid architecture for building (get_msvc_version_2)'
            )
    MSVC_PATH = MSVC_INCDIR = MSVC_LIBDIR = None
    for line in lines:
        if line.startswith('PATH='):
            path = line[5:]
            MSVC_PATH = path.split(';')
        elif line.startswith('INCLUDE='):
            MSVC_INCDIR = [i for i in line[8:].split(';') if i]
        elif line.startswith('LIB='):
            MSVC_LIBDIR = [i for i in line[4:].split(';') if i]
    if None in (MSVC_PATH, MSVC_INCDIR, MSVC_LIBDIR):
        conf.fatal(
            'msvc: Could not find a valid architecture for building (get_msvc_version_3)'
        )
    env = dict(os.environ)
    env.update(PATH=path)
    compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler)
    cxx = conf.find_program(compiler_name, path_list=MSVC_PATH)
    cxx = conf.cmd_to_list(cxx)
    if 'CL' in env:
        del (env['CL'])
    try:
        try:
            conf.cmd_and_log(cxx + ['/help'], env=env)
        except Exception, e:
            debug('msvc: get_msvc_version: %r %r %r -> failure' %
                  (compiler, version, target))
            debug(str(e))
            conf.fatal('msvc: cannot run the compiler (in get_msvc_version)')
        else:
コード例 #41
0
ファイル: glib2.py プロジェクト: cawka/waf-old-fork
def find_glib_compile_resources(conf):
    conf.find_program('glib-compile-resources', var='GLIB_COMPILE_RESOURCES')
コード例 #42
0
ファイル: glib2.py プロジェクト: cawka/waf-old-fork
def find_glib_mkenums(conf):
    if not conf.env.PERL:
        conf.find_program('perl', var='PERL')
    conf.find_program('glib-mkenums', interpreter='PERL', var='GLIB_MKENUMS')
コード例 #43
0
def find_solstudio(conf):
	"""Find the Solaris Studio compiler (will look in the environment variable 'FC')"""

	fc = conf.find_program(['sunf95', 'f95', 'sunf90', 'f90'], var='FC')
	conf.get_solstudio_version(fc)
	conf.env.FC_NAME = 'SOL'
コード例 #44
0
ファイル: python.py プロジェクト: brummer10/suil
def check_python_headers(conf, features='pyembed pyext'):
    """
	Check for headers and libraries necessary to extend or embed python by using the module *distutils*.
	On success the environment variables xxx_PYEXT and xxx_PYEMBED are added:

	* PYEXT: for compiling python extensions
	* PYEMBED: for embedding a python interpreter
	"""
    features = Utils.to_list(features)
    assert ('pyembed' in features) or (
        'pyext' in features
    ), "check_python_headers features must include 'pyembed' and/or 'pyext'"
    env = conf.env
    if not env.CC_NAME and not env.CXX_NAME:
        conf.fatal('load a compiler first (gcc, g++, ..)')

    # bypass all the code below for cross-compilation
    if conf.python_cross_compile(features):
        return

    if not env.PYTHON_VERSION:
        conf.check_python_version()

    pybin = env.PYTHON
    if not pybin:
        conf.fatal('Could not find the python executable')

    # so we actually do all this for compatibility reasons and for obtaining pyext_PATTERN below
    v = 'prefix SO LDFLAGS LIBDIR LIBPL INCLUDEPY Py_ENABLE_SHARED MACOSX_DEPLOYMENT_TARGET LDSHARED CFLAGS LDVERSION'.split(
    )
    try:
        lst = conf.get_python_variables(
            ["get_config_var('%s') or ''" % x for x in v])
    except RuntimeError:
        conf.fatal("Python development headers not found (-v for details).")

    vals = ['%s = %r' % (x, y) for (x, y) in zip(v, lst)]
    conf.to_log("Configuration returned from %r:\n%s\n" %
                (pybin, '\n'.join(vals)))

    dct = dict(zip(v, lst))
    x = 'MACOSX_DEPLOYMENT_TARGET'
    if dct[x]:
        env[x] = conf.environ[x] = dct[x]
    env.pyext_PATTERN = '%s' + dct['SO']  # not a mistake

    # Try to get pythonX.Y-config
    num = '.'.join(env.PYTHON_VERSION.split('.')[:2])
    conf.find_program([
        ''.join(pybin) + '-config',
        'python%s-config' % num,
        'python-config-%s' % num,
        'python%sm-config' % num
    ],
                      var='PYTHON_CONFIG',
                      msg="python-config",
                      mandatory=False)

    if env.PYTHON_CONFIG:
        # python2.6-config requires 3 runs
        all_flags = [['--cflags', '--libs', '--ldflags']]
        if sys.hexversion < 0x2070000:
            all_flags = [[k] for k in all_flags[0]]

        xx = env.CXX_NAME and 'cxx' or 'c'

        if 'pyembed' in features:
            for flags in all_flags:
                conf.check_cfg(
                    msg='Asking python-config for pyembed %r flags' %
                    ' '.join(flags),
                    path=env.PYTHON_CONFIG,
                    package='',
                    uselib_store='PYEMBED',
                    args=flags)

            try:
                conf.test_pyembed(xx)
            except conf.errors.ConfigurationError:
                # python bug 7352
                if dct['Py_ENABLE_SHARED'] and dct['LIBDIR']:
                    env.append_unique('LIBPATH_PYEMBED', [dct['LIBDIR']])
                    conf.test_pyembed(xx)
                else:
                    raise

        if 'pyext' in features:
            for flags in all_flags:
                conf.check_cfg(msg='Asking python-config for pyext %r flags' %
                               ' '.join(flags),
                               path=env.PYTHON_CONFIG,
                               package='',
                               uselib_store='PYEXT',
                               args=flags)

            try:
                conf.test_pyext(xx)
            except conf.errors.ConfigurationError:
                # python bug 7352
                if dct['Py_ENABLE_SHARED'] and dct['LIBDIR']:
                    env.append_unique('LIBPATH_PYEXT', [dct['LIBDIR']])
                    conf.test_pyext(xx)
                else:
                    raise

        conf.define('HAVE_PYTHON_H', 1)
        return

    # No python-config, do something else on windows systems
    all_flags = dct['LDFLAGS'] + ' ' + dct['CFLAGS']
    conf.parse_flags(all_flags, 'PYEMBED')

    all_flags = dct['LDFLAGS'] + ' ' + dct['LDSHARED'] + ' ' + dct['CFLAGS']
    conf.parse_flags(all_flags, 'PYEXT')

    result = None
    if not dct["LDVERSION"]:
        dct["LDVERSION"] = env.PYTHON_VERSION

    # further simplification will be complicated
    for name in ('python' + dct['LDVERSION'],
                 'python' + env.PYTHON_VERSION + 'm',
                 'python' + env.PYTHON_VERSION.replace('.', '')):

        # LIBPATH_PYEMBED is already set; see if it works.
        if not result and env.LIBPATH_PYEMBED:
            path = env.LIBPATH_PYEMBED
            conf.to_log("\n\n# Trying default LIBPATH_PYEMBED: %r\n" % path)
            result = conf.check(
                lib=name,
                uselib='PYEMBED',
                libpath=path,
                mandatory=False,
                msg='Checking for library %s in LIBPATH_PYEMBED' % name)

        if not result and dct['LIBDIR']:
            path = [dct['LIBDIR']]
            conf.to_log("\n\n# try again with -L$python_LIBDIR: %r\n" % path)
            result = conf.check(lib=name,
                                uselib='PYEMBED',
                                libpath=path,
                                mandatory=False,
                                msg='Checking for library %s in LIBDIR' % name)

        if not result and dct['LIBPL']:
            path = [dct['LIBPL']]
            conf.to_log(
                "\n\n# try again with -L$python_LIBPL (some systems don't install the python library in $prefix/lib)\n"
            )
            result = conf.check(lib=name,
                                uselib='PYEMBED',
                                libpath=path,
                                mandatory=False,
                                msg='Checking for library %s in python_LIBPL' %
                                name)

        if not result:
            path = [os.path.join(dct['prefix'], "libs")]
            conf.to_log(
                "\n\n# try again with -L$prefix/libs, and pythonXY name rather than pythonX.Y (win32)\n"
            )
            result = conf.check(lib=name,
                                uselib='PYEMBED',
                                libpath=path,
                                mandatory=False,
                                msg='Checking for library %s in $prefix/libs' %
                                name)

        if result:
            break  # do not forget to set LIBPATH_PYEMBED

    if result:
        env.LIBPATH_PYEMBED = path
        env.append_value('LIB_PYEMBED', [name])
    else:
        conf.to_log("\n\n### LIB NOT FOUND\n")

    # under certain conditions, python extensions must link to
    # python libraries, not just python embedding programs.
    if Utils.is_win32 or dct['Py_ENABLE_SHARED']:
        env.LIBPATH_PYEXT = env.LIBPATH_PYEMBED
        env.LIB_PYEXT = env.LIB_PYEMBED

    conf.to_log(
        "Include path for Python extensions (found via distutils module): %r\n"
        % (dct['INCLUDEPY'], ))
    env.INCLUDES_PYEXT = [dct['INCLUDEPY']]
    env.INCLUDES_PYEMBED = [dct['INCLUDEPY']]

    # Code using the Python API needs to be compiled with -fno-strict-aliasing
    if env.CC_NAME == 'gcc':
        env.append_value('CFLAGS_PYEMBED', ['-fno-strict-aliasing'])
        env.append_value('CFLAGS_PYEXT', ['-fno-strict-aliasing'])
    if env.CXX_NAME == 'gcc':
        env.append_value('CXXFLAGS_PYEMBED', ['-fno-strict-aliasing'])
        env.append_value('CXXFLAGS_PYEXT', ['-fno-strict-aliasing'])

    if env.CC_NAME == "msvc":
        from distutils.msvccompiler import MSVCCompiler
        dist_compiler = MSVCCompiler()
        dist_compiler.initialize()
        env.append_value('CFLAGS_PYEXT', dist_compiler.compile_options)
        env.append_value('CXXFLAGS_PYEXT', dist_compiler.compile_options)
        env.append_value('LINKFLAGS_PYEXT', dist_compiler.ldflags_shared)

    # See if it compiles
    conf.check(
        header_name='Python.h',
        define_name='HAVE_PYTHON_H',
        uselib='PYEMBED',
        fragment=FRAG,
        errmsg=
        'Distutils not installed? Broken python installation? Get python-config now!'
    )
コード例 #45
0
ファイル: python.py プロジェクト: spo11/archlinux
def check_python_headers(conf):
	if not conf.env['CC_NAME']and not conf.env['CXX_NAME']:
		conf.fatal('load a compiler first (gcc, g++, ..)')
	if not conf.env['PYTHON_VERSION']:
		conf.check_python_version()
	env=conf.env
	python=env['PYTHON']
	if not python:
		conf.fatal('could not find the python executable')
	v='prefix SO LDFLAGS LIBDIR LIBPL INCLUDEPY Py_ENABLE_SHARED MACOSX_DEPLOYMENT_TARGET LDSHARED CFLAGS'.split()
	try:
		lst=conf.get_python_variables(python,["get_config_var('%s')"%x for x in v],['from distutils.sysconfig import get_config_var'])
	except RuntimeError:
		conf.fatal("Python development headers not found (-v for details).")
	vals=['%s = %r'%(x,y)for(x,y)in zip(v,lst)]
	conf.to_log("Configuration returned from %r:\n%r\n"%(python,'\n'.join(vals)))
	dct=dict(zip(v,lst))
	x='MACOSX_DEPLOYMENT_TARGET'
	if dct[x]:
		conf.env[x]=conf.environ[x]=dct[x]
	env['pyext_PATTERN']='%s'+dct['SO']
	all_flags=dct['LDFLAGS']+' '+dct['LDSHARED']+' '+dct['CFLAGS']
	conf.parse_flags(all_flags,'PYEMBED')
	conf.parse_flags(all_flags,'PYEXT')
	result=None
	name='python'+env['PYTHON_VERSION']
	path=env['LIBPATH_PYEMBED']
	conf.to_log("\n\n# Trying default LIBPATH_PYEMBED: %r\n"%path)
	result=conf.check(lib=name,uselib='PYEMBED',libpath=path,mandatory=False)
	if not result:
		conf.to_log("\n\n# try again with -L$python_LIBDIR: %r\n"%path)
		path=[dct['LIBDIR']or'']
		result=conf.check(lib=name,uselib='PYEMBED',libpath=path,mandatory=False)
	if not result:
		conf.to_log("\n\n# try again with -L$python_LIBPL (some systems don't install the python library in $prefix/lib)\n")
		path=[dct['LIBPL']or'']
		result=conf.check(lib=name,uselib='PYEMBED',libpath=path,mandatory=False)
	if not result:
		conf.to_log("\n\n# try again with -L$prefix/libs, and pythonXY name rather than pythonX.Y (win32)\n")
		path=[os.path.join(dct['prefix'],"libs")]
		name='python'+env['PYTHON_VERSION'].replace('.','')
		result=conf.check(lib=name,uselib='PYEMBED',libpath=path,mandatory=False)
	if result:
		env['LIBPATH_PYEMBED']=path
		env.append_value('LIB_PYEMBED',[name])
	else:
		conf.to_log("\n\n### LIB NOT FOUND\n")
	if(sys.platform=='win32'or sys.platform.startswith('os2')or sys.platform=='darwin'or dct['Py_ENABLE_SHARED']):
		env['LIBPATH_PYEXT']=env['LIBPATH_PYEMBED']
		env['LIB_PYEXT']=env['LIB_PYEMBED']
	num='.'.join(env['PYTHON_VERSION'].split('.')[:2])
	try:
		conf.find_program('python%s-config'%num,var='PYTHON_CONFIG')
	except conf.errors.ConfigurationError:
		conf.find_program('python-config-%s'%num,var='PYTHON_CONFIG',mandatory=False)
	includes=[]
	if conf.env.PYTHON_CONFIG:
		for incstr in conf.cmd_and_log("%s %s --includes"%(python,conf.env.PYTHON_CONFIG)).strip().split():
			if(incstr.startswith('-I')or incstr.startswith('/I')):
				incstr=incstr[2:]
			if incstr not in includes:
				includes.append(incstr)
		conf.to_log("Include path for Python extensions ""(found via python-config --includes): %r\n"%(includes,))
		env['INCLUDES_PYEXT']=includes
		env['INCLUDES_PYEMBED']=includes
	else:
		conf.to_log("Include path for Python extensions ""(found via distutils module): %r\n"%(dct['INCLUDEPY'],))
		env['INCLUDES_PYEXT']=[dct['INCLUDEPY']]
		env['INCLUDES_PYEMBED']=[dct['INCLUDEPY']]
	if env['CC_NAME']=='gcc':
		env.append_value('CFLAGS_PYEMBED',['-fno-strict-aliasing'])
		env.append_value('CFLAGS_PYEXT',['-fno-strict-aliasing'])
	if env['CXX_NAME']=='gcc':
		env.append_value('CXXFLAGS_PYEMBED',['-fno-strict-aliasing'])
		env.append_value('CXXFLAGS_PYEXT',['-fno-strict-aliasing'])
	conf.check(header_name='Python.h',define_name='HAVE_PYTHON_H',uselib='PYEMBED',fragment=FRAG,errmsg='Could not find the python development headers')
コード例 #46
0
def configure(conf):
    """Finds the ar program and sets the default flags in ``conf.env.ARFLAGS``"""
    conf.find_program('ar', var='AR')
    conf.add_os_flags('ARFLAGS')
    if not conf.env.ARFLAGS:
        conf.env.ARFLAGS = ['rcs']
コード例 #47
0
def find_dar(conf):
    conf.find_program(['dar'],
                      var='AR',
                      path_list=getattr(Options.options, 'diabbindir', ""))
    conf.env.AR_NAME = 'dar'
    conf.env.ARFLAGS = 'rcs'
コード例 #48
0
ファイル: julia.py プロジェクト: afeldman/waf-tool
def fing_julia(cfg):
    julia = conf.find_program(['julia'], var='JL')
    conf.get_julia_version()
    conf.env.JL_NAME = 'julia'
コード例 #49
0
def find_dcc(conf):
    conf.find_program(['dcc'],
                      var='CC',
                      path_list=getattr(Options.options, 'diabbindir', ""))
    conf.env.CC_NAME = 'dcc'
コード例 #50
0
def find_sxfc(conf):
    """Find the NEC fortran compiler (will look in the environment variable 'FC')"""
    fc = conf.find_program(["sxf90", "sxf03"], var="FC")
    conf.get_sxfc_version(fc)
    conf.env.FC_NAME = "NEC"
    conf.env.FC_MOD_CAPITALIZATION = "lower"
コード例 #51
0
def configure_3rd_party_with_autotools(conf,
                                       archive_name,
                                       without_configure=False,
                                       without_make_install=False,
                                       conf_args="",
                                       cflags_args="",
                                       make_args=[]):
    name = archive_name_without_suffix(archive_name)
    Logs.pprint("BLUE", "Starting installation of %s" % name)
    conf.to_log((" Starting installation of %s " % name).center(80, "="))

    archive_path = os.path.join(conf.path.abspath(), "3rd", archive_name)
    destnode = conf.bldnode.make_node("3rd")

    # Install everything in build directory, in '3rd' subdirectory (the 'lib' and
    # 'include' directory can be copied in conf.env.PREFIX when ./waf install is
    # called, if needed)
    incdir = destnode.find_or_declare("include").abspath()
    libdir = destnode.find_or_declare("lib").abspath()

    srcdir = conf.extract_archive(archive_path, name, destnode)

    conf.find_program("make")

    # Apply patches
    conf.apply_all_relevant_patches(name)

    # always build static library, even if ibex is built as a shared library.
    conf_args += " --enable-static --disable-shared"

    if conf.env.ENABLE_SHARED:
        cflags = os.getenv("CFLAGS", "")
        cxxflags = os.getenv("CXXFLAGS", "")
        os.environ["CFLAGS"] = cflags + " " + cflags_args + "  ".join(
            conf.env.CFLAGS_cshlib)
        os.environ["CXXFLAGS"] = cxxflags + " " + " ".join(
            conf.env.CXXFLAGS_cxxshlib)
    else:
        cflags = os.getenv("CFLAGS", "")
        cxxflags = os.getenv("CXXFLAGS", "")
        os.environ["CFLAGS"] = cflags + " " + cflags_args
        os.environ["CXXFLAGS"] = cxxflags + " "

    if Utils.is_win32:
        conf_args += " --prefix=%s" % convert_path_win2msys(destnode.abspath())
        conf.find_program("sh")
        cmd_conf = [conf.env.SH, "-c", "./configure %s" % conf_args]
        cmd_make = conf.env.MAKE + make_args
    else:
        conf_args += " --prefix=%s" % destnode.abspath()
        cmd_conf = "./configure %s" % (conf_args)
        cmd_make = conf.env.MAKE + ["-j%d" % conf.options.jobs] + make_args
    cmd_install = conf.env.MAKE + ["install"]

    stages = []
    if not without_configure:
        stages += [(cmd_conf, "configure")]
    stages += [(cmd_make, "make")]
    if not without_make_install:
        stages += [(cmd_install, "install")]
    for cmd, stage in stages:
        conf.start_msg("Calling %s" % stage)
        try:
            out = conf.cmd_and_log(cmd, cwd=srcdir, env=os.environ)
            conf.end_msg("done")
        except Errors.WafError as e:
            conf.end_msg("failed", color="RED")
            print(e)
            conf.fatal("failed to %s %s (%s)" % (stage, name, cmd))

    conf.to_log((" Installation of %s: done " % name).center(80, "="))

    if conf.env.ENABLE_SHARED:
        os.environ["CFLAGS"] = cflags
        os.environ["CXXFLAGS"] = cxxflags

    return srcdir, incdir, libdir
コード例 #52
0
ファイル: cuda.py プロジェクト: cawka/waf-old-fork
def configure(conf):
    conf.find_program('nvcc', var='NVCC')
    conf.find_cuda_libs()
コード例 #53
0
def check_python_headers(conf, features='pyembed pyext'):
    features = Utils.to_list(features)
    assert ('pyembed' in features) or (
        'pyext' in features
    ), "check_python_headers features must include 'pyembed' and/or 'pyext'"
    env = conf.env
    if not env.CC_NAME and not env.CXX_NAME:
        conf.fatal('load a compiler first (gcc, g++, ..)')
    if conf.python_cross_compile(features):
        return
    if not env.PYTHON_VERSION:
        conf.check_python_version()
    pybin = env.PYTHON
    if not pybin:
        conf.fatal('Could not find the python executable')
    v = 'prefix SO LDFLAGS LIBDIR LIBPL INCLUDEPY Py_ENABLE_SHARED MACOSX_DEPLOYMENT_TARGET LDSHARED CFLAGS LDVERSION'.split(
    )
    try:
        lst = conf.get_python_variables(
            ["get_config_var('%s') or ''" % x for x in v])
    except RuntimeError:
        conf.fatal("Python development headers not found (-v for details).")
    vals = ['%s = %r' % (x, y) for (x, y) in zip(v, lst)]
    conf.to_log("Configuration returned from %r:\n%s\n" %
                (pybin, '\n'.join(vals)))
    dct = dict(zip(v, lst))
    x = 'MACOSX_DEPLOYMENT_TARGET'
    if dct[x]:
        env[x] = conf.environ[x] = dct[x]
    env.pyext_PATTERN = '%s' + dct['SO']
    num = '.'.join(env.PYTHON_VERSION.split('.')[:2])
    conf.find_program([
        ''.join(pybin) + '-config',
        'python%s-config' % num,
        'python-config-%s' % num,
        'python%sm-config' % num
    ],
                      var='PYTHON_CONFIG',
                      msg="python-config",
                      mandatory=False)
    if env.PYTHON_CONFIG:
        if conf.env.HAVE_PYTHON_H:
            return
        all_flags = [['--cflags', '--libs', '--ldflags']]
        if sys.hexversion < 0x2070000:
            all_flags = [[k] for k in all_flags[0]]
        xx = env.CXX_NAME and 'cxx' or 'c'
        if 'pyembed' in features:
            for flags in all_flags:
                embedflags = flags + ['--embed']
                try:
                    conf.check_cfg(
                        msg='Asking python-config for pyembed %r flags' %
                        ' '.join(embedflags),
                        path=env.PYTHON_CONFIG,
                        package='',
                        uselib_store='PYEMBED',
                        args=embedflags)
                except conf.errors.ConfigurationError:
                    conf.check_cfg(
                        msg='Asking python-config for pyembed %r flags' %
                        ' '.join(flags),
                        path=env.PYTHON_CONFIG,
                        package='',
                        uselib_store='PYEMBED',
                        args=flags)
            try:
                conf.test_pyembed(xx)
            except conf.errors.ConfigurationError:
                if dct['Py_ENABLE_SHARED'] and dct['LIBDIR']:
                    env.append_unique('LIBPATH_PYEMBED', [dct['LIBDIR']])
                    conf.test_pyembed(xx)
                else:
                    raise
        if 'pyext' in features:
            for flags in all_flags:
                conf.check_cfg(msg='Asking python-config for pyext %r flags' %
                               ' '.join(flags),
                               path=env.PYTHON_CONFIG,
                               package='',
                               uselib_store='PYEXT',
                               args=flags)
            try:
                conf.test_pyext(xx)
            except conf.errors.ConfigurationError:
                if dct['Py_ENABLE_SHARED'] and dct['LIBDIR']:
                    env.append_unique('LIBPATH_PYEXT', [dct['LIBDIR']])
                    conf.test_pyext(xx)
                else:
                    raise
        conf.define('HAVE_PYTHON_H', 1)
        return
    all_flags = dct['LDFLAGS'] + ' ' + dct['CFLAGS']
    conf.parse_flags(all_flags, 'PYEMBED')
    all_flags = dct['LDFLAGS'] + ' ' + dct['LDSHARED'] + ' ' + dct['CFLAGS']
    conf.parse_flags(all_flags, 'PYEXT')
    result = None
    if not dct["LDVERSION"]:
        dct["LDVERSION"] = env.PYTHON_VERSION
    for name in ('python' + dct['LDVERSION'],
                 'python' + env.PYTHON_VERSION + 'm',
                 'python' + env.PYTHON_VERSION.replace('.', '')):
        if not result and env.LIBPATH_PYEMBED:
            path = env.LIBPATH_PYEMBED
            conf.to_log("\n\n# Trying default LIBPATH_PYEMBED: %r\n" % path)
            result = conf.check(
                lib=name,
                uselib='PYEMBED',
                libpath=path,
                mandatory=False,
                msg='Checking for library %s in LIBPATH_PYEMBED' % name)
        if not result and dct['LIBDIR']:
            path = [dct['LIBDIR']]
            conf.to_log("\n\n# try again with -L$python_LIBDIR: %r\n" % path)
            result = conf.check(lib=name,
                                uselib='PYEMBED',
                                libpath=path,
                                mandatory=False,
                                msg='Checking for library %s in LIBDIR' % name)
        if not result and dct['LIBPL']:
            path = [dct['LIBPL']]
            conf.to_log(
                "\n\n# try again with -L$python_LIBPL (some systems don't install the python library in $prefix/lib)\n"
            )
            result = conf.check(lib=name,
                                uselib='PYEMBED',
                                libpath=path,
                                mandatory=False,
                                msg='Checking for library %s in python_LIBPL' %
                                name)
        if not result:
            path = [os.path.join(dct['prefix'], "libs")]
            conf.to_log(
                "\n\n# try again with -L$prefix/libs, and pythonXY name rather than pythonX.Y (win32)\n"
            )
            result = conf.check(lib=name,
                                uselib='PYEMBED',
                                libpath=path,
                                mandatory=False,
                                msg='Checking for library %s in $prefix/libs' %
                                name)
        if result:
            break
    if result:
        env.LIBPATH_PYEMBED = path
        env.append_value('LIB_PYEMBED', [name])
    else:
        conf.to_log("\n\n### LIB NOT FOUND\n")
    if Utils.is_win32 or dct['Py_ENABLE_SHARED']:
        env.LIBPATH_PYEXT = env.LIBPATH_PYEMBED
        env.LIB_PYEXT = env.LIB_PYEMBED
    conf.to_log(
        "Include path for Python extensions (found via distutils module): %r\n"
        % (dct['INCLUDEPY'], ))
    env.INCLUDES_PYEXT = [dct['INCLUDEPY']]
    env.INCLUDES_PYEMBED = [dct['INCLUDEPY']]
    if env.CC_NAME == 'gcc':
        env.append_unique('CFLAGS_PYEMBED', ['-fno-strict-aliasing'])
        env.append_unique('CFLAGS_PYEXT', ['-fno-strict-aliasing'])
    if env.CXX_NAME == 'gcc':
        env.append_unique('CXXFLAGS_PYEMBED', ['-fno-strict-aliasing'])
        env.append_unique('CXXFLAGS_PYEXT', ['-fno-strict-aliasing'])
    if env.CC_NAME == "msvc":
        from distutils.msvccompiler import MSVCCompiler
        dist_compiler = MSVCCompiler()
        dist_compiler.initialize()
        env.append_value('CFLAGS_PYEXT', dist_compiler.compile_options)
        env.append_value('CXXFLAGS_PYEXT', dist_compiler.compile_options)
        env.append_value('LINKFLAGS_PYEXT', dist_compiler.ldflags_shared)
    conf.check(
        header_name='Python.h',
        define_name='HAVE_PYTHON_H',
        uselib='PYEMBED',
        fragment=FRAG,
        errmsg=
        'Distutils not installed? Broken python installation? Get python-config now!'
    )
コード例 #54
0
def find_glib_compile_resources(conf):
    conf.find_program("glib-compile-resources", var="GLIB_COMPILE_RESOURCES")
コード例 #55
0
def find_bgxlf(conf):
    fc = conf.find_program(['bgxlf2003_r', 'bgxlf2003'], var='FC')
    conf.get_xlf_version(fc)
    conf.env.FC_NAME = 'BGXLF'
コード例 #56
0
def find_glib_mkenums(conf):
    if not conf.env.PERL:
        conf.find_program("perl", var="PERL")
    conf.find_program("glib-mkenums", interpreter="PERL", var="GLIB_MKENUMS")
コード例 #57
0
def mkspec_emscripten_configure(conf, major, minor, minimum=False,
                                force_debug=False):

    print('***emscripten_common.py::mkspec_emscripten_configure')
    """
    :param force_debug: Always compile with debugging flags, if true
    """
    conf.set_mkspec_platform('emscripten')

    # The path to the emscripten compiler
    paths = conf.get_tool_option('emscripten_path')

    # The node.js binary can be "nodejs" or simply "node"
    conf.find_program(['nodejs', 'node'], var='NODEJS')

    # Find the clang++ compiler
    cxx = conf.find_program(['em++'], path_list=paths)
    cxx = conf.cmd_to_list(cxx)
    conf.env['CXX'] = cxx
    conf.env['CXX_NAME'] = os.path.basename(conf.env.get_flat('CXX'))

    conf.check_emscripten_version(cxx, major, minor, minimum)

    # Find clang as the C compiler
    cc = conf.find_program(['emcc'], path_list=paths)
    cc = conf.cmd_to_list(cc)
    conf.env['CC'] = cc
    conf.env['CC_NAME'] = os.path.basename(conf.env.get_flat('CC'))

    conf.check_emscripten_version(cc, major, minor, minimum)

    # Find the archiver
    conf.find_program('emar', path_list=paths, var='AR')
    conf.env.ARFLAGS = ['rcs']

    # Set up C++ tools and flags
    conf.gxx_common_flags()
    conf.cxx_load_tools()
    conf.cxx_add_flags()

    # Also set up C tools and flags
    conf.gcc_common_flags()
    conf.cc_load_tools()
    conf.cc_add_flags()

    # Add linker flags
    conf.link_add_flags()

    # Add the special flags required for emscripten
    conf.env.cshlib_PATTERN = '%s.js'
    conf.env.cxxshlib_PATTERN = '%s.js'
    conf.env.cstlib_PATTERN = '%s.a'
    conf.env.cxxstlib_PATTERN = '%s.a'
    conf.env.cprogram_PATTERN = conf.env.cxxprogram_PATTERN = '%s.js'
    conf.env.CXX_TGT_F = ['-c', '-o', '']
    conf.env.CC_TGT_F = ['-c', '-o', '']
    conf.env.CXXLNK_TGT_F = ['-o', '']
    conf.env.CCLNK_TGT_F = ['-o', '']
    conf.env.append_value('LINKFLAGS',['-Wl,--enable-auto-import'])

    # Add our own cxx flags
    conf.env['CXXFLAGS'] += \
        ['-O2', '-Wextra', '-Wall', '-Wno-warn-absolute-paths']

    if conf.has_tool_option('cxx_debug') or force_debug:
        conf.env['CXXFLAGS'] += ['-g']
        conf.env['LINKFLAGS'] += ['-s']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']

    conf.env['CXXFLAGS'] += ['-std=c++11']

    # Add our own cc flags
    conf.env['CFLAGS'] += \
        ['-O2', '-Wextra', '-Wall', '-Wno-warn-absolute-paths']

    if conf.has_tool_option('cxx_debug') or force_debug:
        conf.env['CFLAGS'] += ['-g']

    if conf.has_tool_option('cxx_nodebug'):
        conf.env['DEFINES'] += ['NDEBUG']
コード例 #58
0
def find_glib_genmarshal(conf):
    conf.find_program("glib-genmarshal", var="GLIB_GENMARSHAL")
コード例 #59
0
ファイル: glib2.py プロジェクト: cawka/waf-old-fork
def find_glib_genmarshal(conf):
    conf.find_program('glib-genmarshal', var='GLIB_GENMARSHAL')
コード例 #60
0
def find_gxx(conf):
    cxx = conf.find_program(['g++', 'c++'], var='CXX')
    conf.get_cc_version(cxx, gcc=True)
    conf.env.CXX_NAME = 'gcc'