-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Installing a C compiler that works with Go on Windows means installing MinGW or Cygwin, both of which are no fun at all. I would like to be able to build a fyne application on Windows without dependencies. Another issue on Windows are missing OpenGL drivers. Windows works with DirectX natively. Yet another issue is cross-compiling for Windows from another OS which means installing the C compiler that produces Windows binaries there.
As long as fyne uses OpenGL on Windows it is complicated to replace CGo. I have not yet seen an OpenGL wrapper for Go that does not use CGo so you would have to create one. A C-less OpenGL still has other problems on Windows. Windows natively only supports GL 1.1 so you depend on a newer graphics driver to be installed on the user's computer. See issue #410 where OpenGL drivers are hard to install on a virtual machine.
I suggest creating a driver for Windows that replaces GLFW and OpenGL with the native WinAPI and Direct3D9. DirectX version 9 has been shipping with Windows XP and is still supported to this day, meaning it supports the widest range of Windows computers currently out there. This solves both the CGo and the driver problem.
I have been creating Windows desktop programs in Go for some years now. I have a WinAPI wrapper and a Direct3D9 wrapper in pure Go. I use these for example in my Windows GUI library 'wui' and in my game framework 'prototype'.
With these libraries it is possible to compile Windows binaries from pure Go and that do not depend on any extra DLLs at runtime. If you build a 32 bit binary, it can be run on any Windows OS >= XP. Cross compiling is supported by the Go toolchain so you just have to set GOOS=windows
and can compile.
I would be very happy to contribute. Looking at the code I see that glfw
and go-gl
are only used in the driver/glfw
and painter/gl
. I will soon look to see what is necessary to replace these. I wanted to start the issue to see if this is wanted at all and what others have to say first.