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
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))
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'])
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()
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)
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)
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)
def build_gepard(arguments): """ Runs the build. """ build_path = util.get_build_path(arguments) check_configured(arguments) util.call(['make', '-s', '-C', build_path])
def build_examples(arguments): """ Builds examples. """ build_path = util.get_build_path(arguments) check_configured(arguments) util.call(['make', '-s', '-C', build_path, 'examples'])
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'])