Example #1
0
def check_configured(arguments, throw=True):
    """ Checks if the build is configured. """
    build_path = util.get_build_path(arguments)

    ret = path.isfile(path.join(build_path, 'Makefile'))
    if not ret and throw:
        raise RuntimeError('Build is not configured.')

    return ret
Example #2
0
def configure(arguments):
    """ Configures the build based on the supplied arguments. """
    build_path = util.get_build_path(arguments)

    try:
        makedirs(build_path)
    except OSError:
        pass

    util.call(['cmake', '-B' + build_path, '-H' + util.get_base_path()] + create_options(arguments))
Example #3
0
def run_clean(arguments):
    """ Cleans the build directory. """
    build_path = util.get_build_path(arguments)

    try:
        check_configured(arguments)
    except Error:
        return

    util.call(['make', '-s', '-C', build_path, 'clean'])
Example #4
0
def configure(arguments):
    """ Configures the build based on the supplied arguments. """
    build_path = util.get_build_path(arguments)

    try:
        makedirs(build_path)
    except OSError:
        pass

    util.call(['cmake', '-B' + build_path, '-H' + util.get_base_path()] +
              create_options(arguments))
Example #5
0
def main():
    arguments = get_args()

    try:
        dependencies.build_dependencies([arguments.backend],
                                        arguments.rebuild_deps)
        build_path = util.get_build_path(arguments)
        configure(util.get_base_path(), build_path, arguments)
        build_targets(build_path, arguments.targets)
    except util.CommandError as e:
        print("Build failed: %s" % e)
        sys.exit(e.code)

    print_success()
Example #6
0
def run_unittest(throw=True):
    """ Runs unit-tests. """
    args = lambda: None
    args.build_dir = "build/unittest"
    args.build_type = "debug"
    args.backend = "software"
    args.targets = ["unittest"]
    build_path = util.get_build_path(args)

    print('')
    print("Building unit-tests...")
    build.configure(args)
    build.build_targets(args)

    print('')
    print("Running unit-tests...")
    return util.call([path.join(build_path, 'bin', 'unittest')], throw)
Example #7
0
def run_unittest(throw=True):
    """ Runs unit-tests. """
    args = lambda: None
    args.build_type = "debug"
    args.backend = "software"
    build_path = util.get_build_path(args)

    print('')
    print("Building unit-tests...")
    if not build.check_configured(args, throw=False):
        build.configure(args)

    build.build_unit(args)

    print('')
    print("Running unit-tests...")
    return util.call([path.join(build_path, 'bin', 'unit')], throw)
Example #8
0
def build_targets(arguments):
    """ Runs the build. """
    build_command = ['make', '-s', '-C', util.get_build_path(arguments)]
    build_command.extend(arguments.targets)

    util.call(build_command)
Example #9
0
def build_targets(arguments):
    """ Runs the build. """
    build_command = ['make', '-s', '-C', util.get_build_path(arguments)]
    build_command.extend(arguments.targets)

    util.call(build_command)
Example #10
0
def build_gepard(arguments):
    """ Runs the build. """
    build_path = util.get_build_path(arguments)
    check_configured(arguments)

    util.call(['make', '-s', '-C', build_path])
Example #11
0
def build_examples(arguments):
    """ Builds examples. """
    build_path = util.get_build_path(arguments)
    check_configured(arguments)

    util.call(['make', '-s', '-C', build_path, 'examples'])
Example #12
0
def build_unit(arguments):
    """ Builds unit-tests. """
    build_path = util.get_build_path(arguments)
    check_configured(arguments)

    util.call(['make', '-s', '-C', build_path, 'unit'])