antons_opengl_tutorials_book icon indicating copy to clipboard operation
antons_opengl_tutorials_book copied to clipboard

Adopt the project with Meson

Open ebraminio opened this issue 2 years ago • 1 comments

As I couldn't build the project in an M1 macOS using available build scripts which apparently are from x86 era, I adopted the project with Meson. The advantage of Meson will be the whole project can be built using one build script in Linux and macOS and even Windows and all the build scripts of the project and dll binaries can be removed in favor of automatic dependency download and build mechanism of Meson (the subproject/*.wrap files is about this automated fallback mechanism) and even if you don't want to go for only supporting Meson, the current PR doesn't hurt 'make' support of the project so hopefully you like it so we can go for the cleanup steps which can make the project free from binary files if you feel comfortable with.

The only hurdle I see is Meson puts the artifacts outside the source folder so in order to run them one should change the working directory. Here is a complete instruction on how to use it in Linux and macOS,

# Meson can be installed either from pip or from the system package manager
# See also https://mesonbuild.com/Getting-meson.html
pip3 install meson
# This tells meson to use the folder 'build' for creating binaries
meson setup build
# This builds the project inside the aforementioned `build` folder
meson compile -C build
# This runs a build artifact but fixes the working directory also
(cd 00_hello_triangle && ../build/00_hello_triangle)
# Or, use the test suit mechanism to run a specific demo
meson test -C build 14_multi_tex
# Check the validity of all of them
meson test -C build

Windows one which only needs Visual Studio and no longer those libraries .dll/.a files or headers are needed in the repo making the source usable in very different combination of operating system and CPU architecture,

winget install meson
meson setup build
meson compile -C build
meson test -C build

(almost the same as the above, you can even install meson from pip even in Windows but with the preinstalled winget no longer a python installation also is needed)

All the programs compile and run in macOS/Linux/Windows but one or two apparently need newer OpenGL versions but the current macOS support OpenGL is 4.1. There was one issue on of one the headers of assimp in clang which easily can be fixed by removing a {} from a line in one of assimp headers which isn't related to this project or the use of meson AFAICT.

Hopefully you like this also. Thanks!

(interestingly I opened this https://github.com/capnramses/antons_opengl_tutorials_book/issues/2 in 2014!)

ebraminio avatar Sep 18 '23 22:09 ebraminio