My Build Environments – Part 1


Categories:

The most common question I see on the internet is usually “how do I set my environment up”, This question usually is asked from someone using a Windows OS. It is a fair question to ask, and before VSCode, there was not a very obvious answer (IMO). Thankfully its 2022 now, and there’s plenty of options – these are how my Build environments are setup.

Windows

My windows setup is simple to manage, as 90-95% of it is handled for me with MSYS2 . It might be “cheating” but I found in the past having to manage all your libraries and header files across a bunch of folders on windows is a “bad time”.

Steps to get going are:
Install MSYS2
Install Compiler
install Libraries (SDL2, Vulkan, etc)
Setup Environment Variables

Once you have MSYS2 install, use pacman to install the remaining items you want/need, I use the following packages for my SDL/OPENGL projects:
# Compiler
mingw-w64-x86_64-gcc
mingw-w64-x86_64-gdb
# Libraries
mingw-w64-x86_64-SDL
mingw-w64-x86_64-SDL2
mingw-w64-x86_64-SDL2_image
mingw-w64-x86_64-SDL2_mixer
mingw-w64-x86_64-SDL2_ttf
mingw-w64-x86_64-freetype
mingw-w64-x86_64-vulkan-headers

To Setup your Environment Variables search for “Edit Environment Variables for your Account” in the start menu and set the following variables (as your user or SYSTEM level.

With those all set you should be able to start using gcc either manually in a terminal, or though VSCode.

Mac

My Mac build environment is simpler due to OS X providing us a compiler already (we have to install it, but it’s there). The high level view looks like this:
Install XCode + CLI tools (git)
Install Frameworks (SDL2, SDL2_Mixer)
Install Brew
Install Freetype Library

To install XCode you can go to AppStore and install “development tools”. After going to the SDL2 website and grabbing the OSX files, I copy them to /Library/Frameworks/ rather than my home Library folder. I wont go over how to install Brew here, but once you have it you can brew install freetype2

Linux

On Linux, I use the local package manager to install gcc, gdb, and all the -devel packages for SDL2 , etc. Search the package manager if you cannot find the names for your Distro. It is the easiest and quickest to setup and get building.

Leave a Reply