Skip to content

How to Compile

ZERICO2005 edited this page Dec 22, 2023 · 3 revisions

How to Compile

(Based on a guide I wrote on 2023, November 28th)

Here is a guide on how to download and setup a GCC, MINGW64, MSYS2 terminal programming environment to compile projects such as Super-Sweeper. Following this guide can ensure maximum compatibility when sharing/distributing code, along with allowing code to work on both Windows and Linux.

This is only a rough outline of how to do things, so it could or could not work. I would also recommend learning how Git and Cmake work. The following steps assume you have just preformed a fresh installation of Windows 10 64bit. (I would also recommend having at least 4 gigabytes of space free)

0. Recommended Software

7-Zip: https://7-zip.org
Very handy for unzipping/extracting files.

Notepad++: https://notepad-plus-plus.org/downloads/
A decent text editor that supports syntax highlighting.

Git Bash: https://git-scm.com/downloads
It is recommend that you download 64bit-Git for Windows Setup.

1. MSYS2 Setup

Download MSYS2 from https://www.msys2.org/. Then find where MSYS2 is located, and run MSYS2 MINGW64 (I suggest pinning it to the taskbar too). Afterwards, run the following commands to install the necessary libraries: (Sometimes you may need to retry running them if they fail)

Mandatory:

  • pacman -S mingw-w64-x86_64-toolchain
  • pacman -S mingw-w64-x86_64-gcc
  • pacman -S mingw-w64-x86_64-cmake
  • pacman -S mingw-w64-x86_64-gdb
  • pacman -S mingw-w64-x86_64-stb
  • pacman -S mingw-w64-x86_64-SDL2

2. Path/Environment Variables

Go to something like C:/msys64/mingw64/bin in Command Prompt as an Admin, and then run mklink make mingw32-make.exe. In the Windows search bar, type Edit the system environment variables. Then click on Environment Variables, afterwards click on the row that says Path under System variables and click Edit. Check to see if C:\msys64\mingw64\bin has been added; if not, then click New to manually add it in.

3. Cloning from GitHub

Now that everything should be set up, we can use Git Bash to clone ABS-Fractal-Explorer from GitHub.

4. Dear Imgui Setup

(Super Sweeper 0.80.1 doesn't use Imgui, so you may skip this step. Future versions might use it later on)

To compile, you may need a few to all of the following files in ./imgui. The files can be obtained from the Dear Imgui GitHub repository https://github.com/ocornut/imgui. Additionally, changing <SDL.h> to <SDL2/SDL.h> could help if things are not working correctly.

  • imconfig.h
  • imgui.cpp
  • imgui.h
  • imgui_demo.cpp
  • imgui_draw.cpp
  • imgui_impl_sdl2.cpp
  • imgui_impl_sdl2.h
  • imgui_impl_sdlrenderer2.cpp
  • imgui_impl_sdlrenderer2.h
  • imgui_internal.h
  • imgui_tables.cpp
  • imgui_widgets.cpp
  • imstb_rectpack.h
  • imstb_textedit.h
  • imstb_truetype.h

5. Compiling with Cmake

Set MSYS2 to the project's directory (Put the directory/path in quotes), and then do cd build. Afterwards, run cmake .. to generate the build files so we can compile the code. Once that is done, type ninja to compile the code. The .exe file should be in ./build/bin.