示例#1
0
文件: core.py 项目: sfiera/waf-sfiera
def platform(ctx, target, platform, **kwds):
    target = ctx.get_tgen_by_name(target)
    if unversioned_sys_platform() not in to_list(platform):
        return
    for key, val in kwds.items():
        setattr(target, key, to_list(getattr(target, key, [])))
        getattr(target, key).extend(to_list(val))
示例#2
0
文件: common-task.py 项目: cg439/AMD
def build(ctx):
    # Get the list of all the source files
    sources = ctx.path.ant_glob(incl=['**/*.cc', '**/*.cpp', '**/*.c'],
                                excl=['**/*.t.cpp', '**/.#*.cpp'])

    # int_deps (of the form 'nlpgo/util') and ext_deps ('CLD2') are defined
    # in the calling wscripts for each package
    use_libs = int_deps
    use_libs += [
        dep.upper() for dep in ext_deps if not dep.upper().startswith('BOOST')
    ]
    if ctx.env.USE_BOOST: use_libs += ['BOOST']

    linkflags = ''
    from waflib.Utils import unversioned_sys_platform
    if unversioned_sys_platform() == 'darwin':
        linkflags = '-all_load'  # Needed for serialization macros to work

    includes = [top, '.']
    rpath = [
        node.abspath() for node in ctx.path.find_node(top).get_bld().ant_glob(
            'nlpgo/', maxdepth=1, dir=True)
    ]
    ctx.program(source=sources,
                includes=includes,
                target=task_name,
                use=use_libs,
                cxxflags=ctx.env.GLOBAL_CXXFLAGS,
                linkflags=linkflags,
                rpath=rpath,
                export_includes='.')
示例#3
0
文件: core.py 项目: sfiera/waf-sfiera
def configure(cnf):
    if not hasattr(cnf, "c_std"):
        cnf.c_std = "c99"
    if cnf.c_std == "c89":
        cnf.env.append_unique("CFLAGS", ["-std=c89"])
    elif cnf.c_std == "c99":
        cnf.env.append_unique("CFLAGS", ["-std=c99"])

    if not hasattr(cnf, "cxx_std"):
        cnf.cxx_std = "c++98"
    if cnf.cxx_std == "c++11":
        cnf.env.append_unique("CXXFLAGS", ["-std=c++11", "-stdlib=libc++"])
        cnf.env.append_unique("LIB", "c++")
    elif cnf.cxx_std == "c++98":
        cnf.env.append_unique("CXXFLAGS", ["-std=c++98"])

    if cnf.options.mode == "opt":
        cnf.env.append_unique("CFLAGS", ["-Os", "-DNDEBUG"])
        cnf.env.append_unique("CXXFLAGS", ["-Os", "-DNDEBUG"])
    elif cnf.options.mode == "dev":
        pass
    elif cnf.options.mode == "dbg":
        cnf.env.append_unique("CFLAGS", "-g")
        cnf.env.append_unique("CXXFLAGS", "-g")

    cnf.load("platform_%s" % unversioned_sys_platform())
示例#4
0
def platform(ctx, target, platform, **kwds):
    target = ctx.get_tgen_by_name(target)
    if unversioned_sys_platform() not in to_list(platform):
        return
    for key, val in kwds.items():
        setattr(target, key, to_list(getattr(target, key, [])))
        getattr(target, key).extend(to_list(val))
示例#5
0
def configure(cnf):
    if not hasattr(cnf, "c_std"):
        cnf.c_std = "c99"
    if cnf.c_std == "c89":
        cnf.env.append_unique("CFLAGS", ["-std=c89"])
    elif cnf.c_std == "c99":
        cnf.env.append_unique("CFLAGS", ["-std=c99"])

    if not hasattr(cnf, "cxx_std"):
        cnf.cxx_std = "c++98"
    if cnf.cxx_std == "c++11":
        cnf.env.append_unique("CXXFLAGS", ["-std=c++11", "-stdlib=libc++"])
        cnf.env.append_unique("LIB", "c++")
    elif cnf.cxx_std == "c++98":
        cnf.env.append_unique("CXXFLAGS", ["-std=c++98"])

    if cnf.options.mode == "opt":
        cnf.env.append_unique("CFLAGS", ["-Os", "-DNDEBUG"])
        cnf.env.append_unique("CXXFLAGS", ["-Os", "-DNDEBUG"])
    elif cnf.options.mode == "dev":
        pass
    elif cnf.options.mode == "dbg":
        cnf.env.append_unique("CFLAGS", "-g")
        cnf.env.append_unique("CXXFLAGS", "-g")

    cnf.load("platform_%s" % unversioned_sys_platform())
示例#6
0
文件: core.py 项目: sfiera/waf-sfiera
def options(opt):
    opt.add_option(
            "-m", "--mode", action="store", default="opt", choices=["opt", "dev", "dbg"],
            help=dedent("""
                Select a set of compiler options.  Choices are "opt" (optimize for speed of the
                compiled executable), "dev" (optimize for speed of compilation process), and "dbg"
                (optimize for ability to debug).  [default: 'opt']
            """))

    opt.load("platform_%s" % unversioned_sys_platform())
示例#7
0
def options(opt):
    opt.add_option("-m",
                   "--mode",
                   action="store",
                   default="opt",
                   choices=["opt", "dev", "dbg"],
                   help=dedent("""
                Select a set of compiler options.  Choices are "opt" (optimize for speed of the
                compiled executable), "dev" (optimize for speed of compilation process), and "dbg"
                (optimize for ability to debug).  [default: 'opt']
            """))

    opt.load("platform_%s" % unversioned_sys_platform())
示例#8
0
文件: boost.py 项目: cg439/AMD
def install_boost(ctx):
    pprint('YELLOW', 'Attempting BOOST auto-installation ...')

    # First, search for the source files
    ctx.start_msg('Searching for BOOST sources')
    source_path = ctx.env.DEPS_SRC + '/boost_1_57_0'
    source_node = ctx.root.find_node(source_path)
    # If sources not found, try to download them
    if not source_node:
        ctx.end_msg('not found', color='YELLOW')
        ctx.download_boost()
    else:
        ctx.end_msg('ok')

    # At this point, we should have the sources
    chdir(source_path)

    # Bootstrap
    msg = 'Bootstrapping BOOST.Build'
    command = ['./bootstrap.sh']
    ctx.exec_with_msg(command, msg)

    # Build
    msg = 'Building and installing BOOST'
    command = ['./b2', '--prefix=' + ctx.env.DEPS_PREFIX ] + \
    ['--with-test'] + \
    ['--with-' + lib for lib in ctx.env.BOOST_PKGS
                     if ctx.boost_is_compiled(lib)] + \
    ['install']
    ctx.exec_with_msg(command, msg)

    # On MacOSX, the install_name is not set correctly by the boost build
    # Fix that by invoking the install_name_tool
    if unversioned_sys_platform() == 'darwin':
        chdir(ctx.env.DEPS_LIB)
        msg = 'Fixing dynamic library install name'
        command = 'for i in libboost*.dylib; do' + \
                  '  install_name_tool -id "@rpath/$i" $i;' + \
                  '  for j in libboost*.dylib; do' + \
                  '    install_name_tool -change $j "@rpath/$j" $i;' + \
                  '  done;' + \
                  'done;'
        ctx.exec_with_msg(command, msg, shell=True)

    pprint('YELLOW', '... BOOST auto-installation complete.')