wrapper: use CMAKE_SYSTEM_NAME to detect Windows

This commit is contained in:
Danny Robson 2019-06-28 10:47:29 +10:00
parent 0701b07ad5
commit 3fc04e698e

View File

@ -76,16 +76,16 @@ defaults = {
env = defaults.copy() env = defaults.copy()
env.update(os.environ) env.update(os.environ)
# MinGW pretends to be its own platform. Try to work around their deception by def host_platform(tuple: str) -> str:
# testing if the platform string looks like something that's actually useful. return {
def is_really_windows() -> bool: 'x86_64-w64-mingw32': 'Windows'
name = platform.system() }[tuple]
if name == 'Windows':
return True # Don't use `platform.system()` as MinGW will pretend to be its own platform,
if name.startswith('MINGW'): # and cross compiling will give you CBUILD rather than CHOST.
return True def is_really_windows() -> bool:
return False return "@CMAKE_SYSTEM_NAME@" == "Windows"
# MSYS2 wants to fuck us over by supplying a CMake that gives something # MSYS2 wants to fuck us over by supplying a CMake that gives something