project-ely/docs/setup/setup-windows.md

3.7 KiB

Go with raylib on Windows

Windows is a bit of a different beast when it comes to setting up a development environment. Hopefully this documentation helps get you started. This guide tries to detail everything you would need to download and configure to get this to work.

Install Git

If you don't have Git yet, you can download it here. https://git-scm.com/

Run through the installer like normal. There are a lot of config options in the installer, and most of the defaults will work fine. You can change them later in your .gitconfig file if needed.

Download the project

You can now use Git to clone the project.

IDE

Some IDEs like VSCode can clone a Git repository inside of them. You might be able to use that if it's easier.

Git Bash

You can use the Git Bash terminal to do this too. Open up Git Bash. This is a Bash terminal configured to work with Git. Go into some directory where you want to keep your coding projects, and then run the following command.

mkdir projects
cd projects
git clone ssh://git@git.wisellama.rocks:222/Project-Ely/project-ely.git

Install Go

We need the Go compiler. Download it and run through the installer like normal. https://go.dev/

Install GCC

GCC is a C compiler (well technically a the GNU Compiler Collection, but we want it for the C compiler part). Go needs GCC's C compiler so that it can compile the low-level code for the SDL libraries.

GCC on Windows is a bit of a special thing. We'll want to install Mingw-64 which is the Windows port of GCC. https://www.mingw-w64.org/downloads/

You will want to download the "x86_64 win32 seh" version such as this one (ideally the latest version available, just providing a full link as an example). https://github.com/niXman/mingw-builds-binaries/releases/download/12.2.0-rt_v10-rev0/x86_64-12.2.0-release-win32-seh-rt_v10-rev0.7z

There is no installer for this, so we just need to put this in a folder that we'll remember. Something like C:\Users\Username\GCC. Extract the 7z file using 7zip (https://www.7-zip.org/) and then move the directory into that GCC folder we created.

Later on, we will need to set up the environment variables so that other software knows where we installed GCC.

Set environment variables

Now that we have all the software downloaded, we need to set some environment variables so that everything will know where we installed the software.

Go to start menu, search for "env", and select "edit the system environment variables", and hit the Environment Variables... button in the bottom right.

Set the following env variables (change the username directory to match your username as needed).

First we need to set GCC as our default C compiler:

CC = gcc

Then we need to enable CGO (allowing the Go compiler to use a C compiler too):

CGO_ENABLED = 1

Then we need to set our "include" path. This is all of the directories that contain C header files to be included in our code. We need this to include the default GCC include directory. (Depending on how you installed GCC, this may already be set). Below is an example, but it would probably be easier to copy-paste your path to get the version information correct.

C_INCLUDE_PATH = C:\Users\Username\GCC\x86_64-12.1.0-release-win32-seh-rt_v10-rev3\mingw64\include;

And depending on how you installed GCC, you may need to also add its bin directory to your path so that you will be able to call the gcc compiler. There are probably other entries already in your PATH variable, so just add this as an additional entry:

PATH = C:\Users\Username\GCC\x86_64-12.1.0-release-win32-seh-rt_v10-rev3\mingw64\bin

Build the software

Now we can just build the software and hope it works!

go build