Skip to content

Commit

Permalink
Merge pull request #14 from steinwurf/add-cmake
Browse files Browse the repository at this point in the history
add cmake
  • Loading branch information
jpihl committed Aug 2, 2019
2 parents a2e06c5 + 07f3eb1 commit ba579ee
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion NEWS.rst
Expand Up @@ -6,7 +6,7 @@ every change, see the Git log.

Latest
------
* tbd
* Minor: Added cmake support.

4.1.1
-----
Expand Down
20 changes: 18 additions & 2 deletions buildbot.py
Expand Up @@ -9,10 +9,10 @@
project_name = 'hex'


def run_command(args):
def run_command(args, env_ext={}):
print("Running: {}".format(args))
sys.stdout.flush()
subprocess.check_call(args)
subprocess.check_call(args, env=dict(os.environ.copy(), **env_ext))


def get_tool_options(properties):
Expand Down Expand Up @@ -81,6 +81,20 @@ def install(properties):
run_command(command)


def cmake(properties):
build_path = 'build'
if os.path.exists(build_path):
print("Path '{}' already exists - removing".format(build_path))
shutil.rmtree(build_path)
os.mkdir(build_path)

old_cwd = os.getcwd()
os.chdir(build_path)
run_command(['cmake', '../'], env_ext={'VERBOSE': '1'})
run_command(['cmake', '--build', '.'], env_ext={'VERBOSE': '1'})
os.chdir(old_cwd)


def coverage_settings(options):
options['required_line_coverage'] = 100.0

Expand All @@ -103,6 +117,8 @@ def main():
run_tests(properties)
elif cmd == 'install':
install(properties)
elif cmd == 'cmake':
cmake(properties)
else:
print("Unknown command: {}".format(cmd))

Expand Down

0 comments on commit ba579ee

Please sign in to comment.