Author Topic: Updating wxWidgets project wizard  (Read 42643 times)

Offline PB

  • Multiple posting newcomer
  • *
  • Posts: 57
Updating wxWidgets project wizard
« on: May 21, 2021, 06:15:41 pm »
I have updated wxWidgets project wizard, with the main aim being to improve user experience on MS Windows with GCC.

Here is what I did:

Remove support for obsolete wxWidgets versions 2.6 and 2.8.

Improve linking on MSW:
* Allow linking with libraries introduced in wxWidgets 2.9: PropertyGrid, Ribbon, STC, and WebView.
* Allow linking with OpenGL for the monolithic build too.
* Do not offer to link with the 3rd party libraries (image formats, expat, regex, scintilla, zip), they are not needed for the DLL build and required for the static build.
* Allow linking with Winsock2 instead of Winsock.

By default, assume Unicode will be used and the generated application will be GUI instead of console one.

Make more options persistent and other minor improvements.


I believe the above improves the wizard and I am not aware of any real drawbacks. I have noticed that GitHub has a mirror code repository, which accepts PRs, so I submitted it there: https://github.com/obfuscated/codeblocks_sf/pull/21


There is certainly a room for further improvement and code cleanup. I was also itching to remove support for the ancient Open Watcom and Borland compilers (as I doubt these are supported by modern wxWidgets), but I let that be (for now?).


If anyone is interested in discussing the changes or, hopefully merging the update to Code::Blocks, I would gladly hear them out.

« Last Edit: May 21, 2021, 06:18:22 pm by PB »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Updating wxWidgets project wizard
« Reply #1 on: May 22, 2021, 12:19:25 am »
PB: I wish you luck in getting at least some of the wxWidgets Wizard changes applied; I gave up on getting any of my changes applied a few years back.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Updating wxWidgets project wizard
« Reply #2 on: May 22, 2021, 10:06:14 am »
I've posted some comments.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline PB

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: Updating wxWidgets project wizard
« Reply #3 on: May 23, 2021, 01:05:27 pm »
I have addressed all the comments in the PR and will wait for further input.

One of the questions asked there was: GCC on Windows may not be the best, what about clang?

I have no experience with clang but I installed MSYS2 package mingw-w64-x86_64-clang and built wxWidgets with it, using the mingw makefile. When trying to run the wizard with clang, there were errors, as function OnLeave_WxConf() does not test for clang. After hacking it, i.e., making the same settings for clang as for GCC, the wizard successfully finishes.

However, it seems that clang used as gcc cannot compile the windows resource:
Quote
windres.exe -ID:\Dev\Desktop\!Lib\wxWidgets-GIT\include -ID:\Dev\Desktop\!Lib\wxWidgets-GIT\lib\gcc_dll_clang\mswud  -J rc -O coff -i C:\dev\cb-tests\TEST-C~2\resource.rc -o obj\Debug\resource.res
clang++.exe -LD:\Dev\Desktop\!Lib\wxWidgets-GIT\lib\gcc_dll_clang -o bin\Debug\test-clang10s.exe  obj\Debug\test_clang10sApp.o obj\Debug\test_clang10sMain.o obj\Debug\resource.res  -lwxmsw31ud_webview -lwxmsw31ud_stc -lwxmsw31ud_propgrid -lwxmsw31ud_ribbon -lwxmsw31ud_richtext -lwxmsw31ud_xrc -lwxmsw31ud_aui -lwxmsw31ud_media -lwxbase31ud_net -lwxmsw31ud_gl -lwxmsw31ud_qa -lwxbase31ud_xml -lwxmsw31ud_adv -lwxmsw31ud_html -lwxmsw31ud_core -lwxbase31ud -Wl,--subsystem,windows
llvm-rc: Error in 24 statement (ID 1):
Is a directory
windres: error: llvm-rc failed

The same error was there when I tried to build a wxWidgets sample using GCC makefile too, so it is not a C::B issue.

To conclude, I think clang may not be usable with this wizard, modified or original.

BTW, it seems that clang debugger uses a different interface than GDB, is this supported by C::B?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Updating wxWidgets project wizard
« Reply #4 on: May 23, 2021, 02:50:22 pm »
The main question concerning the wizard is if checking for gcc derived compiler matches clang. If it doesn't then all is good. :)

BTW, it seems that clang debugger uses a different interface than GDB, is this supported by C::B?
Not yet.

p.s. how do you build wx? Just set CC and CXX env variables?
p.p.s. why are you using mingw-clang, when there is a official clang release?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Updating wxWidgets project wizard
« Reply #5 on: May 23, 2021, 02:51:11 pm »
People using the wizard, please check if it still works for your use cases. It should be possible to just test it on an older builds.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline PB

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: Updating wxWidgets project wizard
« Reply #6 on: May 23, 2021, 04:43:16 pm »
The main question concerning the wizard is if checking for gcc derived compiler matches clang. If it doesn't then all is good. :)
Well, I would prefer if the wizard reported unsupported compiler and refused to continue, instead of failing with internal error. But perhaps it works on other platforms besides MSW?

