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).
This commit is contained in:
Matthieu Gautier 2018-05-30 19:28:29 +02:00
parent 5f5fbfe082
commit cfdf03c854
3 changed files with 12 additions and 4 deletions

View File

@ -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

View File

@ -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"))

View File

@ -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):