Port project to linux, compiler and linker config

Nov 2, 2022 min read

I am trying to find some old project that makes use of OpenGL for a study group workshop about refactoring and modernization.

I chose: https://github.com/gralm/Geodesic-Dome an eight-year-old project. Target for the windows platform.

This first article is to document the changes that I made to compiling the project on Linux (WSL/Ubuntu) and change to compiling.

Clone repo:

git clone https://github.com/gralm/Geodesic-Dome.git

Install some tools and libs:

sudo apt install g++ make libgl-dev libglu

In main.cpp:

...
#include <GL/glut.h>
#include <windows.h>
#include <stdlib.h>
...

change to:

...
#include <GL/glut.h>
#ifdef WIN32
     #include <windows.h>
#endif
#include <stdlib.h>
...

In makefile:

make -s $(OBJPATH)objTruncatedIcosahedron.o
  $(CC) -o geo.exe $(OBJPATH)*.o -L "C:\MinGW\freeglut\lib" -l freeglut -lopengl32 -lglu32

change to:

make -s $(OBJPATH)objTruncatedIcosahedron.o
  $(CC) -o geo $(OBJPATH)*.o -lGL -lGLU -lX11 -lXext -lXt -lglut

Compile and change permissions and run:

mkdir obj
make
chmod +x geo
./geo

Original https://github.com/gralm/Geodesic-Dome

Port https://github.com/jsonzilla/article_geodesic_dome_port