how do you build wx? Just set CC and CXX env variables?

Exactly the same as with GCC, basically something like
Quote
PATH=C:\msys64\clang64\bin;%PATH%
cd %WXWIN%\build\MSW
mingw32-make -f makefile.gcc

why are you using mingw-clang, when there is a official clang release?
I know nothing about clang, using MSYS package seemed to be the simplest and safest way to get the whole working package (all compiler tools, headers, libraries...).

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Updating wxWidgets project wizard
« Reply #7 on: May 24, 2021, 09:58:13 am »
FYI: MSYS2 instead of MSYS.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline PB

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: Updating wxWidgets project wizard
« Reply #8 on: June 01, 2021, 07:19:03 pm »
I wanted to add autodetection of wxWidgets version on MSW. Letting the user select it is not only useless but having a predefined version list is also not future-proof.

My idea was looking for a wxWidgets mandatory library in OnLeave_WxConf(), by finding the library file and parsing the library file name.

E.g. in multilib the file to look for would be
Code
LibPrefix + _T("wxbase") + _T("??") + LibUnicSuffix + _T("?") + LibSuffix;
where I could then extract the version (e.g., "31") from where the two question marks are.

However the IO scripting API does not have a function working with wild cards, e.g. something like wxDir::FindFirst().

I would rather not do something like parse output of dir obtained via ExecuteAndGetOutput(). Any ideas?

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: Updating wxWidgets project wizard
« Reply #9 on: June 02, 2021, 01:33:41 am »
This may be off topic, but be aware on Windows the three main GCC compilers collections/systems are:
1) MSYS2
2) MingW64
3) Cygwin

The MSYS2 and Mingw64 when you start to use them are different and if you try to mix the libraries causes issues. If you do install them on the one PC then based on my experience they will interfere with one another due to search path issues, so I rename the directories when swapping between the three.


Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Updating wxWidgets project wizard
« Reply #10 on: June 02, 2021, 06:18:34 am »
eranif/wx-config-msys2: wx-config tool for MSYS2 based installation of wxWidgets using the mingw64 repository
I recently found this good tool, and Code::Blocks support shell escape in the include search or lib search options, so using this could be simple. I haven't tried this tool yet.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline PB

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: Updating wxWidgets project wizard
« Reply #11 on: June 03, 2021, 10:44:30 am »
This may be off topic, but be aware on Windows the three main GCC compilers collections/systems are:
1) MSYS2
2) MingW64
3) Cygwin

The MSYS2 and Mingw64 when you start to use them are different and if you try to mix the libraries causes issues. If you do install them on the one PC then based on my experience they will interfere with one another due to search path issues, so I rename the directories when swapping between the three.

I must have at least 10 GCC-based compiler toolchains installed, from three different "distributions" (mingw-w64, MSYS2, TDM). I have never encountered any issue but of course, I did not add any of them to the PATH.

Offline PB

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: Updating wxWidgets project wizard
« Reply #12 on: June 03, 2021, 10:57:05 am »
eranif/wx-config-msys2: wx-config tool for MSYS2 based installation of wxWidgets using the mingw64 repository
I recently found this good tool, and Code::Blocks support shell escape in the include search or lib search options, so using this could be simple. I haven't tried this tool yet.

Sorry, I do not understand the relevance.

The wizard supports the following compilers: Open Watcom, Borland C++, MSVC, and GCC. IMO OW and BCC are dead and I do not think MSVC is used much with C::B.

Still, MSYS2 is but one GCC-based MSW distribution. wxWidgets developers suggest that on MSW, you should build wxWidgets by yourself which allows you also to tailor the build to your needs.

Please notice that when using MSYS2 prebuilt package:
1) The library file (and folder?) names are different than those of official wxWidgets binaries or the binaries self-built with GCC makefile (and in future CMake file).
2) AFAIK, the MSYS2 package does not contain the new Edge-based wxWebView, leaving you with the obsolete IE-based one. AFAICT, configure does not even support Edge backend.
3) Of course, you are at mercy of packagers, which wxWidgets versions do they offer and with which options (e.g., for some reason, some people seem to favour the monolithic build).

Do you really want the wizard to be tied to one wxWidgets distribution and being incompatible with self-built and official binaries?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Updating wxWidgets project wizard
« Reply #13 on: June 03, 2021, 12:20:08 pm »
Do you really want the wizard to be tied to one wxWidgets distribution and being incompatible with self-built and official binaries?
No, I think by using eranif/wx-config-msys2 tool, config wx project may be simple. I mean I can only create a simple console project, and tweak the include search path, lib search path and libs by using the shell escape command.

The expect way could let our wxWidgets wizard also support msys2's prebuild libraries.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: Updating wxWidgets project wizard
« Reply #14 on: June 03, 2021, 05:44:14 pm »
The wizard supports the following compilers: Open Watcom, Borland C++, MSVC, and GCC. IMO OW and BCC are dead and I do not think MSVC is used much with C::B.

It may be that MSVC is not very common with C::B, but I have used that combination for many years and still do.