'How to build a WxWidgets program on github actions?

is it posible to do it? I have previous experience on github actions (linux enviroment for PS2 Software compilation)

now i'm trying to build one of my programs for windows from github actions, and i dont know where to begin.

i need to setup mingw and build the program (the program is stored on a code::blocks project, i've already converted the project file into a Makefile )

https://github.com/israpps/HDL-Batch-installer/



Solution 1:[1]

Of course it is possible to do it, why wouldn't it? More usefully, perhaps, I can say that I do it for several of my own projects using one of the following 2 ways:

  1. Either use wxWidgets binaries, i.e. use the system packages under Linux (Ubuntu environment used by the Actions has wx 3.0.5), or download the binaries under MSW (I do this for the building using MSVS there). In this case you just need to apt-get install or curl the files and then build your application.
  2. Or compile wxWidgets yourself, which is especially useful if you're already use it as your own Git submodule, as you can also test changes to wx version you use in your PRs. In this case you need to add a build step for wxWidgets itself, which is simple enough, but I'd strongly advise to cache the results of building it, as otherwise it can take longer than building your own application -- but caching it works very well and the "Restore cache" step takes just 4s in the build I've just looked at (and this includes a few other 3rd party libraries, not just wx).

Solution 2:[2]

It is possible to build a wxWidgets project on Github-Actions, this being something I have just managed to finish doing myself.

Here is a public Github project demonstrating building one of the simple wxWidgets demo programs using CMake on Github-Actions, building on Linux, macOS and Windows: https://github.com/saxbophone/wxwidgets-test

I am using CPM.cmake to find wxWidgets —this tool tries to find an installed copy of wxWidgets on the system, and clones the repo and builds from source if an installed copy can't be found.

This was not a completely straightforward process, and I have the following observations to make about things that were particular tripping points in the process:

  1. Building with the g++ compiler on macOS does not appear to work (seems some Objective-C++ code is not being interpreted correctly) (log)

  2. Building on Linux requires the development packages of GTK3 and OpenGL to be installed, a requirement that did not appear to be documented in wxWidgets building from source instructions.

  3. Building wxWidgets as a shared library (i.e. DLL) on Windows causes lots of linker issues, which I avoided by specifying the project to always build static libraries with the CMake option DBUILD_SHARED_LIBS=OFF.

  4. The CMake target for your wxWidgets program needs to have the CMake property WIN32 set on it, otherwise you will get linker errors for main(), due to the way Windows distinguishes between GUI and console programs:

    add_executable(demo WIN32 main.cpp)
    
  5. Compiling wxWidgets in-tree (i.e. as a subproject) is time-consuming, therefore caching of dependency source code and successfully built dependency objects (as my sample project does) is recommended to avoid wasting build credits. At the time of testing, wxWidgets contains about ~527MB of source code compressed, and ~127MB of built objects compressed.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 VZ.
Solution 2 saxbophone