Cross compiling Mesa for Windows: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 5: Line 5:
This article describes the process of cross-compiling Mesa for Windows on Arch Linux. The result is an opengl32.dll <span class="caps">DLL</span> that you can copy to the folder containing your application’s executable to use Mesa <span class="caps">LLVM</span>pipe software rendering.
This article describes the process of cross-compiling Mesa for Windows on Arch Linux. The result is an opengl32.dll <span class="caps">DLL</span> that you can copy to the folder containing your application’s executable to use Mesa <span class="caps">LLVM</span>pipe software rendering.


Cross compiling is currently the only method that can compile the latest versions of Mesa for Windows using <span class="caps">GCC</span>. Compiling Mesa natively on Windows using <span class="caps">GCC</span> with Scons results in “the command line is too long” error during linking. There are known issues when compiling Mesa with optimizations using Visual Studio 2010. Compiling with Visual Studio 2012 is possible but requires Windows 7 and the default platform target does not support Windows XP. It is possible to cross compile using Cygwin or MSYS2 Scons.
Cross compiling is currently the only method that can compile the latest versions of Mesa for Windows using <span class="caps">GCC</span>. Compiling Mesa natively on Windows using <span class="caps">GCC</span> with Scons results in “the command line is too long” error during linking. There are known issues when compiling Mesa with optimizations using Visual Studio 2010. Compiling with Visual Studio 2012 is possible but requires Windows 7 and the default platform target does not support Windows XP. It is possible to cross compile using Cygwin or [[MSYS2]] Scons.


Prebuilt binaries for Mesa are available from the MSYS2 project:
Prebuilt binaries for Mesa are available from the MSYS2 project:

Revision as of 07:15, 10 February 2015

Cross compiling Mesa for Windows

QtQuick 2.0 applications require OpenGL 2.1 or higher to run. Windows only provides OpenGL 1.1 by default, which is not sufficient. One workaround is to use ANGLE which implements the OpenGL ES 2 API on top of DirectX 9. The benefit of using ANGLE is that the graphics are hardware-accelerated but ANGLE requires Windows Vista or later. The other option is to use a software renderer such as Mesa which can run on Windows XP or later and may perform better than ANGLE when running inside virtual machines.

This article describes the process of cross-compiling Mesa for Windows on Arch Linux. The result is an opengl32.dll DLL that you can copy to the folder containing your application’s executable to use Mesa LLVMpipe software rendering.

Cross compiling is currently the only method that can compile the latest versions of Mesa for Windows using GCC. Compiling Mesa natively on Windows using GCC with Scons results in “the command line is too long” error during linking. There are known issues when compiling Mesa with optimizations using Visual Studio 2010. Compiling with Visual Studio 2012 is possible but requires Windows 7 and the default platform target does not support Windows XP. It is possible to cross compile using Cygwin or MSYS2 Scons.

Prebuilt binaries for Mesa are available from the MSYS2 project:

Install required Arch Linux packages

Compiling for Windows 32-bit

Create a working directory for build

Download LLVM and Mesa sources

Extract sources

Build LLVM

Note: Use of the strerror_s function is disabled by writing an entry to config.cache for Windows XP compatibility.

Build Mesa

Complete

You can now copy opengl32.dll from the ~/mesa_win32/dist folder to the folder containing your application’s executable.
Your Qt must be compiled with Desktop OpenGL to use opengl32.dll. The ANGLE build will not load the mesa library.

Compiling for Windows 64-bit

Create a working directory for build

Download LLVM and Mesa sources

Extract sources

Build LLVM

Note: Use of the strerror_s function is disabled by writing an entry to config.cache for Windows XP x64 compatibility.

Build Mesa

Complete

You can now copy opengl32.dll from the ~/mesa_win64/dist folder to the folder containing your application’s executable.
Your Qt must be compiled with Desktop OpenGL to use opengl32.dll. The ANGLE build will not load the mesa library.

Categories: