DiligentGraphics / DiligentEngine

A modern cross-platform low-level graphics library and rendering framework
http://diligentgraphics.com/diligent-engine/
Apache License 2.0
3.63k stars 331 forks source link

not possible to build nativelly with mingw #192

Closed AndreyMlashkin closed 2 years ago

AndreyMlashkin commented 2 years ago

To reproduce the problem call: cmake -S . -B ./build/MinGW -D CMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" cmake --build .\build\MinGW\ -j6

Error: internal error in mingw32_gt_pch_use_address, at config/i386/host-mingw32.c:192: MapViewOfFileEx: Attempt to access invalid address.

It can be fixed the same way as it is fixed here: https://github.com/conan-io/conan-center-index/pull/10163

AndreyMlashkin commented 2 years ago

Please, also check compiled libraries names for MinGW. I've got libGraphicsEngineOpenGL_64r.dll.a and libGraphicsEngineVk_64r.dll.a

TheMostDiligent commented 2 years ago

Diligent provides extensive means for custom build configuration. To enable RTTI, custom_configure_build function should work: it is called after Diligent finishes configuring each target, and RTTI can be enabled if necessary. The function can be defined in the same CMake file before including the Diligent source dir.

AndreyMlashkin commented 2 years ago

Building current master (880a3fa2378d735436116fa7fe33400abcfab799) with mingw is not possible:

[ 52%] Building CXX object DiligentCore/Graphics/Archiver/CMakeFiles/Diligent-Archiver-static.dir/src/Archiver_GL.cpp.obj
In file included from e:\sources\diligentengine\diligentcore\graphics\graphicsengineopengl\include\pch.h:51,
                 from E:\sources\DiligentEngine\DiligentCore\Graphics\Archiver\src\Archiver_GL.cpp:30:
E:/sources/DiligentEngine/DiligentCore/ThirdParty/glew/include/GL/wglew.h:114:9: error: typedef 'BOOL' is initialized (use 'decltype' instead)
  114 | typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
      |         ^~~~
E:/sources/DiligentEngine/DiligentCore/ThirdParty/glew/include/GL/wglew.h:114:24: error: 'PFNWGLSETSTEREOEMITTERSTATE3DLPROC' was not declared in this scope
  114 | typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
E:/sources/DiligentEngine/DiligentCore/ThirdParty/glew/include/GL/wglew.h:138:9: error: typedef 'VOID' is initialized (use 'decltype' instead)
  138 | typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
      |         ^~~~
E:/sources/DiligentEngine/DiligentCore/ThirdParty/glew/include/GL/wglew.h:138:24: error: 'PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC' was not declared in this scope; did you mean 'PFNGLBLITNAMEDFRAMEBUFFERPROC'?
  138 | typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                        PFNGLBLITNAMEDFRAMEBUFFERPROC
In file included from e:\sources\diligentengine\diligentcore\graphics\graphicsengineopengl\include\pch.h:51,
                 from E:\sources\DiligentEngine\DiligentCore\Graphics\Archiver\src\Archiver_GL.cpp:30:
E:/sources/DiligentEngine/DiligentCore/ThirdParty/glew/include/GL/wglew.h:139:9: error: typedef 'HGLRC' is initialized (use 'decltype' instead)
  139 | typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
      |         ^~~~~
TheMostDiligent commented 2 years ago

Try to update to the latest. Should build in https://github.com/DiligentGraphics/DiligentEngine/commit/432850d5897e65bd6ad4b8ec39716abc973205aa

TheMostDiligent commented 2 years ago

libGraphicsEngineOpenGL_64r.dll.a and libGraphicsEngineVk_64r.dll.a

These are likely export libraries. The dll's should be in the bin folder.

AndreyMlashkin commented 2 years ago

Thank you for a prompt answer and a very quick fix! It works for me

TheMostDiligent commented 2 years ago

MinGW configuration has been added to CI.