aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/project/mingw.py
blob: 731cee9f9305fd60678c93d53c70241521356d87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Copyright (c) 2020 Egor Tensin <Egor.Tensin@gmail.com>
# This file is part of the "cmake-common" project.
# For details, see https://github.com/egor-tensin/cmake-common.
# Distributed under the MIT License.


def _get_compiler_prefix(platform):
    target_arch = platform.get_address_model()
    if target_arch == 32:
        return 'i686'
    if target_arch == 64:
        return 'x86_64'
    raise RuntimeError(f'unexpected address model: {target_arch}')


def _get(platform, what):
    prefix = _get_compiler_prefix(platform)
    path = f'{prefix}-w64-mingw32-{what}'
    return path


def get_gcc(platform):
    return _get(platform, 'gcc')


def get_gxx(platform):
    return _get(platform, 'g++')


def get_ar(platform):
    return _get(platform, 'gcc-ar')


def get_ranlib(platform):
    return _get(platform, 'gcc-ranlib')


def get_windres(platform):
    return _get(platform, 'windres')