Cross-compiling

Compiling an nk-based application for a different operating system can be a complicated process due to its requirement to use CGo to communicate with native OpenGL libraries. However, if you've worked through Chapter 5andlabs UI - Cross-platform Native UIs, or Chapter 8Shiny - Experimental Go GUI API, this should already be set up. If you've jumped straight to this chapter, then you may need to follow the steps in the Appendix, in the Cross-Compiler Setup. Once that's complete, you should have new compilers available (named o32-clang for macOS or x86_64-w64-mingw32-gcc for Windows) that are able to link to macOS Foundation APIs and Windows system calls respectively.

To build the application, we now set up the GOOS and CGO_ENABLED flags as before, but also specify the compiler to use through an extra CC environment variable, setting it to o32-clang for the Darwin OS or x86_64-w64-mingw32-gcc for Windows. With that configuration complete, we can build our nk application for macOS and Windows from our Linux Terminal:

Compiling for Linux, macOS, and Windows from a Linux Terminal

Now that we've built our first nk application, let's look further into what the underlying Nuklear library supports for building application GUIs.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.214.27