aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/project/mingw.py
diff options
context:
space:
mode:
Diffstat (limited to 'project/mingw.py')
-rw-r--r--project/mingw.py42
1 files changed, 15 insertions, 27 deletions
diff --git a/project/mingw.py b/project/mingw.py
index 731cee9..4ac921f 100644
--- a/project/mingw.py
+++ b/project/mingw.py
@@ -4,36 +4,24 @@
# 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}')
+class MinGW:
+ def __init__(self, platform):
+ self.prefix = platform.mingw_prefix()
+ def _get(self, what):
+ return f'{self.prefix}-w64-mingw32-{what}'
-def _get(platform, what):
- prefix = _get_compiler_prefix(platform)
- path = f'{prefix}-w64-mingw32-{what}'
- return path
+ def gcc(self):
+ return self._get('gcc')
+ def gxx(self):
+ return self._get('g++')
-def get_gcc(platform):
- return _get(platform, 'gcc')
+ def ar(self):
+ return self._get('gcc-ar')
+ def ranlib(self):
+ return self._get('gcc-ranlib')
-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')
+ def windres(self):
+ return self._get('windres')