Build setup on MacOS and Linux for our wxWigets Source

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
Sridhar@Work
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 221
Joined: Fri Jan 08, 2021 8:19 am

Build setup on MacOS and Linux for our wxWigets Source

Post by Sridhar@Work »

Hi

We have our source directory as follows
1. <basedir>/external/wxWidgets ==> This will contain all the wxWidgets-3.1.4 source
2. <basedir>/integration/wxWidgetsdll ==> This contains our wxWidgets dll or shared library source which is compiled in windows/MacOS/Linux.

On windows, we are using visual studio compiler to use the my_dll source code to compile the wxWidgets my_dll source to dll.
On MacOS & Linux, we want to use a makefile or something which will compile the same source (e.g. my_dll) on MacOS and Linux.

Can you help us how to create this makefile which links the external/wxWidgets/lib folder and also other libraries to compile the my_dll on MacOs and Linux in simple way?

All the help that I found on wxWidgets suggest integrating the source to wxWigets/samples but we want to keep it in separate folder and have separate make file or generation scripts to make the compilation work on MacOS & Linux.

Regards
Sree
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Build setup on MacOS and Linux for our wxWigets Source

Post by DavidHart »

Hi,

I'm not sure I understand your question. Are you asking about building wxWidgets, about building your code against a pre-built wx, or both?
Meanwhile, this is a general answer about building wx programs on Linux; I have little Mac knowledge, but I think it is much the same there.

On Linux, you have two sorts of approach:
1) The main Linux distros provide official wxWidgets binary packages which contain wx dynamically-linking libs . So the standard, recommended way is to build against those packages for each target distro/version; this ensures that your program will work on that distro/version. Ideally you also distribute your program in the appropriate way: a deb for debian-derived distros e.g. ubuntu, an rpm for fedora/openSUSE etc...
2) Something else. That might be to self-build wxWidgets (which you'll have to do anyway if your program requires wx3.1.4) in which case you can do so as standard 'dll's, or the less-common, less-tested static-linking libs. You might think that static-linking is the obvious answer: "Hey, we can create a single binary that will work everywhere!". Well, it won't: different distros, or different versions of a distro, will sometimes/often/always fail to run a program built elsewhere because it depends on different versions of the standard libs e.g. libc. Which partly explains why most people should use the option 1).
2.5) Do something harder. There are now systems that try to create 'run anywhere' packages. My limited experience is with AppImage but others include flatpak, snap...

Regards,

David
Post Reply