Observations about building in GitHub actions. (From a non dev. Apologies for the long post.)
If you put the build instructions for Mac, Win and Linux into 3 different yml action files, only Linux currently works on GitHub.
Win and Mac complain about "SDL not found" or "Framework not found".
The reason seems to be the makefiles.
Linux makefile finds its SDL2 install dynamically with,
- Code: Select all
SDL2_CFLAGS = $(shell sdl2-config --cflags)
SDL2_LIBS = $(shell sdl2-config --libs)
Win makefile uses a path,
- Code: Select all
SDL2_INCLUDE_DIR = \msys64\mingw64\include\SDL2
SDL2_LIB_DIR = \msys64\mingw64\lib
The Win path fails as it can't resolve on GitHub.
As soon as you realise the GitHub "Runners" are nothing like VMs, and are not trying to emulate a desktop environment at all, it makes sense.
'Runners' are just glorified shells grinding through jobs as efficiently as possible, so normal paths just won't work.
Problem is, you can't use 'sdl2-config --libs' on Windows as the resulting '-mwindows' means you lose the terminal.
But you can use something like,
- Code: Select all
SDL2_INCLUDE_DIR = $(shell sdl2-config --prefix)"/include/SDL2"
SDL2_LIB_DIR = $(shell sdl2-config --prefix)"/lib"
and it will work. (Is there a better way than this?)
Getting Mac to build is easy enough if you use brew. I have never used a Mac, but from what I can see, brew is to Mac what MSYS is to Windows.
It's just giving you a Linux style environment and packages. This means if you have built with Linux or MSYS, you already know what the header and lib paths have to be.
With that in mind, you can create a Mac makefile similar to the Windows one, also finding the SDL2 install dynamically.
You will need to change the Framework lib names to their standard lib names.
- Code: Select all
-framework SDL2 simply becomes -lSDL2
-framework SDL2_net simply becomes -lSDL2_net
Also, you will need to remove '-DSUPERMODEL_OSX' from 'PLATFORM_CXXFLAGS' to avoid getting derailed by the '#ifdef SUPERMODEL_OSX' macro in Src\OSD\SDL\SDLIncludes.h
You will need to dodge that macro as you are no longer using the SDL2 Frameworks which have a different directory structure.
Here's a repo with all 3 building...
https://github.com/ToBul/Supermodel/commits/workflowsBtw, these yml scripts only build Supermodel. 'Artifacts' appear in the respective Actions workflow summary. Posting a 'Release' will need an extra step that I've not even played with.
I actually fear a world where everyone is posting their own releases, so I'm reluctant to go any further.
Thoughts:
GitHub doesn't currently have a Mac M1 runner, but could it be possible to use the normal Mac runner and create a cross build?
If brew is like MSYS, you should be able to install the ARM packages, change the paths, libs and override the ARCH flag to create the right tool chain?
We need some Mac users to try it and see if it's possible. Please post you're results here if you have any luck.