diff options
author | Evan Martin <martine@danga.com> | 2011-05-09 15:58:13 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-05-09 15:58:13 (GMT) |
commit | f685c540be9bc84d45667d8af229f0ae3fdcdebd (patch) | |
tree | 4cf014ac77531899c2a469578900f328e402fa02 | |
parent | 18a9a3d98b0449061c3cdcb4646ada71cd2fa8eb (diff) | |
download | Ninja-f685c540be9bc84d45667d8af229f0ae3fdcdebd.zip Ninja-f685c540be9bc84d45667d8af229f0ae3fdcdebd.tar.gz Ninja-f685c540be9bc84d45667d8af229f0ae3fdcdebd.tar.bz2 |
make platform a command-line arg to configure
-rw-r--r-- | HACKING | 2 | ||||
-rwxr-xr-x | configure.py | 28 |
2 files changed, 20 insertions, 10 deletions
@@ -35,7 +35,7 @@ Documentation guidelines: Windows development: - sudo apt-get install gcc-mingw32 wine -- NINJA_PLATFORM=mingw ./configure +- ./configure.py --platform=mingw - Build gtest: - unpack it into your source dir - ./configure CC=i586-mingw32msvc-cc CXX=i586-mingw32msvc-c++ diff --git a/configure.py b/configure.py index 48b4ce1..1dc777e 100755 --- a/configure.py +++ b/configure.py @@ -19,21 +19,31 @@ Projects that use ninja themselves should either write a similar script or use a meta-build system that supports Ninja output.""" +from optparse import OptionParser import os import sys sys.path.insert(0, 'misc') import ninja -platform = os.environ.get('NINJA_PLATFORM', sys.platform) -if platform.startswith('linux'): - platform = 'linux' -elif platform.startswith('freebsd'): - platform = 'freebsd' -elif platform.startswith('mingw'): - platform = 'mingw' -elif platform.startswith('win'): - platform = 'windows' +parser = OptionParser() +platforms = ['linux', 'freebsd', 'mingw', 'windows'] +parser.add_option('--platform', + help='target platform (' + '/'.join(platforms) + ')', + choices=platforms) +(options, args) = parser.parse_args() + +platform = options.platform +if platform is None: + platform = sys.platform + if platform.startswith('linux'): + platform = 'linux' + elif platform.startswith('freebsd'): + platform = 'freebsd' + elif platform.startswith('mingw'): + platform = 'mingw' + elif platform.startswith('win'): + platform = 'windows' BUILD_FILENAME = 'build.ninja' buildfile = open(BUILD_FILENAME, 'w') |