Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gfx module doesn't compile with MingW compiler when building for D3D11 #294

Open
Oldes opened this issue Apr 6, 2018 · 5 comments
Open

Comments

@Oldes
Copy link
Contributor

Oldes commented Apr 6, 2018

Current code is using forward-declarations of enumerations, which is not accepted by MingW, although VS is fine with them. This leads to errors like:

oryol\code\Modules/Gfx/private/d3d11/d3d11_decl.h:35:6: error: use of enum 'D3D11_USAGE' without previous declaration
 enum D3D11_USAGE;

Note: so far MingW also requires this flag: -mno-ms-bitfields for compilation of the Gfx module.

@floooh
Copy link
Owner

floooh commented Apr 6, 2018

Yeah, I guess these are the bitfields in GfxTypes.h, with the move to sokol_gfx.h those will be gone as well.

Right now the Windows-specific code basically assumes that you're compiling with the Visual Studio compiler. Did you try compiling with clang? I've read that recent versions can directly consume Windows headers, so I guess it's more compatible with Visual Studio's idea of the C++ standard.

@Oldes
Copy link
Contributor Author

Oldes commented Apr 6, 2018

I tried clang but so far could not found how to fix these errors:

c:\SDKs\LLVM\bin\clang.exe  oryol\code\Modules\Gfx\Gfx.cc -c -mno-ms-bitfields -O3 -DORYOL_WINDOWS -DORYOL_WIN64 -D_CRT_SECURE_NO_WARNINGS -D_MBCS -DGLM_FORCE_RADIANS=1 -DORYOL_D3D11  -o %_%oryol\code\Modules\Gfx\Gfx.cc.o -Ioryol-samples\ -Ioryol\ -Ioryol\
code\ -Ioryol\code\Modules\ -I..\Glm\glm\
In file included from oryol\code\Modules\Gfx\Gfx.cc:5:
In file included from oryol\code\Modules\Gfx/Gfx.h:12:
In file included from oryol\code\Modules\Gfx/GfxTypes.h:11:
In file included from ..\Glm\glm\glm/vec4.hpp:4:
In file included from ..\Glm\glm\glm/detail/setup.hpp:36:
In file included from ..\Glm\glm\glm/detail/../simd/platform.h:373:
In file included from c:\SDKs\LLVM\lib\clang\5.0.1\include\emmintrin.h:27:
In file included from c:\SDKs\LLVM\lib\clang\5.0.1\include\xmmintrin.h:27:
c:\SDKs\LLVM\lib\clang\5.0.1\include\mmintrin.h:81:40: error: cannot initialize a parameter of type '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si' (aka 'int')
    return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
                                       ^~~~~~~~~~~

@kritzikratzi
Copy link

did you try clang-cl? (or the ms compatibility flags for clang). maybe it helps.

@pixelherodev
Copy link
Contributor

Could I request a change of the name of this issue to show that it's specifically D3D11 that doesn't build, not the Gfx module as a whole?

@floooh floooh changed the title It is not possible to compile Gfx module using MingW compiler Gfx module doesn't compile with MingW compiler when building for D3D11 Sep 17, 2018
@pixelherodev
Copy link
Contributor

On that note, is there some config I'm missing that can be used to build for MinGW with OpenGL? Also, is there a way to cross-compile for MinGW off of Linux?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants