Hi, I think I found a way to build the wxWidgets application very fast by using the wx library supplied by MSYS2.
I see that the MSYS2 has modified their FindwxWidgets.cmake file recently to support this, the method works OK in both the mitty shell started when you run the mingw64.exe or the normal windows command line(cmd.exe).
I wrote a step by step tutorial in this link:
https://github.com/msys2/MINGW-packages ... 1113904778
Hope that helps.
For me, I can just download the sample folder from wx's github, and build those samples when needed.
MSYS2: using the cmake to created a wxWidgets application
Re: MSYS2: using the cmake to created a wxWidgets application
Hi,
May I bother you on this thread. I have studied this guide and now there is no cmake issue.
The minimal sample compiled and executed in MSYS2 in windows 10 successfully. I use the wxWidgets 3.0.5 for MSYS2. (From this package:
https://packages.msys2.org/package/ming ... po=mingw64)
When I am tried the samples/treelist, sinice there is no CMakeLists.txt, I create one nearly same as in minimal. I got a lot of linking error:
- wx-3.0/wx/treelist.h:136: undefined reference to `wxTreeListCtrl::Init()'
- undefined reference to `vtable for wxTreeListCtrl'
It there any reason on this? How can I solve this?
Do I need to open another thread on this discussion?
Thanks advance.
May I bother you on this thread. I have studied this guide and now there is no cmake issue.
The minimal sample compiled and executed in MSYS2 in windows 10 successfully. I use the wxWidgets 3.0.5 for MSYS2. (From this package:
https://packages.msys2.org/package/ming ... po=mingw64)
When I am tried the samples/treelist, sinice there is no CMakeLists.txt, I create one nearly same as in minimal. I got a lot of linking error:
- wx-3.0/wx/treelist.h:136: undefined reference to `wxTreeListCtrl::Init()'
- undefined reference to `vtable for wxTreeListCtrl'
It there any reason on this? How can I solve this?
Do I need to open another thread on this discussion?
Thanks advance.
Re: MSYS2: using the cmake to created a wxWidgets application
Hi, my guess is that for linking to wxTreeListCtrl related symbols, you have to add some extra libraries in your cmake script.
For example, for a minimal cmake wxWidgets project, you can put some lines like:
But it looks like wxTreeListCtrl does not belong to core or base library?
For example, for a minimal cmake wxWidgets project, you can put some lines like:
Code: Select all
# Request the required wxWidgets libs
find_package(wxWidgets 3.0 COMPONENTS core base REQUIRED)
Re: MSYS2: using the cmake to created a wxWidgets application
With wxWidgets 3.0, you must add the advanced library, e.g.
The advanced library was merged with the core one only in 3.1.2.
Code: Select all
find_package(wxWidgets 3.0 COMPONENTS adv core base REQUIRED)
Re: MSYS2: using the cmake to created a wxWidgets application
Hi, PB, thanks for the reply.
Where can we find the map between the components such as "adv" and the actual linked libraries cmake will generate?
Since you said they differs between wx versions.
Thanks.
Where can we find the map between the components such as "adv" and the actual linked libraries cmake will generate?
Since you said they differs between wx versions.
Thanks.
Re: MSYS2: using the cmake to created a wxWidgets application
The map of the class to library can be found in wxWidgets documentation for the class. As for mapping wxWidgets libraries to FindwxWidgets components, I am not aware of any official source. But it can be seen e.g. in CMakeGui, as those WX_** variables, e.g. WX_adv for wxAdvanced.
Getting rid of wxAdvanced is the only such change I have ever seen in the past dozen or so years. The advanced library (now empty) still exists for compatibility reasons, so in this regard nothing have really changed.
Re: MSYS2: using the cmake to created a wxWidgets application
Thanks, the adv library is added and the sample can be compiled.PB wrote: ↑Wed May 25, 2022 3:25 pm With wxWidgets 3.0, you must add the advanced library, e.g.The advanced library was merged with the core one only in 3.1.2.Code: Select all
find_package(wxWidgets 3.0 COMPONENTS adv core base REQUIRED)
(besides, I cannot receive any notification (email or notification) on this thread, don't know the reason).