From cfdf03c85491e33ac0bf41c70bdcc1686a705bef Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 30 May 2018 19:28:29 +0200 Subject: [PATCH] Select the default platform depending of the target. Default platform `android` is better for `kiwix-android` (because `kiwix-android` can build only on `android` platform). --- README.md | 6 ++++-- kiwixbuild/__init__.py | 2 +- kiwixbuild/builder.py | 8 +++++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 60c93b0..b901f4a 100644 --- a/README.md +++ b/README.md @@ -71,8 +71,10 @@ By default, `kiwix-build` will build `kiwix-tools` . ## Target platform -By default, `kiwix-build` will build everything for the current (native) -platform using dynamic linkage (`native_dyn`). +If no target platform is specified, a default one will be infered from +the specified target : +- `kiwix-android` will be build using the platform `android` +- Other targets will be build using the platform `native_dyn` But you can select another target platform using the option `--target-platform`. For now, there is ten different supported diff --git a/kiwixbuild/__init__.py b/kiwixbuild/__init__.py index 0c421a6..47b3695 100644 --- a/kiwixbuild/__init__.py +++ b/kiwixbuild/__init__.py @@ -14,7 +14,7 @@ def parse_args(): choices=Dependency.all_deps.keys()) parser.add_argument('--working-dir', default=".") parser.add_argument('--libprefix', default=None) - parser.add_argument('--target-platform', default="native_dyn", choices=PlatformInfo.all_platforms) + parser.add_argument('--target-platform', choices=PlatformInfo.all_platforms) parser.add_argument('--verbose', '-v', action="store_true", help=("Print all logs on stdout instead of in specific" " log files per commands")) diff --git a/kiwixbuild/builder.py b/kiwixbuild/builder.py index 758e027..8b4ee44 100644 --- a/kiwixbuild/builder.py +++ b/kiwixbuild/builder.py @@ -17,7 +17,13 @@ class Builder: self._targets = {} PlatformInfo.get_platform('neutral', self._targets) - platform = PlatformInfo.get_platform(option('target_platform'), self._targets) + target_platform = option('target_platform') + if not target_platform: + if option('target') == 'kiwix-android': + target_platform = 'android' + else: + target_platform = 'native_dyn' + platform = PlatformInfo.get_platform(target_platform, self._targets) self.targetDefs = platform.add_targets(option('target'), self._targets) def finalize_target_steps(self):