User forums > General (but related to Code::Blocks)

codeblocks cbp projects for wx samples

(1/5) > >>

ollydbg:
Hi, I have some friends who are willing to learn wx by wxWidgets' samples.

I can ask them to use Code::Blocks, while, I think the best way to learn is using wx samples from the official wx git repo (This is not only for beginner, also for testing some wx features):

https://github.com/wxWidgets/wxWidgets/tree/master/samples

My idea is we can supply some C::B cbp files for the samples, I see tim has some contribution:

stahta01/msys2_wxwidgets_cb_projects: CB wxWidgets projects using msys2
This repo contains about 10 samples, but not the full wx samples.

I think either using msys2's pre-build library or self build wx library is OK, so are there any suggestions?

Thanks.


EDIT

I found an old reop which is also by tim
stahta01/cb_projects_for_wxWidgets: Code::Blocks projects for building wxWidgets sample code
It was several years ago, and it use the wx-config.exe.

EDIT2

It looks like wx has cmake support, see this document: wxWidgets: CMake Overview
So, maybe we can use official cmake to generate the codeblocks cbp for each samples?


EDIT3
As 2022-09-17, I create a git repo: asmwarrior/cb_projects_for_wxWidgets: Code::Blocks projects for building wxWidgets sample code, which supples Code::Blocks project files(cbp) for each wx sample (wxWidgets 3.2.1), and with the help of wx-config-msys2.exe (from eranif/wx-config-msys2: wx-config tool for MSYS2 based installation of wxWidgets using the mingw64 repository), it can build wx samples under Code::Blocks and link to the prebuild wx library(wxWidgets 3.2) in msys2.


EDIT4
As 2022-10-09
You can tweak the wx-config variable in your C::B, which can use either the wx library supplied by msys2, or you can using the wx library built by yourself by the "makefile.gcc", see this reply for details.
Re: codeblocks cbp projects for wx samples

stahta01:

--- Quote from: ollydbg on September 13, 2022, 03:38:59 am ---
EDIT2

It looks like wx has cmake support, see this document: wxWidgets: CMake Overview
So, maybe we can use official cmake to generate the codeblocks cbp for each samples?

--- End quote ---

I spent about one hour trying that; but, I gave up the cmake support files needed was too old in the MSys2 cmake I had.
I might try again; but, right now I am working on building MINGW64 GCC variants and failing.

I do think it is a best long term way to proceed; but, I need to learn the new wxWidgets cmake way and find the correct cmake support files.

From https://docs.wxwidgets.org/3.2.0/overview_cmake.html

--- Quote ---Recommendations
While CMake in wxWidgets aims to support most generators available in CMake the following generators are recommended:

Windows: Visual Studio (any supported version)
macOS: Xcode
Linux: Ninja or Makefiles
CMake 3.10 or newer is recommended. The minimum version required is 2.8.12.

--- End quote ---

I was not using one of the recommended way; I might try Ninja on my next attempt.

Tim S.

sodev:
Last time i checked (2 or 3 months ago) the CMake way produced a quite ugly result regarding the samples, at least using Visual Studio and Ninja, every sample got placed into one common directory.

ollydbg:
Hi, thanks for the time and help.

I would like to find a simple way, here is my try steps:



I try to create a cbp file which use the makefile.gcc under the sample/minimal folder.

I add the line


--- Code: ---makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 VENDOR=cb

--- End code ---

Because I built wx library with the command:


--- Code: ---mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 VENDOR=cb

--- End code ---

Now, I have a "all" build target of the cbp file.

When I click the "build" button, I got this:


--- Code: ----------------- Build: all in minimal (compiler: GNU GCC Compiler)---------------

[100.0%] Checking if target is up-to-date: mingw32-make.exe -q -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 VENDOR=cb all
Running command: mingw32-make.exe -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 VENDOR=cb all
process_begin: CreateProcess(NULL, F:/msys2/mingw64/bin/ -c "if not exist gcc_mswudll mkdir gcc_mswudll", ...) failed.
make (e=5): 拒绝访问。
mingw32-make: [makefile.gcc:206: gcc_mswudll] Error 5 (ignored)
if not exist gcc_mswudll mkdir gcc_mswudll
windres -i../../samples/sample.rc -ogcc_mswudll\minimal_sample_rc.o    --define __WXMSW__   --define NDEBUG    --define _UNICODE --include-dir .\..\..\lib\gcc_dll\mswu --include-dir ./../../include  --include-dir . --define WXUSINGDLL --define wxUSE_DPI_AWARE_MANIFEST=2 --include-dir ./../../samples --define NOPCH
windres: gcc_mswudll\minimal_sample_rc.o: No such file or directory
mingw32-make: *** [makefile.gcc:224: gcc_mswudll\minimal_sample_rc.o] Error 1
Process terminated with status 2 (0 minute(s), 0 second(s))
3 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 

--- End code ---

The Chinese text means "access deny".

When I look at the makefile.gcc, I see this line:


--- Code: ---$(OBJS):
   -if not exist $(OBJS) mkdir $(OBJS)

--- End code ---

This means the makefile does not work correctly under C::B, while I see it works correctly under Windows cmd.
Here is the log under Windows CMD

--- Code: ---F:\code\wxWidgets-3.2.1\samples\minimal>mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 VENDOR=cb all
if not exist gcc_mswudll mkdir gcc_mswudll
windres -i../../samples/sample.rc -ogcc_mswudll\minimal_sample_rc.o    --define __WXMSW__   --define NDEBUG    --define _UNICODE --include-dir .\..\..\lib\gcc_dll\mswu --include-di
r ./../../include  --include-dir . --define WXUSINGDLL --define wxUSE_DPI_AWARE_MANIFEST=2 --include-dir ./../../samples --define NOPCH
g++ -c -o gcc_mswudll\minimal_minimal.o  -O2 -mthreads -D__WXMSW__   -DNDEBUG    -D_UNICODE -I.\..\..\lib\gcc_dll\mswu -I.\..\..\include  -W -Wall -I. -DWXUSINGDLL -I.\..\..\sample
s -DNOPCH   -Wno-ctor-dtor-privacy   -MTgcc_mswudll\minimal_minimal.o -MFgcc_mswudll\minimal_minimal.o.d -MD -MP minimal.cpp
g++ -o gcc_mswudll\minimal.exe @gcc_mswudll\minimal.exe.rsp   -mthreads -L.\..\..\lib\gcc_dll  -Wl,--subsystem,windows -mwindows        -lwxmsw32u -lwxscintilla -lwxtiff -lwxjpeg -
lwxpng   -lwxzlib -lwxregexu -lwxexpat   -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lve
rsion -lws2_32 -lwininet -loleacc -luxtheme

--- End code ---

So, it looks like a wrong shell is called? or any solutions?

Thanks.

EDIT: problem solved!

The problem is that I have a path:


--- Code: ---$(TARGET_COMPILER_DIR)../usr/bin

--- End code ---

In the compiler's extra path. I just remove this line, and restart C::B, and it is OK now.


EDIT2:

I think this issue has already mentioned by AndrewCot, because I have put the msys' shell path usr/bin to the mingw64/bin path. Though I can use the sh.exe to call the wx-config script, but this also cause this issue.



ollydbg:
I think creating makefile based cbp is simple. but there is one drawback when using makefile based cbps.  :(

That is: code completion plugin/clangd_client plugin doesn't know the include search paths, so no code navigation/code completion.

Navigation

[0] Message Index

[#] Next page

Go to full version