microsoft / DirectXTex

DirectXTex texture processing library
https://walbourn.github.io/directxtex/
MIT License
1.79k stars 441 forks source link

Convert angled include to quotes for cross platform clang compatability #286

Closed dtzxporter closed 1 year ago

dtzxporter commented 1 year ago

https://github.com/microsoft/DirectXTex/blob/a189a1952aa6bd0b69a7678ea1b3278cb6a745d3/DirectXTex/DirectXTex.h#L33-L34

Clang will complain that these imports aren't from a system directory. 'isystem'.

Changing them to quote includes will solve the issue and should still be compatible with the current setup.

This will allow the library to build/run on linux/macOS.

walbourn commented 1 year ago

Can you provide the compiler output here? I'm not seeing them when I build on Linux.

walbourn commented 1 year ago

I wasn't able to reproduce this warning with WSL using clang 14 or GCC 12. Can you provide more detail on the compiler version and exact compiler output?

Thanks!

dtzxporter commented 1 year ago
DirectXTex.h:33:10: error: 'directx/dxgiformat.h' file not found with <angled> include; use "quotes" instead

I am actually building with the worst version of clang ever, Apple's :D

I am writing Rust bindings to DXT, and the only blocker now to cross platform compilation is this. I can manually edit the files, but it would be nice to have it working 'officially'. I believe Apple's clang deviates a bit here, and upstream clang allows it.

For reference: "Apple clang version 13.1.6 (clang-1316.0.21.2.5)"

walbourn commented 1 year ago

Are you using directx-headers and directxmath from vcpkg or did you install them yourself?

dtzxporter commented 1 year ago

Myself, as submodules of the sys crate that I created for the bindings.

I handle 'sal.h' automatically as well.

walbourn commented 1 year ago

By putting the directx-headers and directxmath directly into your project, the headers there are NOT being considered 'system headers' which they should be. Using vcpkg or some other package manager would indicate them as 'external' which should work.