Adds a workaround in gen_external.py to prevent the `Exception: preprocessor output is empty` build failure on windows amd64.
Unified · Split
| @@ -3,9 +3,6 @@ · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | environment: | 4 | environment: |
| 5 | 5 | ||
| 6 | global: | ||
| 7 | CUSTOM64PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin | ||
| 8 | |||
| 9 | matrix: | 6 | matrix: |
| 10 | 7 | ||
| 11 | # pre-installed python version, see: | 8 | # pre-installed python version, see: |
| @@ -43,14 +40,11 @@ environment: · 31 unmodified lines | |||
| 43 | PYTHON_ARCH: 64 | 40 | PYTHON_ARCH: 64 |
| 44 | 41 | ||
| 45 | install: | 42 | install: |
| 46 | |||
| 47 | - ECHO "Installed SDKs:" | 43 | - ECHO "Installed SDKs:" |
| 48 | - ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\"" | 44 | - ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\"" |
| 49 | 45 | ||
| 50 | - "SET PATH=%PYTHONDIR%;%PYTHONDIR%\\Scripts;%PATH%" | 46 | - "SET PATH=%PYTHONDIR%;%PYTHONDIR%\\Scripts;%PATH%" |
| 51 | 47 | ||
| 52 | - if [%PYTHON_ARCH%]==[64] SET PATH=%CUSTOM64PATH%;%PATH% | ||
| 53 | |||
| 54 | # Check that we have the expected version and architecture for Python | 48 | # Check that we have the expected version and architecture for Python |
| 55 | - "python --version" | 49 | - "python --version" |
| 56 | - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" | 50 | - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" |
| @@ -71,8 +65,6 @@ build_script: · 14 unmodified lines | |||
| 71 | - python waf configure build install --verbose --msvc_version="msvc 14.0" | 65 | - python waf configure build install --verbose --msvc_version="msvc 14.0" |
| 72 | # clean before building python package | 66 | # clean before building python package |
| 73 | - python waf distclean | 67 | - python waf distclean |
| 74 | # build python module without using libaubio | ||
| 75 | - pip wheel -v -v -v --wheel-dir=dist . | ||
| 76 | # build, upload and install wheel (inspired by numpy's appveyor) | 68 | # build, upload and install wheel (inspired by numpy's appveyor) |
| 77 | - ps: | | 69 | - ps: | |
| 78 | pip wheel -v -v -v --wheel-dir=dist . | 70 | pip wheel -v -v -v --wheel-dir=dist . |
| @@ -74,6 +74,18 @@ def get_preprocessor(): · 73 unmodified lines | |||
| 74 | cpp_cmd = compiler.cc.split() | 74 | cpp_cmd = compiler.cc.split() |
| 75 | cpp_cmd += ['-E'] | 75 | cpp_cmd += ['-E'] |
| 76 | 76 | ||
| 77 | # On win-amd64 (py3.x), the default compiler is cross-compiling, from x86 | ||
| 78 | # to amd64 with %WIN_SDK_ROOT%\x86_amd64\cl.exe, but using this binary as a | ||
| 79 | # pre-processor generates no output, so we use %WIN_SDK_ROOT%\cl.exe | ||
| 80 | # instead. | ||
| 81 | if len(cpp_cmd) > 1 and 'cl.exe' in cpp_cmd[-2]: | ||
| 82 | plat = os.path.basename(os.path.dirname(cpp_cmd[-2])) | ||
| 83 | if plat == 'x86_amd64': | ||
| 84 | print('workaround on win64 to avoid empty pre-processor output') | ||
| 85 | cpp_cmd[-2] = cpp_cmd[-2].replace('x86_amd64', '') | ||
| 86 | elif True in ['amd64' in f for f in cpp_cmd]: | ||
| 87 | print('warning: not using workaround for', cpp_cmd[0], plat) | ||
| 88 | |||
| 77 | if not cpp_cmd: | 89 | if not cpp_cmd: |
| 78 | print("Warning: could not guess preprocessor, using env's CC") | 90 | print("Warning: could not guess preprocessor, using env's CC") |
| 79 | cpp_cmd = os.environ.get('CC', 'cc').split() | 91 | cpp_cmd = os.environ.get('CC', 'cc').split() |