Using MinGW containing the GCC GNU Compiler Collection and CMake to build OpenGL game projects using GLFW. GLM, Boost, LibPNG and ZLib.
Get zlib sources and use the certutil executable to verify the SHA256 signature:
certutil -hashfile zlibx.zip SHA256
Run CMake:
mkdir build
cd build
cmake ..
Seems to be a problem with windres.exe
path, had to manually shorten the path for this otherwise was getting error during build:
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\windres.exe: preprocessing failed.
mingw32-make.exe[2]: *** [CMakeFiles\zlib.dir\build.make:61: zlib1rc.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:108: CMakeFiles/zlib.dir/all] Error 2
mingw32-make.exe[1]: *** Waiting for unfinished jobs...
Updated build.make
manually.
Run CMake install.
Get libpng, glfw, glm sources.
Use certutil as per.
CMake build install each.
Boost is a chunky one, again get the sources and certutil.
Get the zip or (or recommended 7z) for the Boost sources and extract them to C:\Program Files\Boost\boost_x_x_x\
where the x_x_x
corresponds to the Boost version you have downloaded.
Change directory to the boost directory and run bootstrap
in that directory. First, check that g++
is on your PATH
. Update environment variables as necessary. Then run the command:
b2 address-model=64 architecture=x86 toolset=gcc variant=debug link=shared runtime-link=shared --build-type=complete install
Using in the respective project.
find_package(GLFW3 3.2.1 REQUIRED)
find_package(GLM 0.9.9 REQUIRED)
find_package(PNG 1.4.12 REQUIRED)
find_package(Boost 1.68.0 COMPONENTS log REQUIRED)
Run CMake with the following properties set.
-DGLFW3_DIR="C:/Program Files (x86)/GLFW/lib/cmake/glfw3"
-DCMAKE_PREFIX_PATH="C:/Program Files (x86)/libpng/include";"C:/Program Files (x86)/libpng/lib"
-DBOOSTROOT="C:/Boost"
-DBoost_ARCHITECTURE=-x64
-DBoost_USE_STATIC_LIBS=ON