|
15 | 15 |
|
16 | 16 | # pylint: disable=too-many-branches disable=too-many-statements disable=too-many-locals |
17 | 17 | LIBHEIF_ROOT = None |
| 18 | +PLATFORM_MINGW = os.name == "nt" and "GCC" in sys.version |
18 | 19 |
|
19 | 20 |
|
20 | 21 | class RequiredDependencyException(Exception): |
@@ -165,9 +166,12 @@ def build_extensions(self): # noqa |
165 | 166 | # ATTENTION: If someone knows how without hacks include MSYS2 directory as last directory in list - help! |
166 | 167 | self.compiler.include_dirs.append(os.path.dirname(os.path.abspath(__file__))) |
167 | 168 |
|
168 | | - self._update_extension( |
169 | | - "_pillow_heif", ["libheif"], extra_compile_args=["/d2FH4-", "/WX"], extra_link_args=["/WX"] |
170 | | - ) |
| 169 | + if PLATFORM_MINGW: |
| 170 | + self._update_extension("_pillow_heif", ["heif"], extra_compile_args=["-Ofast", "-Werror"]) |
| 171 | + else: |
| 172 | + self._update_extension( |
| 173 | + "_pillow_heif", ["libheif"], extra_compile_args=["/d2FH4-", "/WX"], extra_link_args=["/WX"] |
| 174 | + ) |
171 | 175 | elif sys.platform.lower() == "darwin": |
172 | 176 | try: # if Homebrew is installed, use its lib and include directories |
173 | 177 | homebrew_prefix = subprocess.check_output(["brew", "--prefix"]).strip().decode("latin1") |
@@ -267,6 +271,7 @@ def _get_macos_sdk_path(): |
267 | 271 | version=get_version(), |
268 | 272 | cmdclass={"build_ext": PillowHeifBuildExt}, |
269 | 273 | ext_modules=[Extension("_pillow_heif", ["pillow_heif/_pillow_heif.c"])], |
| 274 | + zip_safe=not PLATFORM_MINGW, |
270 | 275 | ) |
271 | 276 | except RequiredDependencyException as err: |
272 | 277 | msg = f""" |
|
0 commit comments