Merge pull request #23 from miroi/miro_appveyor

Adapted lib/config.py for MS Windows
This commit is contained in:
Radovan Bast 2015-06-28 23:03:18 +02:00
commit 9bdca0abd7
2 changed files with 26 additions and 4 deletions

View File

@ -1,9 +1,6 @@
[![Build Status](https://travis-ci.org/scisoft/autocmake.svg?branch=master)](https://travis-ci.org/scisoft/autocmake/builds) [![Build Status](https://travis-ci.org/scisoft/autocmake.svg?branch=master)](https://travis-ci.org/scisoft/autocmake/builds)
[![Documentation Status](https://readthedocs.org/projects/autocmake/badge/?version=latest)](http://autocmake.readthedocs.org) [![Documentation Status](https://readthedocs.org/projects/autocmake/badge/?version=latest)](http://autocmake.readthedocs.org)
[![Build Status](https://ci.appveyor.com/api/projects/status/github/scisoft/autocmake?branch=appveyor&svg=true)](https://ci.appveyor.com/project/scisoft/autocmake)
MiroI build statuses:
[![Build Status](https://travis-ci.org/miroi/autocmake.svg?branch=master)](https://travis-ci.org/miroi/autocmake/builds)
[![Build Status](https://ci.appveyor.com/api/projects/status/github/miroi/autocmake?branch=master&svg=true)](https://ci.appveyor.com/project/miroi/autocmake)
# Autocmake # Autocmake

View File

@ -43,6 +43,29 @@ def setup_build_path(build_path):
else: else:
os.makedirs(build_path, 0o755) os.makedirs(build_path, 0o755)
def adapt_cmake_command_to_arch(cmake_command):
"""
Adapt CMake command for MS Windows architecture:
"FC=foo CC=bar cmake -DTHIS -DTHAT='this and that'" rewrites into
"set FC=foo && set CC=bar && cmake -DTHIS -DTHAT='this and that'"
"""
if sys.platform == 'win32':
cmake_pos=cmake_command.find('cmake')
cmake_export_vars=cmake_command[:cmake_pos]
cmake_strings=cmake_command[cmake_pos:]
all_modified_exported_vars=""
for exported_var in cmake_export_vars.split():
modified_exported_var="set " + exported_var + " && "
all_modified_exported_vars=all_modified_exported_vars+modified_exported_var
cmake_command_arch = all_modified_exported_vars + cmake_strings
else:
cmake_command_arch = cmake_command
return cmake_command_arch
def run_cmake(command, build_path, default_build_path): def run_cmake(command, build_path, default_build_path):
""" """
@ -115,6 +138,8 @@ def configure(root_directory, build_path, cmake_command, only_show):
if not only_show: if not only_show:
setup_build_path(build_path) setup_build_path(build_path)
cmake_command=adapt_cmake_command_to_arch(cmake_command)
print('%s\n' % cmake_command) print('%s\n' % cmake_command)
if only_show: if only_show:
sys.exit(0) sys.exit(0)